diff --git a/convert.py b/convert.py index 72672a1..47963d6 100644 --- a/convert.py +++ b/convert.py @@ -22,9 +22,9 @@ def convert_markdown_to_html(md_path: Path, html_path: Path): 'meta', ]) html = md.convert(md_path.read_text(encoding="utf-8")) - title = md.Meta["title"][0] # type: ignore - prev_page = md.Meta["prev"][0] # type: ignore - next_page = md.Meta["next"][0] # type: ignore + title = md.Meta.get("title", (md_path.name,))[0] # type: ignore + prev_page = md.Meta.get("prev", ("",))[0] # type: ignore + next_page = md.Meta.get("next", ("",))[0] # type: ignore prev_link = f'Prev' next_link = f'Next' @@ -102,6 +102,10 @@ def convert_all(source_dir: Path, output_dir: Path): rel_path = md_file.relative_to(source_dir) html_path = output_dir / rel_path.with_suffix(".html") convert_markdown_to_html(md_file, html_path) + for md_file in (source_dir / '..' / "stack_lang_spec.md",): + rel_path = md_file.relative_to(source_dir / '..') + html_path = output_dir / rel_path.with_suffix(".html") + convert_markdown_to_html(md_file, html_path) def convert_all_watch_files(source_dir: Path, output_dir: Path): import time @@ -136,5 +140,7 @@ def convert_all_watch_files(source_dir: Path, output_dir: Path): observer.join() if __name__ == "__main__": + from sys import argv convert_all(SOURCE_DIR, OUTPUT_DIR) - # convert_all_watch_files(SOURCE_DIR, OUTPUT_DIR) + if 'watch' in argv: + convert_all_watch_files(SOURCE_DIR, OUTPUT_DIR) diff --git a/docs/index.md b/docs/index.md index b618fbd..d053b00 100644 --- a/docs/index.md +++ b/docs/index.md @@ -30,9 +30,12 @@ Next: Overview - G. [Examples and Tutorials](./examples_and_tutorials.html) - H. [Complete Type Reference](./complete_type_reference.html) -**Addendum**: +--- + +**Other**: - [Missing Features](./missing_features.html) - [SE 3250 Assignment Details](./se_3250_assignment_details.html) - [Changed](./changes.html) +- [Full Specification](./stack_lang_spec.html) --- diff --git a/docs/styles.css b/docs/styles.css index 5c3f66c..5ee30a8 100644 --- a/docs/styles.css +++ b/docs/styles.css @@ -232,3 +232,54 @@ body[mode="dark"] div.logo > a { margin-bottom: 4px; } } + +@media print { + header, footer, a.headerlink { + display: none !important; + } + + main { + padding: 0 !important; + } + + body a { + color: black !important; + } + + pre { + /* overflow-x: visible; */ + word-wrap: normal; + } + + /* pre, blockquote { + break-inside: avoid-page; + } + + h1, h2, h3, h4 { + break-after: avoid-page; + } */ + + body[mode="dark"] { + background-color: white; + color: black; + } + + body[mode="dark"] a { + color: black; + } + + body[mode="dark"] code { + background-color: #eeeeee; + } + + body[mode="dark"] pre { + border-color: black; + background-color: white; + } + + body[mode="dark"] blockquote { + border-color: black; + border-left-color: #888888; + background-color: white; + } +}