harbor run -t openthoughts/tasktrove-exp-rpt-issue-issue-1736harbor download openthoughts/tasktrove-exp-rpt-issue-issue-1736Problem description: When using rst_epilog in Sphinx, the gettext POT/PO generation can emit incorrect file references for the lines coming from the epilog. Instead of pointing to the actual source document (e.g. index.rst), the epilog lines get a synthetic or generated filename (such as <generated>), and the line numbers can be wrong. This makes the translated POT entries point to the wrong location.
Goal: Modify the code path that appends the rst_epilog content so that the epilog lines carry proper source information (filename and line numbers) derived from the preceding content context, rather than always using a synthetic generated source.
Files to modify/create (in /app/):
What to do (high level):
Reproduction (for context; not part of the patch):
rst_epilog = """
.. |var1| replace:: VAR1
"""
A
======
a
b
Before (code you will replace) — show the exact pre-fix state of the code (in sphinx/util/rst.py):
def append_epilog(content: StringList, epilog: str) -> None:
"""Append a string to content body as epilog."""
if epilog:
content.append('', '<generated>', 0)
for lineno, line in enumerate(epilog.splitlines()):
content.append(line, '<rst_epilog>', lineno)
Exactly what to create/modify in /app/:
Expected behavior after implementing the fix:
Verification steps:
Notes: