1) Change to an r-string to make it easier to edit and test in external programs. Doubled backslashes are a bother when doing copy/paste.

2) Updates and corrections to the information text.
This commit is contained in:
Charles Haley 2024-11-14 16:45:07 +00:00
parent c100405f1e
commit a5c99c7496

View File

@ -32,15 +32,20 @@ class GeneralInformationDialog(Dialog):
e.setHtml(FFMLProcessor().document_to_html(information, 'Template Information')) e.setHtml(FFMLProcessor().document_to_html(information, 'Template Information'))
information = ''' information = r'''
[LIST] [LIST]
[*]`Functions in Single Function Mode templates` [*]`Functions in Single Function Mode templates`
[LIST]
When using functions in a Single function mode template, [*]When using functions in a Single function mode template,
for example ``{title:uppercase()}``, the first parameter ``value`` is omitted. for example ``{title:uppercase()}``, the first parameter ``value`` is omitted.
It is automatically replaced by the value of the specified field. It is automatically replaced by the value of the specified field.
In all the other modes the value parameter must be supplied. In all the other modes the value parameter must be supplied.
[*]Do not use subtemplates "(`{...}`)" as function arguments because they will often not work.
Instead, use Template Program Mode and General Program Mode.
[*]Do not use subtemplates "(`{...}`)" or functions (see below) in the prefix or the suffix
for the same reason as above; they will often not work.
[/LIST]
[*]`Editor for asssting with template function documentation` [*]`Editor for asssting with template function documentation`
An editor is available for helping write template function documentation. Given a document An editor is available for helping write template function documentation. Given a document
@ -62,28 +67,29 @@ document formatter functions. It is based on a combination of RST used by sphinx
and BBCODE used by many bulletin board systems such as MobileRead. It provides a and BBCODE used by many bulletin board systems such as MobileRead. It provides a
way to specify: way to specify:
[LIST] [LIST]
[*]Inline program code text: surround this text with \\`\\` as in \\`\\`foo\\`\\`. Tags inside the text are ignored. [*]Inline program code text: surround this text with \`\` as in \`\`foo\`\`. Tags inside the text are ignored.
[*]Italic text: surround this text with \\`. Example \\`foo\\` produces `foo`. [*]Italic text: surround this text with \`. Example: \`foo\` produces `foo`.
[*]Bold text: surround this text with \[B]text\[\B] tags. Example: \[B]foo\[/B] produces [B]foo[/B].
[*]Text intended to reference a calibre GUI action. This uses RST syntax.\ [*]Text intended to reference a calibre GUI action. This uses RST syntax.\
Example: \\:guilabel\\:\\`Preferences->Advanced->Template functions\\`. For HTML the produced text is in a different font, as in: :guilabel:`Some text` Example: \:guilabel\:\`Preferences->Advanced->Template functions\`. For HTML the produced text is in a different font, as in: :guilabel:`Some text`
[*]Empty lines, indicated by two newlines in a row. A visible empty line in the FFMC will become an empty line in the output. [*]Empty lines, indicated by two newlines in a row. A visible empty line in the FFML
will become an empty line in the output.
[*]URLs. The syntax is similar to BBCODE: ``[URL href="http..."]Link text[/URL]``.\ [*]URLs. 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] Example: ``[URL href="https://en.wikipedia.org/wiki/ISO_8601"]ISO[/URL]`` produces [URL href="https://en.wikipedia.org/wiki/ISO_8601"]ISO[/URL]
[*]Internal function reference links. These are links to formatter function [*]Internal function reference links. These are links to formatter function
documentation. The syntax is the same as guilabel. Example: ``:ref:`get_note` ``. documentation. The syntax is the same as guilabel. Example: ``:ref:\`get_note\```.
The characters '()' are automatically added to the function name when The characters '()' are automatically added to the function name when
displayed. For HTML it generates the same as the inline program code text displayed. For HTML it generates the same as the inline program code text
operator (\\`\\`) with no link. Example: ``:ref:`add` `` produces ``add()``. operator (\`\`) with no link. Example: ``:ref:`add` `` produces ``add()``.
For RST it generates a ``:ref:`` reference that works only in an RST document For RST it generates a ``:ref:`` reference that works only in an RST document
containing formatter function documentation. Example: ``:ref:`get_note` `` containing formatter function documentation. Example: ``:ref:\`get_note\```
generates \\:ref\\:\\`get_note() <ff_get_note>\\` generates \:ref\:\`get_note() <ff_get_note>\`
[*]Example program code text blocks. Surround the code block with ``[CODE]`` [*]Example program code text blocks. Surround the code block with ``[CODE]``
and ``[/CODE]`` tags. These tags must be first on a line. Example: and ``[/CODE]`` tags. These tags must be first on a line. Example:
[CODE] [CODE]
\\[CODE]program: \[CODE]program:
get_note('authors', 'Isaac Asimov', 1) get_note('authors', 'Isaac Asimov', 1)
\\[/CODE] \[/CODE]
[/CODE] [/CODE]
produces produces
[CODE] [CODE]
@ -97,18 +103,18 @@ elements.
Example: a two bullet list containing CODE blocks Example: a two bullet list containing CODE blocks
[CODE] [CODE]
\\[LIST] \[LIST]
[*]Return the HTML of the note attached to the tag `Fiction`: [*]Return the HTML of the note attached to the tag `Fiction`:
\\[CODE] \[CODE]
program: program:
get_note('tags', 'Fiction', '') get_note('tags', 'Fiction', '')
\\[/CODE] \[/CODE]
[*]Return the plain text of the note attached to the author `Isaac Asimov`: [*]Return the plain text of the note attached to the author `Isaac Asimov`:
\\[CODE] \[CODE]
program: program:
get_note('authors', 'Isaac Asimov', 1) get_note('authors', 'Isaac Asimov', 1)
\\[/CODE] \[/CODE]
\\[/LIST] \[/LIST]
[/CODE] [/CODE]
[*]HTML output contains no CSS and does not start with a tag such as <DIV> or <P>. [*]HTML output contains no CSS and does not start with a tag such as <DIV> or <P>.