Beispiel #1
0
def split_into_files(wiki: Entry):
    wiki_pages = RedditWikiReader.wiki_pages

    topcats = {}

    wiki = wiki.copy()

    for page in wiki_pages:
        topcats[page] = wiki.find_child(page)
        if topcats[page] is not None:
            wiki.children.remove(topcats[page])

    if len(wiki.children) > 0:
        topcats['misc'] = wiki
    else:
        topcats['misc'] = None

    return topcats
Beispiel #2
0
def write_wiki(wiki: Entry):
    for p in wiki_pages:
        node = wiki.find_child(p)
        if node is None:
            continue
        write_wiki_page(p, repr(node))