def __init__(self, config): self.config = config if not NewtonUtils.check_path_exists(WIKI_DIR): NewtonUtils.make_path(WIKI_DIR) if not NewtonUtils.check_path_exists(WIKI_DATA): NewtonUtils.make_path(WIKI_DATA) if not NewtonUtils.check_path_exists(WIKI_MEDIA): NewtonUtils.make_path(WIKI_MEDIA) if not NewtonUtils.check_path_exists(WIKI_STYLES): NewtonUtils.make_path(WIKI_STYLES) if not NewtonUtils.check_path_exists(WIKI_HOME): NewtonUtils.write_wiki_file(os.path.join(WIKI_DATA, 'NewtonHome'), NewtonWikiText.NEWTON_HOME_TEXT) # we have to overwrite the default styles and NewtonSyntax to allow extra features NewtonUtils.write_wiki_file(os.path.join(WIKI_STYLES, 'Human.css'), NewtonUtils.get_file_contents(os.path.join(DATA_DIR, 'Human.css')).replace("@PIXMAPS_DIR@", PIXMAPS_DIR)) NewtonUtils.write_wiki_file(os.path.join(WIKI_STYLES, 'Blue.css'), NewtonUtils.get_file_contents(os.path.join(DATA_DIR, 'Blue.css')).replace("@PIXMAPS_DIR@", PIXMAPS_DIR)) NewtonUtils.write_wiki_file(os.path.join(WIKI_DATA, 'NewtonSyntax'), NewtonWikiText.NEWTON_SYNTAX_TEXT) self.parser = TextParser(config) self.history = History()
def media_exists_class(self, media): if NewtonUtils.check_path_exists(media): return "wikilink3" else: return "wikilink2"
def page_exists_class(self, page): if NewtonUtils.check_path_exists(NewtonUtils.path_from_nodename(page)): return "wikilink1" else: return "wikilink2"