Skip to content

Commit 15cf296

Browse files
Change API doc generator to link PaginatedCollection to pagination docs.
1 parent a275e37 commit 15cf296

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

tools/db_object_doc_gen.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,19 @@ def inject_class_links(text):
127127
""" Finds all occurences of known class names in the given text and
128128
replaces them with relative links to those classes.
129129
"""
130-
for cls in _ALL_CLASSES:
131-
pattern = r"\b(%s.)?%ss?\b" % (cls.__module__, cls.__name__)
130+
pattern_link_pairs = [
131+
(r"\b(%s.)?%ss?\b" % (cls.__module__, cls.__name__),
132+
"#" + snake_case(cls.__name__))
133+
for cls in _ALL_CLASSES
134+
]
135+
pattern_link_pairs.append((r"\bPaginatedCollection\b",
136+
"general-concepts#pagination"))
137+
138+
for pattern, link in pattern_link_pairs:
132139
matches = list(re.finditer(pattern, text))
133140
for match in reversed(matches):
134141
start, end = match.span()
135-
link = tag(match.group(), "a",
136-
{"href":"#" + snake_case(cls.__name__)})
142+
link = tag(match.group(), "a", {"href": link})
137143
text = text[:start] + link + text[end:]
138144
return text
139145

0 commit comments

Comments
 (0)