From a901c6fded28c1e4bb651c444d7edeaeecfb5452 Mon Sep 17 00:00:00 2001 From: David Sillman Date: Sat, 25 Nov 2023 10:11:39 -0800 Subject: [PATCH] trying double linebreaking code blocks --- .metadock/generated_documents/README.html | 24 +++++++++---------- .metadock/generated_documents/README.md | 24 +++++++++---------- .../repo_readme_template.md | 4 ++-- README.md | 24 +++++++++---------- metadock/env.py | 2 +- 5 files changed, 39 insertions(+), 39 deletions(-) diff --git a/.metadock/generated_documents/README.html b/.metadock/generated_documents/README.html index 9213a91..a5e4754 100644 --- a/.metadock/generated_documents/README.html +++ b/.metadock/generated_documents/README.html @@ -268,7 +268,7 @@

Global namespace

debug 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!'

+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!'



@@ -287,27 +287,27 @@

Global namespace

chain metadock.env.MetadockEnv.chain_filter: (self, iterables: Sequence[Iterable[Any]]) -> Iterable[Any] -Filter which flattens a sequence of iterables into a single iterable.
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string('{{ {"first": 1, "second": 2}.items() | chain | join(" ") }}').render()
'first 1 second 2'

+Filter which flattens a sequence of iterables into a single iterable.

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string('{{ {"first": 1, "second": 2}.items() | chain | join(" ") }}').render()

'first 1 second 2'



inline metadock.env.MetadockEnv.inline_filter: (self, value: str) -> str -Filter which inlines a string by replacing all newlines with spaces, and all double spaces with single spaces.
>>> 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.' | inline }}").render()
'This is a multi-line string. This is the second line. And the third.'

+Filter which inlines a string by replacing all newlines with spaces, and all double spaces with single spaces.

>>> 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.' | inline }}").render()

'This is a multi-line string. This is the second line. And the third.'



with_prefix metadock.env.MetadockEnv.with_prefix_filter: (self, value: str, prefix: str, sep: str = '') -> str -Filter which prepends a prefix to a string, with an optional separator.
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ 'This is a string.' | with_prefix('Prefix') }}").render()
'PrefixThis is a string.'
>>> env.from_string("{{ 'This is a string.' | with_prefix('Prefix: ', sep = ' : ') }}").render()
'Prefix : This is a string.'

+Filter which prepends a prefix to a string, with an optional separator.

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string("{{ 'This is a string.' | with_prefix('Prefix') }}").render()

'PrefixThis is a string.'

>>> env.from_string("{{ 'This is a string.' | with_prefix('Prefix: ', sep = ' : ') }}").render()

'Prefix : This is a string.'



with_suffix metadock.env.MetadockEnv.with_suffix_filter: (self, value: str, suffix: str, sep: str = '') -> str -Filter which appends a suffix to a string, with an optional separator.
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ 'This is a string' | with_suffix('Suffix') }}").render()
'This is a stringSuffix'
>>> env.from_string("{{ 'This is a string' | with_suffix('Suffix', sep = ' : ') }}").render()
'This is a string : Suffix'

+Filter which appends a suffix to a string, with an optional separator.

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string("{{ 'This is a string' | with_suffix('Suffix') }}").render()

'This is a stringSuffix'

>>> env.from_string("{{ 'This is a string' | with_suffix('Suffix', sep = ' : ') }}").render()

'This is a string : Suffix'



zip 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)]"

+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

@@ -354,32 +354,32 @@

html namespace

html.bold metadock.env.MetadockHtmlNamespace.bold: (self, content: str) -> str -Wraps a string in HTML bold tags (<b></b>).
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ html.bold('This is bold text.') }}").render()
'<b>This is bold text.</b>'

+Wraps a string in HTML bold tags (<b></b>).

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string("{{ html.bold('This is bold text.') }}").render()

'<b>This is bold text.</b>'



html.code metadock.env.MetadockHtmlNamespace.code: (self, content: str) -> str -Wraps a string in HTML code tags (<code></code>).
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ html.code('This is code text.') }}").render()
'<code>This is code text.</code>'

+Wraps a string in HTML code tags (<code></code>).

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string("{{ html.code('This is code text.') }}").render()

'<code>This is code text.</code>'



html.codeblock metadock.env.MetadockHtmlNamespace.codeblock: (self, content: str, indent: int = 0) -> str -Wraps a string in preformatted HTML code tags (<pre><code></code></pre>), and indents the content by the given amount.
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ html.codeblock('This is code text.', indent = 4) }}").render()
'<pre><code> This is code text.</code></pre>'

