def convert_internal_link(mw_target): """ Convert an internal Mediawiki link, with or without an anchor # in the middle. Same as converting a plain pagename, only we want to preserve any #s in the target text. """ parts = mw_target.split("#") return "#".join([dokuwiki.make_dokuwiki_pagename(part) for part in parts])
def convert(link, context, trailing_newline): if is_file_namespace(link.target): # is a link to a file or image filename = dokuwiki.make_dokuwiki_pagename(canonicalise_file_namespace(link.target)) caption = convert_children(link, context).strip() if len(caption) > 0: return "{{%s%s}}" % (filename, caption) else: return "{{%s}}" % filename print("WARNING: Ignoring namespace link to " + link.target) return convert_children(link, context)
def convert(link, context, trailing_newline): if is_file_namespace(link.target): # is a link to a file or image filename = dokuwiki.make_dokuwiki_pagename( canonicalise_file_namespace(link.target)) caption = convert_children(link, context).strip() if len(caption) > 0: return u"{{%s%s}}" % (filename, caption) else: return u"{{%s}}" % filename print("WARNING: Ignoring namespace link to " + link.target) return convert_children(link, context)
def convert_internal_link(mw_target): """ Convert an internal Mediawiki link, with or without an anchor # in the middle. Same as converting a plain pagename, only we want to preserve any #s in the target text. """ if "#" in mw_target: page, anchor = mw_target.split("#", 1) else: page = mw_target anchor = None if len(page): page = dokuwiki.make_dokuwiki_pagename(page) if anchor is not None: page = page + "#" + dokuwiki.make_dokuwiki_heading_id(anchor) return page
def convert_internal_link(mw_target): """ Convert an internal Mediawiki link, with or without an anchor # in the middle. Same as converting a plain pagename, only we want to preserve any #s in the target text. """ if "#" in mw_target: page,anchor = mw_target.split("#",1) else: page = mw_target anchor = None if len(page): page = dokuwiki.make_dokuwiki_pagename(page) if anchor is not None: page = page + "#" + dokuwiki.make_dokuwiki_heading_id(anchor) return page