Message ID | 20210618203057.790320-2-felipe.contreras@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | doc: asciidoctor: direct man page creation and fixes (brian's version) | expand |
Felipe Contreras wrote: > From: "brian m. carlson" <sandals@crustytoothpaste.net> > > Asciidoctor contains a converter to generate man pages. In some > environments, where building only the manual pages and not the other > documentation is desired, installing a toolchain for building > DocBook-based manual pages may be burdensome, and using Asciidoctor > directly may be easier, so let's add an option to build manual pages > using Asciidoctor without the DocBook toolchain. This suffices: There's no need to use xmlto to build the man pages when modern asciidoctor can do it by itself. > We generally require Asciidoctor 1.5, but versions before 1.5.3 didn't > contain proper handling of the apostrophe, which is controlled normally > by the GNU_ROFF option. This isn't true. There's no difference from 1.5, 1.5.3, 2.0.0 or even 2.0.15. The only fix regarding apostrophes was done by me [1], it's in the master branch, but not in any release yet. > This option for the DocBook toolchain, as well > as newer versions of Asciidoctor, makes groff output an ASCII apostrophe > instead of a Unicode apostrophe in text, so as to make copy and pasting > commands easier. That isn't true. GNU_ROFF is only for docbook and doesn't affect asciidoctor in any way. > These newer versions of Asciidoctor (1.5.3 and above) > detect groff and do the right thing in all cases, so the GNU_ROFF option > is obsolete in this case. Not true. There's nothing in 1.5.3 or any version that detects groff, or have anything to do with GNU_ROFF. > Because Asciidoctor versions before 2.0 had a few problems with man page > output, let's default this to off for now, since some common distros are > still on 1.5. There's nothing from 1.5.8 to 2.0.0 that should be of interest to the git project. What are these "few problems"? The diff is correct, but 1) the original patch was done by me, and 2) I already have the exact same version here [2]. Cheers. [1] https://github.com/asciidoctor/asciidoctor/commit/af0ef59538fccfbdec053b82e102a240b15cdda6 [2] https://lore.kernel.org/git/20210521224452.530852-4-felipe.contreras@gmail.com/
diff --git a/Documentation/Makefile b/Documentation/Makefile index 81d1bf7a04..d3103c3dde 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -187,6 +187,9 @@ ASCIIDOC_EXTRA += -alitdd='&\#x2d;&\#x2d;' DBLATEX_COMMON = XMLTO_EXTRA += --skip-validation XMLTO_EXTRA += -x manpage.xsl +ifdef USE_ASCIIDOCTOR_MANPAGE +TXT_TO_MAN = $(ASCIIDOC_COMMON) -b manpage +endif endif SHELL_PATH ?= $(SHELL) @@ -325,7 +328,7 @@ mergetools-list.made: ../git-mergetool--lib.sh $(wildcard ../mergetools/*) show_tool_names can_merge "* " || :' >mergetools-merge.txt && \ date >$@ -TRACK_ASCIIDOCFLAGS = $(subst ','\'',$(ASCIIDOC_COMMON):$(ASCIIDOC_HTML):$(ASCIIDOC_DOCBOOK)) +TRACK_ASCIIDOCFLAGS = $(subst ','\'',$(ASCIIDOC_COMMON):$(ASCIIDOC_HTML):$(ASCIIDOC_DOCBOOK):$(USE_ASCIIDOCTOR_MANPAGE)) GIT-ASCIIDOCFLAGS: FORCE @FLAGS='$(TRACK_ASCIIDOCFLAGS)'; \ @@ -358,9 +361,16 @@ $(OBSOLETE_HTML): %.html : %.txto asciidoc.conf asciidoctor-extensions.rb GIT-AS manpage-base-url.xsl: manpage-base-url.xsl.in $(QUIET_GEN)sed "s|@@MAN_BASE_URL@@|$(MAN_BASE_URL)|" $< > $@ +ifdef TXT_TO_MAN +%.1 %.5 %.7 : %.txt asciidoc.conf asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS + $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \ + $(TXT_TO_MAN) -o $@+ $< && \ + mv $@+ $@ +else %.1 %.5 %.7 : %.xml manpage-base-url.xsl $(wildcard manpage*.xsl) $(QUIET_XMLTO)$(RM) $@ && \ $(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $< +endif %.xml : %.txt asciidoc.conf asciidoctor-extensions.rb GIT-ASCIIDOCFLAGS $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \ diff --git a/Makefile b/Makefile index f3dc217832..48547e2c3b 100644 --- a/Makefile +++ b/Makefile @@ -285,6 +285,10 @@ all:: # Define USE_ASCIIDOCTOR to use Asciidoctor instead of AsciiDoc to build the # documentation. # +# Define USE_ASCIIDOCTOR_MANPAGE to use Asciidoctor's manual page backend +# instead of building manual pages from DocBook (using xmlto). Has no effect +# unless USE_ASCIIDOCTOR is set. +# # Define ASCIIDOCTOR_EXTENSIONS_LAB to point to the location of the Asciidoctor # Extensions Lab if you have it available. #