Ejemplo n.º 1
0
def main():
    maker = ReadmeMaker(
        PROJECT_NAME,
        OUTPUT_DIR,
        is_make_toc=True,
        project_url=f"https://github.com/thombashi/{PROJECT_NAME}",
    )

    maker.inc_indent_level()
    maker.write_chapter("Summary")
    maker.write_introduction_file("summary.txt")
    maker.write_introduction_file("badges.txt")

    maker.write_introduction_file("installation.rst")

    maker.set_indent_level(0)
    maker.write_chapter("Documentation")
    maker.write_lines([f"https://{PROJECT_NAME:s}.rtfd.io/"])

    return 0
Ejemplo n.º 2
0
def write_examples(maker: ReadmeMaker) -> None:
    maker.set_indent_level(0)
    maker.write_chapter("Examples")

    example_root = Path("pages").joinpath("examples")
    maker.inc_indent_level()

    maker.write_chapter("Sanitize a filename")
    maker.write_file(example_root.joinpath("sanitize_filename_code.txt"))

    maker.write_chapter("Sanitize a filepath")
    maker.write_file(example_root.joinpath("sanitize_filepath_code.txt"))

    maker.write_chapter("Validate a filename")
    maker.write_file(example_root.joinpath("validate_filename_code.txt"))

    maker.write_chapter("Check a filename")
    maker.write_file(example_root.joinpath("is_valid_filename_code.txt"))

    maker.write_chapter("filename/filepath validator for argparse")
    maker.write_file(example_root.joinpath("argparse_validator.txt"))

    maker.write_chapter("filename/filepath sanitizer for argparse")
    maker.write_file(example_root.joinpath("argparse_sanitizer.txt"))

    maker.write_chapter("filename/filepath validator for click")
    maker.write_file(example_root.joinpath("click_validator.txt"))

    maker.write_chapter("filename/filepath sanitizer for click")
    maker.write_file(example_root.joinpath("click_sanitizer.txt"))

    maker.write_chapter("For more information")
    maker.write_lines([
        "More examples can be found at ",
        "https://{}.rtfd.io/en/latest/pages/examples/index.html".format(
            PROJECT_NAME),
    ])
Ejemplo n.º 3
0
def write_examples(maker: ReadmeMaker) -> None:
    maker.set_indent_level(0)
    maker.write_chapter("Examples")

    examples_root = Path("pages").joinpath("examples")

    maker.set_indent_level(1)
    maker.write_chapter("Write tables")
    maker.inc_indent_level()

    maker.write_chapter("Write a Markdown table")
    maker.write_file(
        examples_root.joinpath("table_format", "text", "markdown_example.txt"))

    with maker.indent():
        maker.write_chapter("Write a Markdown table with a margin")
        maker.write_file(
            examples_root.joinpath("table_format", "text",
                                   "markdown_example_with_margin.txt"))

    with maker.indent():
        maker.write_chapter("Write a Markdown table to a stream or a file")
        maker.write_lines([
            "`Refer an example <https://github.com/thombashi/pytablewriter/blob/master/examples/py/stream/configure_stream.py>`__"
        ])

    maker.write_chapter("Write a table to an Excel sheet")
    maker.write_file(
        examples_root.joinpath("table_format", "binary", "spreadsheet",
                               "excel_single_example.txt"))

    maker.write_chapter("Write a Unicode table")
    maker.write_file(
        examples_root.joinpath("table_format", "text", "unicode_example.txt"))

    maker.write_chapter(
        "Write a table with JavaScript format (as a nested list variable definition)"
    )
    maker.write_file(
        examples_root.joinpath("table_format", "text", "sourcecode",
                               "javascript_example.txt"))

    maker.write_chapter(
        "Write a Markdown table from ``pandas.DataFrame`` instance")
    maker.write_file(
        examples_root.joinpath("datasource",
                               "from_pandas_dataframe_example.txt"))

    maker.write_chapter("Write a markdown table from a space-separated values")
    maker.write_file(
        examples_root.joinpath("datasource", "from_ssv_example.txt"))

    maker.set_indent_level(1)
    maker.write_chapter("Get rendered tabular text as str")
    maker.write_file(examples_root.joinpath("output", "dump", "dumps.txt"))

    maker.set_indent_level(1)
    maker.write_chapter("Configure table styles")
    maker.inc_indent_level()
    maker.write_chapter("Column styles")
    maker.write_file(
        examples_root.joinpath("style", "column_style_example.txt"))

    maker.write_chapter("Style filter")
    maker.write_file(examples_root.joinpath("style", "theme.txt"))

    maker.set_indent_level(1)
    maker.write_chapter("Make tables for specific applications")
    maker.inc_indent_level()

    maker.write_chapter("Render a table on Jupyter Notebook")
    maker.write_file(
        examples_root.joinpath("jupyter_notebook",
                               "jupyter_notebook_example.txt"))

    maker.set_indent_level(1)
    maker.write_chapter("Multibyte character support")
    maker.inc_indent_level()

    maker.write_chapter("Write a table using multibyte character")
    maker.write_file(
        examples_root.joinpath("multibyte", "multibyte_table_example.txt"))

    maker.set_indent_level(1)
    maker.write_chapter("Multi processing")
    maker.write_file(examples_root.joinpath("customize", "multi_process.txt"))

    # maker.write_chapter("Create Elasticsearch index and put data")
    # maker.write_file(examples_root.joinpath("table_format", "elasticsearch_example.txt"))

    maker.set_indent_level(1)
    maker.write_chapter("For more information")
    maker.write_lines([
        "More examples are available at ",
        f"https://{PROJECT_NAME:s}.rtfd.io/en/latest/pages/examples/index.html",
    ])
