From f1ed09965fe34ec580c9a8a3db0c07a690834e2f Mon Sep 17 00:00:00 2001 From: Mrityunjay Raj Date: Mon, 16 Feb 2026 22:36:07 +0530 Subject: [PATCH] docs: fix broken :ref: references in man pages, fixes #7239 --- docs/changes.rst | 1 + scripts/make.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/docs/changes.rst b/docs/changes.rst index 1df2b1341..c96558723 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -178,6 +178,7 @@ Other changes: - fix S3 url description, #9249 - add a note that you need to install boto3 if you want to use S3/B2 URLs + - man pages: fix broken :ref: references (e.g. borg_patterns), #7239 Version 2.0.0b20 (2025-12-24) diff --git a/scripts/make.py b/scripts/make.py index 46f0cbade..f7bae4d41 100644 --- a/scripts/make.py +++ b/scripts/make.py @@ -485,11 +485,17 @@ class BuildMan: from docutils.core import publish_string from docutils.nodes import inline from docutils.parsers.rst import roles + from borg.archiver._common import rst_plain_text_references def issue(name, rawtext, text, lineno, inliner, options={}, content=[]): return [inline(rawtext, "#" + text)], [] + def ref_role(name, rawtext, text, lineno, inliner, options={}, content=[]): + replacement = rst_plain_text_references.get(text, text) + return [inline(rawtext, replacement)], [] + roles.register_local_role("issue", issue) + roles.register_local_role("ref", ref_role) # We give the source_path so that docutils can find relative includes # as-if the document where located in the docs/ directory. man_page = publish_string(source=rst, source_path="docs/%s.rst" % name, writer=manpage.Writer())