MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / _wikify_one

Function _wikify_one

main.py:133–150  ·  view source on GitHub ↗

Wikifies one link.

(language, pat)

Source from the content-addressed store, hash-verified

131
132
133def _wikify_one(language, pat):
134 """
135 Wikifies one link.
136 """
137 page_title = pat.group(2)
138 if pat.group(1):
139 page_name = pat.group(1).rstrip('|')
140 else:
141 page_name = page_title
142
143 # interwiki
144 if ':' in page_name and not page_name.startswith("http"):
145 parts = page_name.split(':', 2)
146 if page_name == page_title:
147 page_title = parts[1]
148
149 link = "<a href='%s'>%s</a>" % (pageurl(page_name, language), page_title)
150 return link
151
152
153def wikify(text, language):

Callers

nothing calls this directly

Calls 2

pageurlFunction · 0.85
splitMethod · 0.45

Tested by

no test coverage detected