asciidoctor-extensions: fix spurious space after linkgit

When we render, e.g., "linkgit:gitglossary[7]." with Asciidoctor, we get "gitglossary(7) ." with a space between the linkgit macro expansion and the punctuation. We can fix this by dropping the trailing newline after we've turned `linkgit:foo[bar]` into `<citerefentry>..</citerefentry>`. The diff produced by `USE_ASCIIDOCTOR=Yes ./doc-diff HEAD^ HEAD` is almost 6000 lines large and shows how this fixes "git-foo(x) ,", "(see git-bar(y) )" and so on. One might wonder whether this also turns, e.g., "see linkgit:foo[1] for more" into "see foo(1)for more", but no. We get "...</citerefentry> for more" in the XML, see, e.g., git-am.xml, so the space ends up in git-am.1 just fine. The same is true for the HTML output. Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Martin Ågren committed Feb 27, 2019 at 19:17 UTC 185f9a0ea05a00aadbfce56bce21fe2909ae139c
1 file changed +2 -2
Documentation/asciidoctor-extensions.rb
+2 -2
@@ -11,12 +11,12 @@ module Git
11 def process(parent, target, attrs)
12 if parent.document.basebackend? 'html'
13 prefix = parent.document.attr('git-relative-html-prefix')
14 - %(<a href="#{prefix}#{target}.html">#{target}(#{attrs[1]})</a>\n)
14 + %(<a href="#{prefix}#{target}.html">#{target}(#{attrs[1]})</a>)
15 elsif parent.document.basebackend? 'docbook'
16 "<citerefentry>\n" \
17 "<refentrytitle>#{target}</refentrytitle>" \
18 "<manvolnum>#{attrs[1]}</manvolnum>\n" \
19 - "</citerefentry>\n"
19 + "</citerefentry>"
20 end
21 end
22 end