def generate_epub_files(target_dir, markdown_name, ebook_type: BookType):
    """
    Pandoc markdown to epub
    """
    regenerate_ebook_build_dir(target_dir, ebook_type)
    combine_markdown_files(markdown_name(
        "assembled-stripped"), strip_notes=True)
    combine_sample_markdown(markdown_name("sample"))
    os.chdir(str(target_dir))
    print(f"Producing {target_dir.name}")
    pandoc_epub_command(
        markdown_name("assembled-stripped"),
        epub_name(),
        config.title,
        ebook_type)
    pandoc_epub_command(
        markdown_name("sample"),
        epub_name("-Sample"),
        config.title + " Sample",
        ebook_type)

    if ebook_type is BookType.MOBI:
        ebook_type = BookType.MOBIMONO
    pandoc_epub_command(
        markdown_name("assembled-stripped"),
        epub_name("-monochrome"),
        config.title,
        ebook_type,
        highlighting="monochrome")
    pandoc_epub_command(
        markdown_name("sample"),
        epub_name("-monochrome-Sample"),
        config.title + " Sample",
        ebook_type,
        highlighting="monochrome")
def convert_to_docx():
    """
    Pandoc markdown to docx
    """
    regenerate_ebook_build_dir(config.docx_build_dir, BookType.DOCX)
    combine_markdown_files(config.docx_md(
        "assembled-stripped"), strip_notes=True)
    os.chdir(str(config.docx_build_dir))
    pandoc_docx_command(
        config.docx_md("assembled-stripped"), config.base_name + ".docx", config.title)
    return f"{config.docx_build_dir.name} Completed"
Beispiel #3
0
def markdown_combine():
    """Combine Markdown files into a single file"""
    click.echo(
        util.combine_markdown_files(config.combined_markdown,
                                    strip_notes=False))
    os.system(f"subl  {config.combined_markdown}")