Skip to content

Commit c2ea8f7

Browse files
committed
a bit of documentation and reformatting
1 parent 2ca8ef7 commit c2ea8f7

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,27 @@ HANDWRITTEN=content
55
SCHEMA_SRC=test/plot-schema.json
66
TMP=tmp
77
EXAMPLES_DIR=${TMP}/javascript
8-
EXAMPLES_FILE=${EXAMPLES_DIR}/axes/index.html
8+
EXAMPLES_FILE=${EXAMPLES_DIR}/axes/index.html # could be any of the generated files
99
REFERENCE_DIR=${TMP}/reference
10-
REFERENCE_FILE=${REFERENCE_DIR}/bar/index.html
10+
REFERENCE_FILE=${REFERENCE_DIR}/bar/index.html # could be any of the generated files
1111

1212
## commands: show available commands
1313
commands:
1414
@grep -h -E '^##' ${MAKEFILE_LIST} | sed -e 's/## //g' | column -t -s ':'
1515

16-
## docs: rebuild documentation
16+
## docs: rebuild full documentation in `./docs`
1717
.PHONY: docs
1818
docs: ${EXAMPLES_FILE} ${REFERENCE_FILE}
1919
${RUN} mkdocs build
2020

21-
## examples: build example documentation in ./tmp
21+
## examples: build intermediate example documentation in ./tmp
2222
examples: ${EXAMPLES_FILE}
2323

2424
${EXAMPLES_FILE}:
2525
@mkdir -p ${TMP}
2626
${RUN} bin/example_pages.py --indir ${HANDWRITTEN}/plotly_js --outdir ${EXAMPLES_DIR} --jsversion 3.2.1
2727

28-
## reference: build reference documentation in ./tmp
28+
## reference: build intermediate reference documentation in ./tmp
2929
reference: ${REFERENCE_FILE}
3030

3131
${REFERENCE_FILE}:

bin/example_pages.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,12 @@ def _make_mydiv(args, accum, path, header, content, counter):
151151
unique_mydiv = f"myDiv_{counter}"
152152
content_mydiv = content.replace("myDiv", unique_mydiv)
153153
content_json = escape(json.dumps(content))
154-
154+
155155
# Get JS Version
156156
mkdocs_path = Path(__file__).resolve().parent.parent / "mkdocs.yml"
157157
config = load_config(config_file=str(mkdocs_path))
158-
extra = config.get('extra', {})
159-
version = extra.get('js-version')
158+
extra = config.get("extra", {})
159+
version = extra.get("js-version")
160160

161161
accum.append(
162162
MYDIV.format(

bin/generate_reference_pages.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,36 @@
44
from pathlib import Path
55
import mkdocs_gen_files
66

7+
78
def generate_pages(path, output_dir, parent, nav=None):
89
"""
9-
Walk through the a directory and generate Markdown files that
10+
Walk through a directory and generate Markdown files that
1011
include the corresponding HTML snippets.
1112
"""
1213
with os.scandir(path) as it:
13-
entries = sorted(it, key= lambda e: e.name)
14+
entries = sorted(it, key=lambda e: e.name)
1415
for folder in entries:
1516
dir_name = folder.name + ".md"
1617
file_path = os.path.join(output_dir, dir_name)
1718

18-
with open(file_path, 'w') as f:
19-
f.write(f'# {folder.name}\n')
20-
f.write(f'--8<-- \"{parent}/{folder.name}/index.html\"\n')
19+
with open(file_path, "w") as f:
20+
f.write(f"# {folder.name}\n")
21+
f.write(f'--8<-- "{parent}/{folder.name}/index.html"\n')
2122

2223
# Add markdown file to navigation
2324
if nav is not None:
2425
nav[(folder.name)] = dir_name
2526

2627
it.close()
2728

29+
2830
nav = mkdocs_gen_files.Nav()
2931

3032
parent = Path(__file__).resolve().parent.parent
31-
ref_path = f"{parent}/tmp/reference"
33+
ref_path = f"{parent}/tmp/reference"
3234
ref_output_dir = f"{parent}/pages/reference/"
3335

34-
examples_path = f"{parent}/tmp/javascript"
36+
examples_path = f"{parent}/tmp/javascript"
3537
examples_output_dir = f"{parent}/pages/examples/"
3638

3739
os.makedirs(ref_output_dir, exist_ok=True)
@@ -40,5 +42,5 @@ def generate_pages(path, output_dir, parent, nav=None):
4042
generate_pages(ref_path, ref_output_dir, "reference", nav)
4143
generate_pages(examples_path, examples_output_dir, "javascript")
4244

43-
with mkdocs_gen_files.open("reference/SUMMARY.md", "w") as nav_file:
44-
nav_file.writelines(nav.build_literate_nav())
45+
with mkdocs_gen_files.open("reference/SUMMARY.md", "w") as nav_file:
46+
nav_file.writelines(nav.build_literate_nav())

0 commit comments

Comments
 (0)