From: Felipe Contreras Date: Fri, 21 May 2021 22:44:50 GMT Subject: [PATCH v2 09/11] doc: asciidoctor: add support for baseurl Message-ID: <20210521224452.530852-10-felipe.contreras@gmail.com> In-Reply-To: <20210521224452.530852-1-felipe.contreras@gmail.com> So that we can present relative links correctly. Reduces the doc-diff: NOTES - 1. “Understanding history: What is a branch?” - file:///$HOME/share/doc/git-doc/user-manual.html#what-is-a-branch + [1] “Understanding history: What is a branch?” + user-manual.html#what-is-a-branch NOTES - 1. “Understanding history: What is a branch?” + [1] “Understanding history: What is a branch?” file:///$HOME/share/doc/git-doc/user-manual.html#what-is-a-branch Signed-off-by: Felipe Contreras --- Documentation/Makefile | 1 + Documentation/asciidoctor-extensions.rb | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Documentation/Makefile b/Documentation/Makefile index 0c654f4ec9..c28c49dd7a 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -185,6 +185,7 @@ ASCIIDOC_DOCBOOK = docbook5 ASCIIDOC_EXTRA += -acompat-mode -atabsize=8 ASCIIDOC_EXTRA += -I. -rasciidoctor-extensions ASCIIDOC_EXTRA += -alitdd='&\#x2d;&\#x2d;' +ASCIIDOC_EXTRA += -abaseurl='$(MAN_BASE_URL)' ASCIIDOC_DEPS = asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS DBLATEX_COMMON = XMLTO_EXTRA += --skip-validation diff --git a/Documentation/asciidoctor-extensions.rb b/Documentation/asciidoctor-extensions.rb index 914e6f64c8..8856f2febd 100644 --- a/Documentation/asciidoctor-extensions.rb +++ b/Documentation/asciidoctor-extensions.rb @@ -16,7 +16,9 @@ module Asciidoctor footnote = doc.footnotes.find { |e| e.id == node.target } if !footnote - footnote_text = "%s\n\e.RS\n\e\\%%%s\n\e.RE" % [node.text, node.target] + target = node.target + target = doc.attributes['baseurl'] + target unless target.include? ':' + footnote_text = "%s\n\e.RS\n\e\\%%%s\n\e.RE" % [node.text, target] index = doc.counter('footnote-number') footnote = Document::Footnote.new(index, node.target, footnote_text) doc.register(:footnotes, footnote) -- 2.32.0.rc0