Bridge Constructor: added anchor link in mediawiki constructor
This commit is contained in:
parent
d1a13267e8
commit
2ae97de392
1 changed files with 15 additions and 2 deletions
|
|
@ -226,6 +226,19 @@ class MediawikiConstructor(Constructor):
|
|||
self.core_template="mediawiki_template.tpl"
|
||||
self.core_dest="mediawiki.wiki"
|
||||
|
||||
def _addTextDecorations(self, text):
|
||||
"""Add text decorations like coloration or shortcuts"""
|
||||
|
||||
def anchor_link(match):
|
||||
link = match.group(1)
|
||||
#we add anchor_link for [method_name] syntax:
|
||||
if link in self.bridge_template.sections():
|
||||
return "[[#%s|%s]]" % (link, link)
|
||||
print ("WARNING: found an anchor link to an unknown method")
|
||||
return link
|
||||
|
||||
return re.sub(r"\[(\w+)\]", anchor_link, text)
|
||||
|
||||
def _wikiParameter(self, name, sig_in):
|
||||
"""Format parameters with the wiki syntax
|
||||
@param name: name of the function
|
||||
|
|
@ -240,7 +253,7 @@ class MediawikiConstructor(Constructor):
|
|||
if arg_doc.has_key(i):
|
||||
name,doc=arg_doc[i]
|
||||
doc='\n:'.join(doc.rstrip('\n').split('\n'))
|
||||
wiki.append("; %s: %s" % (name, doc))
|
||||
wiki.append("; %s: %s" % (name, self._addTextDecorations(doc)))
|
||||
else:
|
||||
wiki.append("; arg_%d: " % i)
|
||||
if arg_default.has_key(i):
|
||||
|
|
@ -255,7 +268,7 @@ class MediawikiConstructor(Constructor):
|
|||
wiki=[]
|
||||
if arg_doc.has_key('return'):
|
||||
wiki.append('\n|-\n! scope=row | return value\n|')
|
||||
wiki.append('<br />\n'.join(arg_doc['return'].rstrip('\n').split('\n')))
|
||||
wiki.append('<br />\n'.join(self._addTextDecorations(arg_doc['return']).rstrip('\n').split('\n')))
|
||||
return "\n".join(wiki)
|
||||
|
||||
def generateCoreSide(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue