git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Julian Phillips <julian@quantumfyre.co.uk>
Date
Jul 20, 2007, 12:06 UTC
Message-ID
<20070720121153.23352.73276.julian@quantumfyre.co.uk>
In-Reply-To
<Pine.LNX.4.64.0707200806540.20056@beast.quantumfyre.co.uk>

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@quantumfyre.co.uk>
---
On Fri, 20 Jul 2007, Julian Phillips wrote:
Show 18 quoted lines
> On Fri, 20 Jul 2007, Junio C Hamano wrote:
>
>>  Julian Phillips <julian@quantumfyre.co.uk> 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
Previous: Julian PhillipsNext: Junio C Hamano
Message 10 of 16 in “Manpage rendering faults”
  1. Fredrik TolfJul 18, 2007
  2. Julian PhillipsJul 18, 2007
  3. Fredrik TolfJul 18, 2007
  4. Force listingblocks to be monospaced in manpagesJulian Phillips, Jul 18, 2007
  5. Junio C HamanoJul 18, 2007
  6. Julian PhillipsJul 19, 2007
  7. Force listingblocks to be monospaced in manpagesJulian Phillips, Jul 18, 2007
  8. Junio C HamanoJul 20, 2007
  9. Julian PhillipsJul 20, 2007
  10. Update listingblock monospace fix to support all docbook versionsJulian Phillips, Jul 20, 2007
  11. Junio C HamanoJul 20, 2007
  12. Brian GernhardtJul 20, 2007
  13. Julian PhillipsJul 20, 2007
  14. Force listingblocks to be monospaced in manpagesJonas Fonseca, Jul 19, 2007
  15. Julian PhillipsJul 19, 2007
  16. Jonas FonsecaJul 19, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.