+Wraps a string in preformatted HTML code tags (<pre><code></code></pre>), and indents the content by the given amount.

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string("{{ html.codeblock('This is code text.', indent = 4) }}").render()

'<pre><code> This is code text.</code></pre>'



html.details metadock.env.MetadockHtmlNamespace.details: (self, *contents: str) -> str -Wraps a string in line-broken HTML details tags (<details></details>). Multiple arguments get separated by two line breaks.
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ html.details('This is details text.') }}").render()
'<details>\nThis is details text.\n</details>'

+Wraps a string in line-broken HTML details tags (<details></details>). Multiple arguments get separated by two line breaks.

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string("{{ html.details('This is details text.') }}").render()

'<details>\nThis is details text.\n</details>'



html.italic metadock.env.MetadockHtmlNamespace.italic: (self, content: str) -> str -Wraps a string in HTML italic tags (<i></i>).
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ html.italic('This is italic text.') }}").render()
'<i>This is italic text.</i>'

+Wraps a string in HTML italic tags (<i></i>).

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string("{{ html.italic('This is italic text.') }}").render()

'<i>This is italic text.</i>'



html.summary metadock.env.MetadockHtmlNamespace.summary: (self, content: str) -> str -Wraps a string in line-broken HTML summary tags (<summary>\n\n</summary>).
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ html.summary('This is summary text.') }}").render()
'<summary>\nThis is summary text.\n</summary>'

+Wraps a string in line-broken HTML summary tags (<summary>\n\n</summary>).

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string("{{ html.summary('This is summary text.') }}").render()

'<summary>\nThis is summary text.\n</summary>'



diff --git a/.metadock/generated_documents/README.md b/.metadock/generated_documents/README.md index 339741c..7744be5 100644 --- a/.metadock/generated_documents/README.md +++ b/.metadock/generated_documents/README.md @@ -290,7 +290,7 @@ Jinja macro reference | Macro | Signature | Doc | | --- | --- | --- | -| debug | 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!'

| +| debug | 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!'



|
@@ -301,11 +301,11 @@ Jinja filter reference | Filter | Signature | Doc | | --- | --- | --- | -| chain | metadock.env.MetadockEnv.chain_filter: (self, iterables: Sequence[Iterable[Any]]) -> Iterable[Any] | Filter which flattens a sequence of iterables into a single iterable.
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string('{{ {"first": 1, "second": 2}.items() \| chain \| join(" ") }}').render()
'first 1 second 2'

| -| inline | metadock.env.MetadockEnv.inline_filter: (self, value: str) -> str | Filter which inlines a string by replacing all newlines with spaces, and all double spaces with single spaces.
>>> 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.' \| inline }}").render()
'This is a multi-line string. This is the second line. And the third.'

| -| with_prefix | metadock.env.MetadockEnv.with_prefix_filter: (self, value: str, prefix: str, sep: str = '') -> str | Filter which prepends a prefix to a string, with an optional separator.
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ 'This is a string.' \| with_prefix('Prefix') }}").render()
'PrefixThis is a string.'
>>> env.from_string("{{ 'This is a string.' \| with_prefix('Prefix: ', sep = ' : ') }}").render()
'Prefix : This is a string.'

| -| with_suffix | metadock.env.MetadockEnv.with_suffix_filter: (self, value: str, suffix: str, sep: str = '') -> str | Filter which appends a suffix to a string, with an optional separator.
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ 'This is a string' \| with_suffix('Suffix') }}").render()
'This is a stringSuffix'
>>> env.from_string("{{ 'This is a string' \| with_suffix('Suffix', sep = ' : ') }}").render()
'This is a string : Suffix'

| -| zip | 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)]"

| +| chain | metadock.env.MetadockEnv.chain_filter: (self, iterables: Sequence[Iterable[Any]]) -> Iterable[Any] | Filter which flattens a sequence of iterables into a single iterable.

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string('{{ {"first": 1, "second": 2}.items() \| chain \| join(" ") }}').render()

'first 1 second 2'



| +| inline | metadock.env.MetadockEnv.inline_filter: (self, value: str) -> str | Filter which inlines a string by replacing all newlines with spaces, and all double spaces with single spaces.

>>> 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.' \| inline }}").render()

'This is a multi-line string. This is the second line. And the third.'



