git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC/NOPATCHv3 2/4] doc: add linkgit macros for asciidoctor

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Jun 18, 2021, 20:30 UTC
Message-ID
<20210618203057.790320-3-felipe.contreras@gmail.com>
In-Reply-To
<20210618203057.790320-1-felipe.contreras@gmail.com>
From: "brian m. carlson" <sandals@crustytoothpaste.net>

We also need to update the code that tells Asciidoctor how to format our linkgit macros so that it can output proper code for man pages. Be careful to reset the font to the previous after the change. In order to do so, we must reset to the previous after each font change so the previous state at the end is the state before our inserted text, since troff only remembers one previous font. We insert \e before each font-change backslash so Asciidoctor doesn't convert them into \*(rs, the reverse solidus character, and instead leaves them as we wanted them.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 Documentation/asciidoctor-extensions.rb | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/Documentation/asciidoctor-extensions.rb b/Documentation/asciidoctor-extensions.rb
index d906a00803..620b3d7a88 100644
--- a/Documentation/asciidoctor-extensions.rb
+++ b/Documentation/asciidoctor-extensions.rb
@@ -15,6 +15,8 @@ module Git
           "#{target}(#{attrs[1]})</ulink>"
         elsif parent.document.basebackend? 'html'
           %(<a href="#{prefix}#{target}.html">#{target}(#{attrs[1]})</a>)
+        elsif parent.document.basebackend? 'manpage'
+          %(\e\\fB#{target}\e\\fP\e\\fR(#{attrs[1]})\e\\fP)
         elsif parent.document.basebackend? 'docbook'
           "<citerefentry>\n" \
             "<refentrytitle>#{target}</refentrytitle>" \
-- 
2.32.0
Previous: Felipe ContrerasNext: Felipe Contreras
Message 2 of 9 in “[RFC/NOPATCHv3 0/4] doc: asciidoctor: direct man page creation and fixes (brian's version)”
  1. Felipe ContrerasJun 18, 2021
  2. 2/4 doc: add linkgit macros for asciidoctorFelipe Contreras, Jun 18, 2021
  3. Felipe ContrerasJun 18, 2021
  4. 1/4 doc: add an option to have Asciidoctor build man pages directlyFelipe Contreras, Jun 18, 2021
  5. Felipe ContrerasJun 18, 2021
  6. 3/4 doc: use XML-style escapes only for HTML and XMLFelipe Contreras, Jun 18, 2021
  7. Felipe ContrerasJun 18, 2021
  8. 4/4 doc: remove GNU_ROFF optionFelipe Contreras, Jun 18, 2021
  9. Felipe ContrerasJun 18, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.