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):
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
You can’t perform that action at this time.
0 commit comments