| +| with_prefix | metadock.env.MetadockEnv.with_prefix_filter: (self, value: str, prefix: str, sep: str = '') -> str | Filter which prepends a prefix to a string, with an optional separator.

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string("{{ 'This is a string.' \| with_prefix('Prefix') }}").render()

'PrefixThis is a string.'

>>> env.from_string("{{ 'This is a string.' \| with_prefix('Prefix: ', sep = ' : ') }}").render()

'Prefix : This is a string.'



| +| with_suffix | metadock.env.MetadockEnv.with_suffix_filter: (self, value: str, suffix: str, sep: str = '') -> str | Filter which appends a suffix to a string, with an optional separator.

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string("{{ 'This is a string' \| with_suffix('Suffix') }}").render()

'This is a stringSuffix'

>>> env.from_string("{{ 'This is a string' \| with_suffix('Suffix', sep = ' : ') }}").render()

'This is a string : Suffix'



| +| zip | 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)]"



| @@ -346,12 +346,12 @@ Jinja macro reference | Macro | Signature | Doc | | --- | --- | --- | -| html.bold | metadock.env.MetadockHtmlNamespace.bold: (self, content: str) -> str | Wraps a string in HTML bold tags (<b></b>).
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ html.bold('This is bold text.') }}").render()
'<b>This is bold text.</b>'

| -| html.code | metadock.env.MetadockHtmlNamespace.code: (self, content: str) -> str | Wraps a string in HTML code tags (<code></code>).
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ html.code('This is code text.') }}").render()
'<code>This is code text.</code>'

| -| html.codeblock | metadock.env.MetadockHtmlNamespace.codeblock: (self, content: str, indent: int = 0) -> str | Wraps a string in preformatted HTML code tags (<pre><code></code></pre>), and indents the content by the given amount.
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ html.codeblock('This is code text.', indent = 4) }}").render()
'<pre><code> This is code text.</code></pre>'

| -| html.details | metadock.env.MetadockHtmlNamespace.details: (self, *contents: str) -> str | Wraps a string in line-broken HTML details tags (<details></details>). Multiple arguments get separated by two line breaks.
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ html.details('This is details text.') }}").render()
'<details>\nThis is details text.\n</details>'

| -| html.italic | metadock.env.MetadockHtmlNamespace.italic: (self, content: str) -> str | Wraps a string in HTML italic tags (<i></i>).
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ html.italic('This is italic text.') }}").render()
'<i>This is italic text.</i>'

| -| html.summary | metadock.env.MetadockHtmlNamespace.summary: (self, content: str) -> str | Wraps a string in line-broken HTML summary tags (<summary>\n\n</summary>).
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ html.summary('This is summary text.') }}").render()
'<summary>\nThis is summary text.\n</summary>'

| +| html.bold | metadock.env.MetadockHtmlNamespace.bold: (self, content: str) -> str | Wraps a string in HTML bold tags (<b></b>).

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string("{{ html.bold('This is bold text.') }}").render()

'<b>This is bold text.</b>'



| +| html.code | metadock.env.MetadockHtmlNamespace.code: (self, content: str) -> str | Wraps a string in HTML code tags (<code></code>).

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string("{{ html.code('This is code text.') }}").render()

'<code>This is code text.</code>'



| +| html.codeblock | metadock.env.MetadockHtmlNamespace.codeblock: (self, content: str, indent: int = 0) -> str | Wraps a string in preformatted HTML code tags (<pre><code></code></pre>), and indents the content by the given amount.

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string("{{ html.codeblock('This is code text.', indent = 4) }}").render()

'<pre><code> This is code text.</code></pre>'



| +| html.details | metadock.env.MetadockHtmlNamespace.details: (self, *contents: str) -> str | Wraps a string in line-broken HTML details tags (<details></details>). Multiple arguments get separated by two line breaks.

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string("{{ html.details('This is details text.') }}").render()

'<details>\nThis is details text.\n</details>'



| +| html.italic | metadock.env.MetadockHtmlNamespace.italic: (self, content: str) -> str | Wraps a string in HTML italic tags (<i></i>).

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string("{{ html.italic('This is italic text.') }}").render()

'<i>This is italic text.</i>'



| +| html.summary | metadock.env.MetadockHtmlNamespace.summary: (self, content: str) -> str | Wraps a string in line-broken HTML summary tags (<summary>\n\n</summary>).

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string("{{ html.summary('This is summary text.') }}").render()

'<summary>\nThis is summary text.\n</summary>'



