示例#1
0
def output(f, format, thread, posts):
    if format == "json":
        thread.json_dump(f, subset=posts, indent=4)
    elif format == "html":
        f.write(archivelib.render_html(thread, posts))
    elif format == "plaintext":
        f.write(archivelib.render_plaintext(thread, posts))
示例#2
0
def output(f, format, thread, posts):
    if format == "json":
        thread.json_dump(f, subset=posts, indent=4)
    elif format == "html":
        f.write(archivelib.render_html(thread, posts))
    elif format == "plaintext":
        f.write(archivelib.render_plaintext(thread, posts))
示例#3
0
def write_html_dir(src, dest, thread, posts):
    image_src_dir = os.path.join(src, "images")
    image_dest_dir = os.path.join(dest, "images")
    html_dest = os.path.join(dest, "thread.html")

    if os.path.exists(dest):
        shutil.rmtree(dest)
    os.makedirs(dest, exist_ok=True)
    shutil.copytree(image_src_dir, image_dest_dir)
    with open(html_dest, "w") as f:
        f.write(archivelib.render_html(thread, posts))
示例#4
0
def write_html_dir(src, dest, thread, posts):
    image_src_dir = os.path.join(src, "images")
    image_dest_dir = os.path.join(dest, "images")
    html_dest = os.path.join(dest, "thread.html")

    if os.path.exists(dest):
        shutil.rmtree(dest)
    os.makedirs(dest, exist_ok=True)
    shutil.copytree(image_src_dir, image_dest_dir)
    with open(html_dest, "w") as f:
        f.write(archivelib.render_html(thread, posts))