From 6cf393121c4f349c1f83f6bd1139f1f27680f340 Mon Sep 17 00:00:00 2001 From: Kyler Olsen Date: Mon, 27 Oct 2025 13:23:54 -0600 Subject: [PATCH] Finished meta data with next and prev pages --- convert.py | 18 +++++++++--------- docs/basic_operations.md | 2 +- docs/functions.md | 2 +- docs/index.md | 6 ------ docs/memory_management.md | 2 +- docs/overview.md | 4 ++-- docs/primitive_types.md | 2 +- prependnewline.py | 7 +++++-- 8 files changed, 20 insertions(+), 23 deletions(-) diff --git a/convert.py b/convert.py index 8f28de4..08b4814 100644 --- a/convert.py +++ b/convert.py @@ -11,7 +11,7 @@ def my_url_builder(label, base, end): def convert_markdown_to_html(md_path: Path, html_path: Path): html_path.parent.mkdir(parents=True, exist_ok=True) - md = markdown.markdown(extensions=[ + md = markdown.Markdown(extensions=[ WikiLinkExtension(base_url='./', end_url='.html', build_url=my_url_builder), 'tables', 'fenced_code', @@ -20,14 +20,14 @@ 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"] - next_page = md.Meta["Next"] - prev_page = md.Meta["Prev"] + title = md.Meta["title"][0] # type: ignore + prev_page = md.Meta["prev"][0] # type: ignore + next_page = md.Meta["next"][0] # type: ignore html_page = f""" - {md_path.stem} + {title} @@ -37,10 +37,10 @@ def convert_markdown_to_html(md_path: Path, html_path: Path): diff --git a/docs/basic_operations.md b/docs/basic_operations.md index 0c5bd5a..8772294 100644 --- a/docs/basic_operations.md +++ b/docs/basic_operations.md @@ -1,5 +1,5 @@ --- -Title: YREA SLS | 4 Basic Operation +Title: YREA SLS | 4 Basic Operations Prev: Primitive Types Next: Functions --- diff --git a/docs/functions.md b/docs/functions.md index 8481304..d34c7e7 100644 --- a/docs/functions.md +++ b/docs/functions.md @@ -1,6 +1,6 @@ --- Title: YREA SLS | 5 Functions -Prev: Basic Operation +Prev: Basic Operations Next: Control Flow --- diff --git a/docs/index.md b/docs/index.md index 037e591..811fe72 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,9 +1,3 @@ ---- -Title: YREA SLS | -Prev: -Next: ---- - --- Title: YREA SLS | Specs Home Prev: diff --git a/docs/memory_management.md b/docs/memory_management.md index bbe7a70..e036756 100644 --- a/docs/memory_management.md +++ b/docs/memory_management.md @@ -1,7 +1,7 @@ --- Title: YREA SLS | F Memory Management Prev: Module System -Next: Examples & Tutorials +Next: Examples and Tutorials --- ## Appendix F: Memory Management (Future) diff --git a/docs/overview.md b/docs/overview.md index 369d8c2..9b3f86a 100644 --- a/docs/overview.md +++ b/docs/overview.md @@ -1,7 +1,7 @@ --- Title: YREA SLS | 1 Overview -Prev: Lexical Structure -Next: Index +Prev: Index +Next: Lexical Structure --- ## 1. Overview diff --git a/docs/primitive_types.md b/docs/primitive_types.md index c846bef..e09729f 100644 --- a/docs/primitive_types.md +++ b/docs/primitive_types.md @@ -1,7 +1,7 @@ --- Title: YREA SLS | 3 Primitive Types Prev: Lexical Structure -Next: Basic Operation +Next: Basic Operations --- ## 3. Primitive Types diff --git a/prependnewline.py b/prependnewline.py index b7a3b97..bb52719 100644 --- a/prependnewline.py +++ b/prependnewline.py @@ -31,10 +31,13 @@ class PrependNewLinePreprocessor(Preprocessor): Each reference is prepended with a new line. ''' new_text = [] + is_list = False for line in lines: if len(line) > 0: - if (line[0].isdigit() or line[0] == '*') and line[len(line) - 1] != '*': - line = '\n' + line + if (line[0].isdigit() or line[0] == '-') and line[len(line) - 1] != '-': + if not is_list: line = '\n' + line + is_list = True + else: is_list = False new_text.append(line) return new_text