| diff --git a/.metadock/templated_documents/repo_readme_template.md b/.metadock/templated_documents/repo_readme_template.md index 95f21b1..d56ac29 100644 --- a/.metadock/templated_documents/repo_readme_template.md +++ b/.metadock/templated_documents/repo_readme_template.md @@ -109,7 +109,7 @@ and filters which can be used to make formatting content easier. The macros and md.tablerow( html.code(ns_code_prefix ~ macro), html.code(macro_spec.get("method_name") ~ ": " ~ macro_spec.get("signature")), - (macro_spec.get("docstring") | inline | html.escape) ~ "
" ~ (md.codeblock(macro_spec.get("example"), language="py") + (macro_spec.get("docstring") | inline | html.escape) ~ "

" ~ (md.codeblock(macro_spec.get("example"), language="py") | md.convert | html.inline), ) }} @@ -122,7 +122,7 @@ and filters which can be used to make formatting content easier. The macros and md.tablerow( html.code(ns_code_prefix ~ filter), html.code(filter_spec.get("method_name") ~ ": " ~ filter_spec.get("signature")), - (filter_spec.get("docstring") | inline | html.escape) ~ "
" ~ (md.codeblock(filter_spec.get("example"), language="py") + (filter_spec.get("docstring") | inline | html.escape) ~ "

" ~ (md.codeblock(filter_spec.get("example"), language="py") | md.convert | html.inline), ) }} diff --git a/README.md b/README.md index 339741c..7744be5 100644 --- a/README.md +++ b/README.md @@ -290,7 +290,7 @@ Jinja macro reference | Macro | Signature | Doc | | --- | --- | --- | -| debug | 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!'

| +| debug | 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!'



| @@ -301,11 +301,11 @@ Jinja filter reference | Filter | Signature | Doc | | --- | --- | --- | -| chain | metadock.env.MetadockEnv.chain_filter: (self, iterables: Sequence[Iterable[Any]]) -> Iterable[Any] | Filter which flattens a sequence of iterables into a single iterable.
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string('{{ {"first": 1, "second": 2}.items() \| chain \| join(" ") }}').render()
'first 1 second 2'

| -| inline | metadock.env.MetadockEnv.inline_filter: (self, value: str) -> str | Filter which inlines a string by replacing all newlines with spaces, and all double spaces with single spaces.
>>> 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.' \| inline }}").render()
'This is a multi-line string. This is the second line. And the third.'

| -| with_prefix | metadock.env.MetadockEnv.with_prefix_filter: (self, value: str, prefix: str, sep: str = '') -> str | Filter which prepends a prefix to a string, with an optional separator.
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ 'This is a string.' \| with_prefix('Prefix') }}").render()
'PrefixThis is a string.'
>>> env.from_string("{{ 'This is a string.' \| with_prefix('Prefix: ', sep = ' : ') }}").render()
'Prefix : This is a string.'

| -| with_suffix | metadock.env.MetadockEnv.with_suffix_filter: (self, value: str, suffix: str, sep: str = '') -> str | Filter which appends a suffix to a string, with an optional separator.
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ 'This is a string' \| with_suffix('Suffix') }}").render()
'This is a stringSuffix'
>>> env.from_string("{{ 'This is a string' \| with_suffix('Suffix', sep = ' : ') }}").render()
'This is a string : Suffix'

| -| zip | 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)]"

| +| chain | metadock.env.MetadockEnv.chain_filter: (self, iterables: Sequence[Iterable[Any]]) -> Iterable[Any] | Filter which flattens a sequence of iterables into a single iterable.

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string('{{ {"first": 1, "second": 2}.items() \| chain \| join(" ") }}').render()

'first 1 second 2'



| +| inline | metadock.env.MetadockEnv.inline_filter: (self, value: str) -> str | Filter which inlines a string by replacing all newlines with spaces, and all double spaces with single spaces.

>>> 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.' \| inline }}").render()

'This is a multi-line string. This is the second line. And the third.'



| +| with_prefix | metadock.env.MetadockEnv.with_prefix_filter: (self, value: str, prefix: str, sep: str = '') -> str | Filter which prepends a prefix to a string, with an optional separator.

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string("{{ 'This is a string.' \| with_prefix('Prefix') }}").render()

'PrefixThis is a string.'

>>> env.from_string("{{ 'This is a string.' \| with_prefix('Prefix: ', sep = ' : ') }}").render()

'Prefix : This is a string.'



| +| with_suffix | metadock.env.MetadockEnv.with_suffix_filter: (self, value: str, suffix: str, sep: str = '') -> str | Filter which appends a suffix to a string, with an optional separator.

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string("{{ 'This is a string' \| with_suffix('Suffix') }}").render()

