From 73b8bd7ae03d40c600be541e91561683c4c6c8a4 Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Tue, 22 Jul 2025 15:34:12 +0100 Subject: [PATCH] 1) Eliminate the space at the end of some lines such as list items. 2) Remove a spurious backslash from the FFML documentation. NB: removing the space means that the generated rst and html are slightly different from what they were before the change. The changes are white space and don't appear to change what one sees in the interpreted html and rst. The html and rst output remains identical with original input or rst-formatted input. --- src/calibre/gui2/dialogs/template_general_info.py | 5 +++-- src/calibre/utils/ffml_processor.py | 11 +++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/calibre/gui2/dialogs/template_general_info.py b/src/calibre/gui2/dialogs/template_general_info.py index 5bedd84165..bff2c9c456 100644 --- a/src/calibre/gui2/dialogs/template_general_info.py +++ b/src/calibre/gui2/dialogs/template_general_info.py @@ -66,8 +66,9 @@ a space before the closing \`\` characters. Trailing blanks in the code text are Example: \:guilabel\:\`Preferences->Advanced->Template functions\`. For HTML the produced text is in a different font, as in: :guilabel:`Some text` [*][B]Empty lines[/B], indicated by two newlines in a row. A visible empty line in the FFML will become an empty line in the output. -[*][B]URLs.[/B] The syntax is similar to BBCODE: ``[URL href="http..."]Link text[/URL]``.\ - Example: ``[URL href="https://en.wikipedia.org/wiki/ISO_8601"]ISO[/URL]`` produces [URL href="https://en.wikipedia.org/wiki/ISO_8601"]ISO[/URL] +[*][B]URLs.[/B] The syntax is similar to BBCODE: ``[URL href="http..."]Link text[/URL]``. +Example: ``[URL href="https://en.wikipedia.org/wiki/ISO_8601"]ISO[/URL]`` +produces [URL href="https://en.wikipedia.org/wiki/ISO_8601"]ISO[/URL] [*][B]Internal function reference links[/B]. These are links to formatter function documentation. The syntax is the same as guilabel. Example: ``:ref:`get_note` ``. The characters '()' are automatically added to the function name when diff --git a/src/calibre/utils/ffml_processor.py b/src/calibre/utils/ffml_processor.py index d231e39aa4..21d4a06bb5 100644 --- a/src/calibre/utils/ffml_processor.py +++ b/src/calibre/utils/ffml_processor.py @@ -304,7 +304,7 @@ class FFMLProcessor: elif tree.node_kind() == NodeKinds.ITALIC_TEXT: result += f'{tree.escaped_text()}' elif tree.node_kind() == NodeKinds.LIST: - result += '\n