Skip to content

Commit 152d2cf

Browse files
authored
Fix source URLs for glm.* members. (#94)
GLAPI members defined in a versioned package (e.g. `v1beta3) were generating an incorrect URL for the "view on github" link. To test the regex I ran it on a suspended instance of the script: ``` diff -u <(egrep -Iir 'generativelanguage_\w+\.types' docs/api/google/ai/generativelanguage/ --include=*.md) \ <(egrep -Iir 'generativelanguage_\w+.types' docs/api/google/ai/generativelanguage/ --include=*.md) ``` Output [here](http://go/paste/6300090913259520), but it only matched `<a href />`s.
1 parent e5f4463 commit 152d2cf

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

docs/build_docs.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,7 @@ def gen_api_docs():
176176

177177
doc_generator = MyDocGenerator(
178178
root_title=PROJECT_FULL_NAME,
179-
# Replace `tensorflow_docs.api_generator` with your module, here.
180179
py_modules=[("google", google)],
181-
# Replace `tensorflow_docs.api_generator` with your module, here.
182180
base_dir=(
183181
pathlib.Path(palm.__file__).parent,
184182
pathlib.Path(glm.__file__).parent.parent,
@@ -223,7 +221,7 @@ def gen_api_docs():
223221
new_content = re.sub(r".*?`oneof`_ ``_.*?\n", "", new_content, re.MULTILINE)
224222
new_content = re.sub(r"\.\. code-block:: python.*?\n", "", new_content)
225223

226-
new_content = re.sub(r"generativelanguage_\w+.types", "generativelanguage", new_content)
224+
new_content = re.sub(r"generativelanguage_\w+\.types", "generativelanguage", new_content)
227225

228226
if new_content != old_content:
229227
fpath.write_text(new_content)

0 commit comments

Comments
 (0)