Ejemplo n.º 4
0
def write_examples(maker: ReadmeMaker) -> None:
    maker.set_indent_level(0)
    maker.write_chapter("Examples")

    examples_root = Path("pages").joinpath("examples")

    maker.set_indent_level(1)
    maker.write_chapter("Write tables")
    maker.inc_indent_level()

    maker.write_chapter("Write a Markdown table")
    maker.write_file(
        examples_root.joinpath("table_format", "text", "markdown_example.txt"))

    maker.inc_indent_level()
    maker.write_chapter("Write a Markdown table with a margin")
    maker.write_file(
        examples_root.joinpath("table_format", "text",
                               "markdown_example_with_margin.txt"))
    maker.dec_indent_level()

    maker.write_chapter("Write a reStructuredText table (Grid Tables)")
    maker.write_file(
        examples_root.joinpath("table_format", "text", "rst",
                               "rst_grid_table_example.txt"))

    maker.write_chapter(
        "Write a table with JavaScript format (as a nested list variable definition)"
    )
    maker.write_file(
        examples_root.joinpath("table_format", "text", "sourcecode",
                               "javascript_example.txt"))

    maker.write_chapter("Write a table to an Excel sheet")
    maker.write_file(
        examples_root.joinpath("table_format", "binary", "spreadsheet",
                               "exel_single_example.txt"))

    maker.write_chapter("Write a Unicode table")
    maker.write_file(
        examples_root.joinpath("table_format", "text", "unicode_example.txt"))

    maker.write_chapter(
        "Write a Markdown table from ``pandas.DataFrame`` instance")
    maker.write_file(
        examples_root.joinpath("datasource",
                               "from_pandas_dataframe_example.txt"))

    maker.write_chapter("Write a markdown table from a space-separated values")
    maker.write_file(
        examples_root.joinpath("datasource", "from_ssv_example.txt"))

    maker.set_indent_level(1)
    maker.write_chapter("Get rendered tabular text as str")
    maker.write_file(examples_root.joinpath("output", "dump", "dumps.txt"))

    maker.set_indent_level(1)
    maker.write_chapter("Configure table styles")
    maker.inc_indent_level()
    maker.write_file(examples_root.joinpath("style", "style_example.txt"))

    maker.set_indent_level(1)
    maker.write_chapter("Make tables for specific applications")
    maker.inc_indent_level()

    maker.write_chapter("Create Elasticsearch index and put data")
    maker.write_file(
        examples_root.joinpath("table_format", "elasticsearch_example.txt"))

    maker.write_chapter("Render a table on Jupyter Notebook")
    maker.write_file(
        examples_root.joinpath("jupyter_notebook",
                               "jupyter_notebook_example.txt"))

    maker.set_indent_level(1)
    maker.write_chapter("Multibyte character support")
    maker.inc_indent_level()

    maker.write_chapter("Write a table using multibyte character")
    maker.write_file(
        examples_root.joinpath("multibyte", "multibyte_table_example.txt"))

    maker.set_indent_level(1)
    maker.write_chapter("For more information")
    maker.write_lines([
        "More examples are available at ",
        "https://{:s}.rtfd.io/en/latest/pages/examples/index.html".format(
            PROJECT_NAME),
    ])