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

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

 



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 <julian@xxxxxxxxxxxxxxxxx>
---

On Fri, 20 Jul 2007, Julian Phillips wrote:

> On Fri, 20 Jul 2007, Junio C Hamano wrote:
>
>>  Julian Phillips <julian@xxxxxxxxxxxxxxxxx> writes:
>>
>> >  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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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