From fad782fe445d1d1547fbc620738d5140bdd73ab8 Mon Sep 17 00:00:00 2001 From: David Sillman Date: Sat, 25 Nov 2023 11:41:25 -0800 Subject: [PATCH] trying converting the tables --- .../content_schematics/jinja_helpers/md.yml | 2 +- .metadock/generated_documents/README.html | 20 +- .metadock/generated_documents/README.md | 216 ++++++++++++++---- .../repo_readme_template.md | 4 +- README.md | 216 ++++++++++++++---- metadock/env.py | 6 +- 6 files changed, 369 insertions(+), 95 deletions(-) diff --git a/.metadock/content_schematics/jinja_helpers/md.yml b/.metadock/content_schematics/jinja_helpers/md.yml index b3f3f12..2268a03 100644 --- a/.metadock/content_schematics/jinja_helpers/md.yml +++ b/.metadock/content_schematics/jinja_helpers/md.yml @@ -128,7 +128,7 @@ md: filters: convert: docstring: | - Filter which converts Markdown content to HTML, by invoking `marko.convert`. + Filter which converts Markdown content to HTML, by invoking `marko.convert` (using github-flavored md). example: | >>> from metadock.env import MetadockEnv >>> env = MetadockEnv().jinja_environment() diff --git a/.metadock/generated_documents/README.html b/.metadock/generated_documents/README.html index 4df08f7..2a87279 100644 --- a/.metadock/generated_documents/README.html +++ b/.metadock/generated_documents/README.html @@ -282,7 +282,8 @@

Global namespace

metadock.env.MetadockEnv.debug: (self, message: str) -> None Prints a debug message to stdout, and returns an empty string.

>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("No changes!{{ debug('This is a debug message.') }}").render()
This is a debug message.
'No changes!'

- + +
Jinja filter reference @@ -321,7 +322,8 @@

Global namespace

metadock.env.MetadockEnv.zip_filter: (self, input_iterable: Iterable[Any], *iterables: Iterable[Any]) -> Iterable[tuple[Any, ...]] Filter which zips an input iterable with one or more iterables.

>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ ['a', 'b', 'c'] | zip([1, 2, 3]) | list }}").render()
"[('a', 1), ('b', 2), ('c', 3)]"

-
+ +

md namespace

Jinja Namespace for Markdown-related functions and filters.

Macros:

@@ -379,7 +381,8 @@

md namespace

metadock.env.MetadockMdNamespace.tablerow: (self, *row_cells: str) -> str Produces a Markdown table row from the given cells by joining each cell with pipes ("|") and wrapping the result in pipes. Cell contents have their pipes escaped with a backslash ("\").

>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string(
... "{{ md.tablehead('Column 1', 'Column 2', 'Column 3') }}\n"
... "{{ md.tablerow('Value 1', 'Value 2', 'Value 3') }}"
... ).render()
'| Column 1 | Column 2 | Column 3 |\n| --- | --- | --- |\n| Value 1 | Value 2 | Value 3 |'

- + +
Jinja filter reference @@ -396,14 +399,15 @@

md namespace

md.convert metadock.env.MetadockMdNamespace.convert_filter: (self, md_content: str) -> str -Filter which converts Markdown content to HTML, by invoking marko.convert.

>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ '# This is a heading\n\n> And a block quote.' | md.convert }}").render()
'<h1>This is a heading</h1>\n<blockquote>\n<p>And a block quote.</p>\n</blockquote>\n'

+Filter which converts Markdown content to HTML, by invoking marko.convert (using github-flavored md).

>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ '# This is a heading\n\n> And a block quote.' | md.convert }}").render()
'<h1>This is a heading</h1>\n<blockquote>\n<p>And a block quote.</p>\n</blockquote>\n'

md.list metadock.env.MetadockMdNamespace.list_filter: (self, values: str | Iterable[str]) -> str Filter which unpacks an iterable of values into a Markdown list, or formats a single value as a Markdown list element.

>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string(
... "{{ ['This is a list.', 'This is a second element'] | md.list }}\n"
... ).render()
'- This is a list.\n- This is a second element\n'

-
+ +

html namespace

Jinja namespace which owns HTML-related functions and filters.

Macros:

@@ -467,7 +471,8 @@

html namespace

metadock.env.MetadockHtmlNamespace.underline: (self, content: str) -> str Wraps a string in HTML underline tags (<u></u>).

>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ html.underline('This is underlined text.') }}").render()
'<u>This is underlined text.</u>'

- + +
Jinja filter reference @@ -491,7 +496,8 @@

html namespace

metadock.env.MetadockHtmlNamespace.inline_filter: (self, content: str) -> str Filter which inlines a string by replacing all newlines with HTML line-breaks <br> singleton tags.

>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ 'This is a multi-line string.\nThis is the second line.\nAnd the third.' | html.inline }}").render()
'This is a multi-line string.<br>This is the second line.<br>And the third.'

-
+ +

Acknowledgements

Author: