Skip to content

Commit

Permalink
Discard trailing () of ref automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Nov 12, 2024
1 parent 60d0f43 commit ee3a949
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/calibre/utils/ffml_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,9 @@ def tree_to_rst(self, tree, indent, result=None):
result += '\n'
result += '\n'
elif tree.node_kind() == NodeKinds.REF:
result += f':ref:`{tree.text()}() <ff_{tree.text()}>`'
if (rname := tree.text()).endswith('()'):
rname = rname[:-2]
result += f':ref:`{rname}() <ff_{rname}>`'
elif tree.node_kind() == NodeKinds.TEXT:
txt = tree.text()
if not result:
Expand Down

1 comment on commit ee3a949

@cbhaley
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I made that "common error" this fixes. Sigh.

Please sign in to comment.