File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -127,13 +127,19 @@ def inject_class_links(text):
127
127
""" Finds all occurences of known class names in the given text and
128
128
replaces them with relative links to those classes.
129
129
"""
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 :
132
139
matches = list (re .finditer (pattern , text ))
133
140
for match in reversed (matches ):
134
141
start , end = match .span ()
135
- link = tag (match .group (), "a" ,
136
- {"href" :"#" + snake_case (cls .__name__ )})
142
+ link = tag (match .group (), "a" , {"href" : link })
137
143
text = text [:start ] + link + text [end :]
138
144
return text
139
145
You can’t perform that action at this time.
0 commit comments