Re: [RFC suggestion] Generate manpage directly with Asciidoctor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 8 May 2021 at 01:40, Felipe Contreras
<felipe.contreras@xxxxxxxxx> wrote:
>
> brian m. carlson wrote:
> > On 2021-05-07 at 06:06:31, Bagas Sanjaya wrote:
> > > So completely migrating to Asciidoctor can eliminate xmlto requirement
> > > for generating manpage.
> > >
> > > What do you think about above?
> >
> > I didn't do this because it makes things very complicated in the
> > Makefile and my goal was to minimize the needed changes and divergence.
> > I'm not opposed to someone else doing it, but I expect it will be a
> > bunch of work.
>
> I don't think it would be that complicated.
>
> This patch seems to do the trick here:

This looks similar to Todd's wip [1]. Here's something
whitespace-damaged on top that improves some things, but I'm sure
there's more to do. I think in order to work on this, it would need to
be a separate switch so that we can use asciidoctor both the old-school
and the new-school way for a while.

[1] https://lore.kernel.org/git/20190317194431.GY31362@xxxxxxxxx/

diff --git a/Documentation/Makefile b/Documentation/Makefile
index 0cfa88a92b..9f73d2d033 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -192,7 +192,9 @@ ASCIIDOC_HTML = xhtml5
 ASCIIDOC_DOCBOOK = docbook5
 ASCIIDOC_EXTRA += -acompat-mode -atabsize=8
 ASCIIDOC_EXTRA += -I. -rasciidoctor-extensions
-ASCIIDOC_EXTRA += -alitdd='&\#x2d;&\#x2d;'
+ASCIIDOC_EXTRA += -alitdd='\--'
+ASCIIDOC_EXTRA += -aplus='+'
+ASCIIDOC_COMMON += -a mansource="Git $(GIT_VERSION)" -a manmanual="Git Manual"
 DBLATEX_COMMON =
 XMLTO_EXTRA += --skip-validation
 XMLTO_EXTRA += -x manpage.xsl
diff --git a/Documentation/asciidoctor-extensions.rb
b/Documentation/asciidoctor-extensions.rb
index d906a00803..fb74443241 100644
--- a/Documentation/asciidoctor-extensions.rb
+++ b/Documentation/asciidoctor-extensions.rb
@@ -10,11 +10,16 @@ module Git

       def process(parent, target, attrs)
         prefix = parent.document.attr('git-relative-html-prefix')
+        s = "#{target}(#{attrs[1]})"
         if parent.document.doctype == 'book'
           "<ulink url=\"#{prefix}#{target}.html\">" \
           "#{target}(#{attrs[1]})</ulink>"
+        elsif parent.document.basebackend? 'manpage'
+          # FIXME: boldness should respect NO_MAN_BOLD_LITERAL?
+          # -- should be doable using an attribute, similar
+          # to "prefix" above
+          create_inline(parent, :quoted, s, type: :strong).convert
         elsif parent.document.basebackend? 'html'
           %(<a href="#{prefix}#{target}.html">#{target}(#{attrs[1]})</a>)
         elsif parent.document.basebackend? 'docbook'
           "<citerefentry>\n" \
             "<refentrytitle>#{target}</refentrytitle>" \



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux