From: Felipe Contreras <hidden> Date: 2021-05-15 11:57:00
This patch series gets rid of old unnecessary workarounds and convoluted solutions.
Additionally it cleanups the asciidoctor-specific code so it ends up much more simpler.
This goes on top of my other cleanup patches [1].
[1] 20210514115631.503276-1-felipe.contreras@gmail.com
Felipe Contreras (12):
doc: remove GNU troff workaround
doc: use --stringparam in xmlto
doc: simplify version passing
doc: asciidoc: remove unnecessary attribute
doc: asciidoctor: remove unnecessary require
doc: asciidoctor: remove cruft
doc: asciidoctor: reorganize extensions
doc: asciidoctor: use html-prefix only for html
doc: asciidoctor: refactor macro registration
doc: asciidoctor: improve string handling
doc: asciidoctor: split the format from the code
doc: asciidoctor: specify name of our group
Documentation/.gitignore | 1 -
Documentation/Makefile | 19 ++-------
Documentation/asciidoc.conf | 20 ---------
Documentation/asciidoctor-extensions.rb | 56 ++++++++-----------------
Documentation/manpage-base-url.xsl.in | 10 -----
Documentation/manpage-quote-apos.xsl | 16 -------
Makefile | 4 --
7 files changed, 21 insertions(+), 105 deletions(-)
delete mode 100644 Documentation/manpage-base-url.xsl.in
delete mode 100644 Documentation/manpage-quote-apos.xsl
--
2.31.1
From: Felipe Contreras <hidden> Date: 2021-05-15 11:57:02
In 2007 the docbook project made the mistake of converting ' to \' for
man pages [1]. It's a problem because groff interprets \' as acute
accent which is rendered as ' in ASCII, but as ´ in utf-8.
This started a cascade of bug reports in git [2], debian [3], Arch Linux
[4], docbook itself [5], and probably many others.
A solution was to use the correct groff character: \(aq, which is always
rendered as ', but the problem is that such character doesn't work in
other troff programs.
A portable solution required the use of a conditional character that is
\(aq in groff, but ' in all others:
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
The proper solution took time to be implemented in docbook, but in 2010
they did it [6]. So the docbook man page stylesheets were broken from
1.73 to 1.76.
Unfortunately by that point many workarounds already existed. In the
case of git GNU_ROFF was introduced, and in the case of Arch Linux
a mappig from \' to ' was added to groff's man.local. Other
distributions might have done the same, or similar workarounds.
Since 2010 there is not need for this workaround, which is fixed
elsewhere not just in docbook, but other layers as well.
Let's remove it.
Also, it's GNU troff, not GNU roff.
[1] https://github.com/docbook/xslt10-stylesheets/commit/ea2a0bac56c56eec1892ac3d9254dca89f7c5746
[2] https://lore.kernel.org/git/20091012102926.GA3937@debian.b2j/
[3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=507673#65
[4] https://bugs.archlinux.org/task/9643
[5] https://sourceforge.net/p/docbook/bugs/1022/
[6] https://github.com/docbook/xslt10-stylesheets/commit/fb553434265906ed81edc6d5f533d0b08d200046
Inspired-by: brian m. carlson [off-list ref]
Signed-off-by: Felipe Contreras <redacted>
---
Documentation/Makefile | 8 --------
Documentation/manpage-quote-apos.xsl | 16 ----------------
Makefile | 4 ----
3 files changed, 28 deletions(-)
delete mode 100644 Documentation/manpage-quote-apos.xsl
@@ -178,14 +178,6 @@ MAN_BASE_URL = file://$(htmldir)/endifXMLTO_EXTRA+=-mmanpage-base-url.xsl-# If your target system uses GNU groff, it may try to render-# apostrophes as a "pretty" apostrophe using unicode. This breaks-# cut&paste, so you should set GNU_ROFF to force them to be ASCII-# apostrophes. Unfortunately does not work with non-GNU roff.-ifdef GNU_ROFF-XMLTO_EXTRA+=-mmanpage-quote-apos.xsl-endif-ifdef USE_ASCIIDOCTORASCIIDOC=asciidoctorASCIIDOC_CONF=
@@ -278,10 +278,6 @@ all::# Define NO_ST_BLOCKS_IN_STRUCT_STAT if your platform does not have st_blocks# field that counts the on-disk footprint in 512-byte blocks.#-# Define GNU_ROFF if your target system uses GNU groff. This forces-# apostrophes to be ASCII so that cut&pasting examples to the shell-# will work.-## Define USE_ASCIIDOCTOR to use Asciidoctor instead of AsciiDoc to build the# documentation.#
From: Felipe Contreras <hidden> Date: 2021-05-15 11:57:07
Commit 50d9bbba92 (Documentation: Avoid use of xmlto --stringparam,
2009-12-04) introduced manpage-base-url.xsl because ancient versions of
xmlto did not have --stringparam.
However, that was more than ten years ago, no need for that complexity
anymore.
Signed-off-by: Felipe Contreras <redacted>
---
Documentation/.gitignore | 1 -
Documentation/Makefile | 8 ++------
Documentation/manpage-base-url.xsl.in | 10 ----------
3 files changed, 2 insertions(+), 17 deletions(-)
delete mode 100644 Documentation/manpage-base-url.xsl.in
From: Felipe Contreras <hidden> Date: 2021-05-15 11:57:13
The code to pass the version of the man page comes from 2007:
7ef195ba3e (Documentation: Add version information to man pages,
2007-03-25). However, both asciidoc and asciidoctor already do this by
default.
Asciidoctor doesn't read manversion, but there's no need since both
tools just join mansource and manversion.
Let's do that ourselves and get rid of a bunch of code.
Signed-off-by: Felipe Contreras <redacted>
---
Documentation/Makefile | 3 +--
Documentation/asciidoc.conf | 19 -------------------
Documentation/asciidoctor-extensions.rb | 17 -----------------
3 files changed, 1 insertion(+), 38 deletions(-)
From: Felipe Contreras <hidden> Date: 2021-05-15 11:57:19
It's part of asciidoc global configuration since 2012.
Signed-off-by: Felipe Contreras <redacted>
---
Documentation/asciidoc.conf | 1 -
1 file changed, 1 deletion(-)
From: Felipe Contreras <hidden> Date: 2021-05-15 11:57:21
This file is loaded by asciidoctor, the module is already loaded.
In addition to being less redundant this fixes a problem while trying
use a development version of asciidoctor when the gem is available:
$GEM_HOME/gems/asciidoctor-2.0.15/lib/asciidoctor.rb:51:
warning: already initialized constant Asciidoctor::RUBY_ENGINE
$HOME/asciidoctor/lib/asciidoctor.rb:52:
warning: previous definition of RUBY_ENGINE was here
...
That's a bug in asciidoctor, but there's no need to trigger it.
Signed-off-by: Felipe Contreras <redacted>
---
Documentation/asciidoctor-extensions.rb | 1 -
1 file changed, 1 deletion(-)
From: Felipe Contreras <hidden> Date: 2021-05-15 11:57:23
These were probably copy-pasted from other extensions. The name is
already defined (:linkgit), and we are not using the DSL mode.
Signed-off-by: Felipe Contreras <redacted>
---
Documentation/asciidoctor-extensions.rb | 4 ----
1 file changed, 4 deletions(-)
From: Felipe Contreras <hidden> Date: 2021-05-15 11:57:24
There's no need to create verbose classes, we can do the same with a
simple block.
Signed-off-by: Felipe Contreras <redacted>
---
Documentation/asciidoctor-extensions.rb | 34 +++++++++++--------------
1 file changed, 15 insertions(+), 19 deletions(-)
From: Felipe Contreras <hidden> Date: 2021-05-15 11:57:31
There is no need to execute extra code every time the process block is
called.
In Ruby the lexical scope is shared, so we can define variables in the
register block scope, and all the rest will inherit those variables.
Based on the doctype and basebackend one of three blocks is selected for
the inline_macro. However, the conditionals will be run only once.
In the end Ruby will only run the code between `process do end`, nothing
else.
Signed-off-by: Felipe Contreras <redacted>
---
Documentation/asciidoctor-extensions.rb | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
From: Felipe Contreras <hidden> Date: 2021-05-15 11:57:35
Using printf style formatting (more familiar to git developers), and
also here document.
Signed-off-by: Felipe Contreras <redacted>
---
Documentation/asciidoctor-extensions.rb | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
From: Felipe Contreras <hidden> Date: 2021-05-15 11:57:37
This way we don't have to specify the block to execute on every
conditional.
Signed-off-by: Felipe Contreras <redacted>
---
Documentation/asciidoctor-extensions.rb | 26 ++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
From: Felipe Contreras <hidden> Date: 2021-05-15 11:57:40
Doesn't do anything, but otherwise we get a random name.
Signed-off-by: Felipe Contreras <redacted>
---
Documentation/asciidoctor-extensions.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)