mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
Two small optimizations in the FFML transifex processor. It is possible that using the ternary expressions will be faster, and it looks better.
This commit is contained in:
parent
ab9ba6a3af
commit
91b1b8445c
@ -389,8 +389,7 @@ class FFMLProcessor:
|
||||
result += '\\' + tree.text()
|
||||
elif tree.node_kind() == NodeKinds.CODE_TEXT:
|
||||
t = tree.text()
|
||||
if t.endswith('`'):
|
||||
t = t + ' '
|
||||
t = t + ' ' if t.endswith('`') else t
|
||||
result += f'``{t}``'
|
||||
elif tree.node_kind() == NodeKinds.CODE_BLOCK:
|
||||
result += '\n[CODE]\n' + tree.text().replace('[/CODE]', r'[\/CODE]') + '[/CODE]\n'
|
||||
@ -407,9 +406,7 @@ class FFMLProcessor:
|
||||
for child in tree.children():
|
||||
result += '[*]'
|
||||
t = self.tree_to_transifex(child, depth=depth+1)
|
||||
if t.endswith('\n\n'):
|
||||
t = t[0:-1]
|
||||
result += t
|
||||
result += t[0:-1] if t.endswith('\n\n') else t
|
||||
result += '[/LIST]\n'
|
||||
elif tree.node_kind() == NodeKinds.REF:
|
||||
result += f':ref:`{tree.text()}`'
|
||||
|
Loading…
x
Reference in New Issue
Block a user