'This is a stringSuffix'

>>> env.from_string("{{ 'This is a string' \| with_suffix('Suffix', sep = ' : ') }}").render()

'This is a string : Suffix'



| +| zip | 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)]"



| @@ -346,12 +346,12 @@ Jinja macro reference | Macro | Signature | Doc | | --- | --- | --- | -| html.bold | metadock.env.MetadockHtmlNamespace.bold: (self, content: str) -> str | Wraps a string in HTML bold tags (<b></b>).
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ html.bold('This is bold text.') }}").render()
'<b>This is bold text.</b>'

| -| html.code | metadock.env.MetadockHtmlNamespace.code: (self, content: str) -> str | Wraps a string in HTML code tags (<code></code>).
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ html.code('This is code text.') }}").render()
'<code>This is code text.</code>'

| -| html.codeblock | metadock.env.MetadockHtmlNamespace.codeblock: (self, content: str, indent: int = 0) -> str | Wraps a string in preformatted HTML code tags (<pre><code></code></pre>), and indents the content by the given amount.
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ html.codeblock('This is code text.', indent = 4) }}").render()
'<pre><code> This is code text.</code></pre>'

| -| html.details | metadock.env.MetadockHtmlNamespace.details: (self, *contents: str) -> str | Wraps a string in line-broken HTML details tags (<details></details>). Multiple arguments get separated by two line breaks.
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ html.details('This is details text.') }}").render()
'<details>\nThis is details text.\n</details>'

| -| html.italic | metadock.env.MetadockHtmlNamespace.italic: (self, content: str) -> str | Wraps a string in HTML italic tags (<i></i>).
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ html.italic('This is italic text.') }}").render()
'<i>This is italic text.</i>'

| -| html.summary | metadock.env.MetadockHtmlNamespace.summary: (self, content: str) -> str | Wraps a string in line-broken HTML summary tags (<summary>\n\n</summary>).
>>> from metadock.env import MetadockEnv
>>> env = MetadockEnv().jinja_environment()
>>> env.from_string("{{ html.summary('This is summary text.') }}").render()
'<summary>\nThis is summary text.\n</summary>'

| +| html.bold | metadock.env.MetadockHtmlNamespace.bold: (self, content: str) -> str | Wraps a string in HTML bold tags (<b></b>).

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string("{{ html.bold('This is bold text.') }}").render()

'<b>This is bold text.</b>'



| +| html.code | metadock.env.MetadockHtmlNamespace.code: (self, content: str) -> str | Wraps a string in HTML code tags (<code></code>).

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string("{{ html.code('This is code text.') }}").render()

'<code>This is code text.</code>'



| +| html.codeblock | metadock.env.MetadockHtmlNamespace.codeblock: (self, content: str, indent: int = 0) -> str | Wraps a string in preformatted HTML code tags (<pre><code></code></pre>), and indents the content by the given amount.

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string("{{ html.codeblock('This is code text.', indent = 4) }}").render()

'<pre><code> This is code text.</code></pre>'



| +| html.details | metadock.env.MetadockHtmlNamespace.details: (self, *contents: str) -> str | Wraps a string in line-broken HTML details tags (<details></details>). Multiple arguments get separated by two line breaks.

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string("{{ html.details('This is details text.') }}").render()

'<details>\nThis is details text.\n</details>'



| +| html.italic | metadock.env.MetadockHtmlNamespace.italic: (self, content: str) -> str | Wraps a string in HTML italic tags (<i></i>).

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string("{{ html.italic('This is italic text.') }}").render()

'<i>This is italic text.</i>'



| +| html.summary | metadock.env.MetadockHtmlNamespace.summary: (self, content: str) -> str | Wraps a string in line-broken HTML summary tags (<summary>\n\n</summary>).

>>> from metadock.env import MetadockEnv

>>> env = MetadockEnv().jinja_environment()

>>> env.from_string("{{ html.summary('This is summary text.') }}").render()

'<summary>\nThis is summary text.\n</summary>'



| diff --git a/metadock/env.py b/metadock/env.py index 7d118a9..64aee91 100644 --- a/metadock/env.py +++ b/metadock/env.py @@ -316,7 +316,7 @@ def inline_filter(self, content: str) -> str: Returns: str: The HTML-inlined string. """ - return content.replace("\n", "
") + return content.replace("\n", "

") class MetadockEnv(MetadockNamespace):