-
-
Notifications
You must be signed in to change notification settings - Fork 42
/
make_readme.py
130 lines (94 loc) · 4.12 KB
/
make_readme.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/usr/bin/env python
# encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import unicode_literals
import sys
from path import Path
from readmemaker import ReadmeMaker
PROJECT_NAME = "pytablewriter"
OUTPUT_DIR = ".."
def write_examples(maker):
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", "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", "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", "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", "sourcecode", "javascript_example.txt"))
maker.write_chapter("Write a table to an Excel sheet")
maker.write_file(
examples_root.joinpath("table_format", "spreadsheet", "exel_single_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("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("Formatting a table for Jupyter Notebook")
maker.write_file(examples_root.joinpath("jupyter_notebook", "jupyter_notebook_example.txt"))
maker.set_indent_level(1)
maker.write_chapter("Multibyte charater 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),
]
)
def main():
maker = ReadmeMaker(
PROJECT_NAME,
OUTPUT_DIR,
is_make_toc=True,
project_url="https://github.com/thombashi/{}".format(PROJECT_NAME),
)
maker.write_chapter("Summary")
maker.write_introduction_file("summary.txt")
maker.write_introduction_file("badges.txt")
maker.write_introduction_file("feature.txt")
write_examples(maker)
maker.write_file(maker.doc_page_root_dir_path.joinpath("installation.rst"))
maker.set_indent_level(0)
maker.write_chapter("Documentation")
maker.write_lines(["https://{:s}.rtfd.io/".format(PROJECT_NAME)])
maker.write_chapter("Related Project")
maker.write_lines(
[
"- `pytablereader <https://github.com/thombashi/pytablereader>`__",
" - Tabular data loaded by ``pytablereader`` can be written "
"another tabular data format with ``pytablewriter``.",
]
)
maker.write_chapter("Tasks")
maker.write_lines(["https://trello.com/b/kE0XG34y"])
return 0
if __name__ == "__main__":
sys.exit(main())