mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
commit
ecf422e450
@ -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`
|
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
|
[*][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.
|
will become an empty line in the output.
|
||||||
[*][B]URLs.[/B] The syntax is similar to BBCODE: ``[URL href="http..."]Link text[/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]
|
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
|
[*][B]Internal function reference links[/B]. 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
|
||||||
|
@ -304,7 +304,7 @@ class FFMLProcessor:
|
|||||||
elif tree.node_kind() == NodeKinds.ITALIC_TEXT:
|
elif tree.node_kind() == NodeKinds.ITALIC_TEXT:
|
||||||
result += f'<i>{tree.escaped_text()}</i>'
|
result += f'<i>{tree.escaped_text()}</i>'
|
||||||
elif tree.node_kind() == NodeKinds.LIST:
|
elif tree.node_kind() == NodeKinds.LIST:
|
||||||
result += '\n<ul>\n'
|
result += '<ul>\n'
|
||||||
for child in tree.children():
|
for child in tree.children():
|
||||||
result += '<li>\n'
|
result += '<li>\n'
|
||||||
result += self.tree_to_html(child, depth=depth+1)
|
result += self.tree_to_html(child, depth=depth+1)
|
||||||
@ -378,9 +378,7 @@ class FFMLProcessor:
|
|||||||
'''
|
'''
|
||||||
result = ''
|
result = ''
|
||||||
if tree.node_kind() == NodeKinds.TEXT:
|
if tree.node_kind() == NodeKinds.TEXT:
|
||||||
t = tree.text()
|
result += tree.text()
|
||||||
t = t.replace('\n', ' ')
|
|
||||||
result += t
|
|
||||||
if tree.node_kind() == NodeKinds.BOLD_TEXT:
|
if tree.node_kind() == NodeKinds.BOLD_TEXT:
|
||||||
result += f'[B]{tree.text()}[/B]'
|
result += f'[B]{tree.text()}[/B]'
|
||||||
elif tree.node_kind() == NodeKinds.BLANK_LINE:
|
elif tree.node_kind() == NodeKinds.BLANK_LINE:
|
||||||
@ -392,7 +390,7 @@ class FFMLProcessor:
|
|||||||
t = t + ' ' if t.endswith('`') else t
|
t = t + ' ' if t.endswith('`') else t
|
||||||
result += f'``{t}``'
|
result += f'``{t}``'
|
||||||
elif tree.node_kind() == NodeKinds.CODE_BLOCK:
|
elif tree.node_kind() == NodeKinds.CODE_BLOCK:
|
||||||
result += '\n[CODE]\n' + tree.text().replace('[/CODE]', r'[\/CODE]') + '[/CODE]\n'
|
result += '[CODE]\n' + tree.text().replace('[/CODE]', r'[\/CODE]') + '[/CODE]\n'
|
||||||
elif tree.node_kind() == NodeKinds.END_SUMMARY:
|
elif tree.node_kind() == NodeKinds.END_SUMMARY:
|
||||||
result += '[/]'
|
result += '[/]'
|
||||||
elif tree.node_kind() == NodeKinds.ERROR_TEXT:
|
elif tree.node_kind() == NodeKinds.ERROR_TEXT:
|
||||||
@ -732,7 +730,8 @@ class FFMLProcessor:
|
|||||||
while True:
|
while True:
|
||||||
p = self.find_one_of()
|
p = self.find_one_of()
|
||||||
if p > 0:
|
if p > 0:
|
||||||
txt = self.text_to(p).replace('\n', ' ')
|
txt = self.text_to(p)
|
||||||
|
txt = txt[:-1].replace('\n', ' ') + txt[-1]
|
||||||
parent.add_child(TextNode(txt))
|
parent.add_child(TextNode(txt))
|
||||||
self.move_pos(p)
|
self.move_pos(p)
|
||||||
elif p == NodeKinds.BLANK_LINE:
|
elif p == NodeKinds.BLANK_LINE:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user