def make_dokuwiki_pagename(mediawiki_name): """ Convert a canonical mediawiki pagename to a dokuwiki pagename Any namespacing that is in the form of a / is replaced with a : """ result = mediawiki_name.replace(" ","_") return names.clean_id(camel_to_underscore(result)).replace("/",":")
def make_dokuwiki_pagename(mediawiki_name): """ Convert a canonical mediawiki pagename to a dokuwiki pagename Any namespacing that is in the form of a / is replaced with a : """ result = mediawiki_name.replace(" ", "_") return names.clean_id(camel_to_underscore(result)).replace("/", ":")
def make_dokuwiki_pagename(mediawiki_name): """ Convert a canonical mediawiki pagename to a dokuwiki pagename Any namespacing that is in the form of a / is replaced with a : """ result = mediawiki_name.replace(" ","_") result = names.clean_id(camel_to_underscore(result)).replace("/",":") result = codecs.encode(result, sys.getfilesystemencoding(), "replace") return result
def make_dokuwiki_heading_id(mw_heading_name): """ Convert a Mediawiki internal anchor heading link to the Dokuwiki anchor heading link id Equivalent function in dokuwiki is _headerToLink in inc/parser/xhtml.php which calls sectionID in inc/pageutils.php """ result = names.clean_id(mw_heading_name, True) result = re.sub(r'[:.]', '', result) nums_stripped = result.lstrip("0123456789_-") if len(nums_stripped): return nums_stripped else: return "section"+re.sub(r"[^0-9]+", "", result)
def make_dokuwiki_pagename(mediawiki_name): """ Convert a canonical mediawiki pagename to a dokuwiki pagename Any namespacing that is in the form of a / is replaced with a : """ result = mediawiki_name.replace(" ", "_") # We have pages that have ':' in them - replace with underscores result = result.replace(':', '_') result = names.clean_id(camel_to_underscore(result)).replace("/", ":") # Some of our mediawiki page names begin with a '/', which results in os.path.join assuming the page is an absolute path. if result[0] == ':': result = result.lstrip(':') # Fix any pages that began with a space, because that breaks dokuwiki result = result.replace(":_", ":") result = codecs.encode(result, sys.getfilesystemencoding(), "replace") return result