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

[PATCH] Update listingblock monospace fix to support all docbook versions

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)

The previous fix to force the listingblock to be monospaced would not
work for docbook versions 1.72 or newer, as they now escape leading
'.'s and you have to use U+2302 instead.  However you can't use U+2302
in ealier versions ...

So this uses the string '#GIT#SET#MAN#FONT#', and then changes that to
.ft using a post-process perl script.

Not pretty, but it works.

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

On Fri, 20 Jul 2007, Julian Phillips wrote:
On Fri, 20 Jul 2007, Junio C Hamano wrote:
quoted
 Julian Phillips [off-list ref] writes:
quoted
 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.
 This does not work at all for docbook 1.71.  I get "^<TAB>ft C"
 as output from xmlto.
Oh, well ... that's handy? :S

I've just checked, and I do have a machine with docbook < 1.72, so I'll see
if I can get something working on both.  Probably early next week since I'm
away this weekend.
This works ... but I'm not particularly proud of it.

I've done this a patch ontop of master, since you seem to have already pushed
out the tweaked version of my original patch.

 Documentation/Makefile                    |    3 +++
 Documentation/asciidoc.conf               |    4 ++--
 Documentation/insert_man_font_commands.pl |    6 ++++++
 3 files changed, 11 insertions(+), 2 deletions(-)
 create mode 100755 Documentation/insert_man_font_commands.pl
diff --git a/Documentation/Makefile b/Documentation/Makefile
index b062757..70f4b44 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -121,6 +121,9 @@ clean:
 
 %.1 %.5 %.7 : %.xml
 	xmlto -m callouts.xsl man $<
+	mv $@ $@.tmp
+	./insert_man_font_commands.pl < $@.tmp > $@
+	$(RM) $@.tmp
 
 %.xml : %.txt
 	$(RM) $@+ $@
diff --git a/Documentation/asciidoc.conf b/Documentation/asciidoc.conf
index af5b155..83fa03f 100644
--- a/Documentation/asciidoc.conf
+++ b/Documentation/asciidoc.conf
@@ -28,11 +28,11 @@ ifdef::backend-docbook[]
 <example><title>{title}</title>
 <literallayout>
 ifdef::doctype-manpage[]
-&#10;.ft C&#10;
+&#10;#GIT#SET#MAN#FONT# C&#10;
 endif::doctype-manpage[]
 |
 ifdef::doctype-manpage[]
-&#10;.ft&#10;
+&#10;#GIT#SET#MAN#FONT#&#10;
 endif::doctype-manpage[]
 </literallayout>
 {title#}</example>
diff --git a/Documentation/insert_man_font_commands.pl b/Documentation/insert_man_font_commands.pl
new file mode 100755
index 0000000..c100534
--- /dev/null
+++ b/Documentation/insert_man_font_commands.pl
@@ -0,0 +1,6 @@
+#!/usr/bin/perl -w
+
+while ($line = <>) {
+	$line =~ s/^#GIT#SET#MAN#FONT#/.ft/;
+	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