From ee3a9492a1eeb06890922ecca658a74b0d0c1548 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 12 Nov 2024 20:44:46 +0530 Subject: [PATCH] Discard trailing () of ref automatically --- src/calibre/utils/ffml_processor.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/utils/ffml_processor.py b/src/calibre/utils/ffml_processor.py index 34fe876369..35c0fdfc1e 100644 --- a/src/calibre/utils/ffml_processor.py +++ b/src/calibre/utils/ffml_processor.py @@ -345,7 +345,9 @@ class FFMLProcessor: result += '\n' result += '\n' elif tree.node_kind() == NodeKinds.REF: - result += f':ref:`{tree.text()}() `' + if (rname := tree.text()).endswith('()'): + rname = rname[:-2] + result += f':ref:`{rname}() `' elif tree.node_kind() == NodeKinds.TEXT: txt = tree.text() if not result: