Re: [PATCH 1/2] doc: add an option to have Asciidoctor build man pages directly

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

 



Martin Ågren wrote:
> On Wed, 12 May 2021 at 08:59, Jeff King <peff@xxxxxxxx> wrote:
> 
> > We seem to have a problem with some escape codes. E.g.:
> >
> >   -           of nothing). The other file, git-add--interactive.perl, has 403
> >   -           lines added and 35 lines deleted if you commit what is in the
> >   -           index, but working tree file has further modifications (one
> >   +           of nothing). The other file, git-add&#x2d;&#x2d;interactive.perl,
> >   +           has 403 lines added and 35 lines deleted if you commit what is in
> >   +           the index, but working tree file has further modifications (one
> >
> > and:
> >
> >   -           Added content is represented by lines beginning with "+". You can
> >   -           prevent staging any addition lines by deleting them.
> >   +           Added content is represented by lines beginning with "&#43;". You
> >   +           can prevent staging any addition lines by deleting them.
> >
> > which is a pretty bad regression.
> 
> ASCIIDOC_EXTRA += -aplus='+'
> ASCIIDOC_EXTRA += -alitdd='\--'
> 
> seems to have done the trick for me at one point, but Todd had some
> concerns [1] that it interacted badly with the html build, so we might
> need to use a less aggressive choice of makefile variable to only affect
> the direct manpage generation.

I don't see a point of complicating the Makefile more if we are already
passing `-r ourstuff.rb`.

One advantage of Ruby is that everything can be overriden, so we can
override the initialization of the Document object:

  module Asciidoctor
    class Document
      alias old_initialize initialize
      def initialize(data = nil, options = {})
        attributes = options[:attributes]
        case attributes['backend']
        when 'manpage'
          attributes['litdd'] = '\--'
          attributes['plus'] = '+'
        when 'xhtml5'
          attributes['litdd'] = '&#x2d;&#x2d;'
        end
        old_initialize(data, options)
      end
    end
  end

This does the trick for me for both backends, and it simplifies the
Makefile.

However, it's a hack for what seems to be a bug in asciidoctor. I'll
report the issue.

Cheers.

-- 
Felipe Contreras



[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