Thread (6 messages) flat view 6 messages, 3 authors, 2016-06-15
DORMANTno replies

[PATCH] Force listingblocks to be monospaced in manpages

From: Julian Phillips <hidden>
Date: 2016-06-15 22:43:22
Subsystem: documentation, the rest · Maintainers: Jonathan Corbet, Linus Torvalds

Possibly related (same subject, not in this thread)

For the html output we can use a stylesheet to make sure that the
listingblocks are presented in a monospaced font.  For the manpages do
it manually by inserting a ".ft C" before and ".ft" after the block in
question.  This makes the ascii-art diagrams readable in PS output.

In order for these roff commands to get through to the manpage they
have to be element encoded to prevent quoting.  In particular with
docbook xsl 1.72.0 and newer we have to use U+2302 instead of . to
prevent the roff command being escaped.  We also add a small perl
script for docbook < 1.72.0.

Signed-off-by: Julian Phillips <redacted>
---

On Thu, 19 Jul 2007, Julian Phillips wrote:
On Wed, 18 Jul 2007, Junio C Hamano wrote:
quoted
 I tried with your patch, both with asciidoc7 and asciidoc8.  Did
 you really mean "&#x2302;" above?  Replacing them with "."  gave
 me a series of these changes (diff between output before and
 after your patch with the "s/\&#x2302;/./g" fixup):
I did mean it.  I originally just had .ft, but I was getting \&.ft in the
manpage, which then just came out as .ft in the console.

I got the &#x2302; from
http://docbook.sourceforge.net/release/xsl/current/manpages/utility.xsl, so I
assumed it was the "correct" thing to use ...

This was with asciidoc 7 and docbook xsl stylesheet 1.72.0.

quoted
 whatever that 2302 is...
&#x2302; (or U+2302) seems to be a character from the unicode "Misc.
Technical" section ... looks a bit like a house.

See sixth bullet from
http://docbook.sourceforge.net/release/xsl/current/RELEASE-NOTES.html#V1.72.0$

looks like it may need to depend on which docbook xsl version you are using
...
I couldn't find any way to detect the docbook version - perhaps someone more
with more knowledge of asciidoc might know?

Otherwise, something like this perhaps?

 Documentation/Makefile          |    3 +++
 Documentation/asciidoc.conf     |    6 ++++++
 Documentation/replace_U+2303.pl |    6 ++++++
 3 files changed, 15 insertions(+), 0 deletions(-)
 create mode 100755 Documentation/replace_U+2303.pl
diff --git a/Documentation/Makefile b/Documentation/Makefile
index b062757..e381b2e 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -121,6 +121,9 @@ clean:
 
 %.1 %.5 %.7 : %.xml
 	xmlto -m callouts.xsl man $<
+	mv $@ $@.tmp
+	./replace_U+2303.pl < $@.tmp > $@
+	$(RM) $@.tmp
 
 %.xml : %.txt
 	$(RM) $@+ $@
diff --git a/Documentation/asciidoc.conf b/Documentation/asciidoc.conf
index 6b6220d..d54fe29 100644
--- a/Documentation/asciidoc.conf
+++ b/Documentation/asciidoc.conf
@@ -27,7 +27,13 @@ ifdef::backend-docbook[]
 [listingblock]
 <example><title>{title}</title>
 <literallayout>
+ifdef::doctype-manpage[]
+&#10;&#x2302;ft C&#10;
+endif::doctype-manpage[]
 |
+ifdef::doctype-manpage[]
+&#10;&#x2302;ft&#10;
+endif::doctype-manpage[]
 </literallayout>
 {title#}</example>
 endif::backend-docbook[]
diff --git a/Documentation/replace_U+2303.pl b/Documentation/replace_U+2303.pl
new file mode 100755
index 0000000..b086949
--- /dev/null
+++ b/Documentation/replace_U+2303.pl
@@ -0,0 +1,6 @@
+#!/usr/bin/perl -w
+
+while ($line = <>) {
+	$line =~ s/^\x{2302}/./;
+	print $line;
+}
-- 
1.5.2.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help