git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Julian Phillips <julian@quantumfyre.co.uk>
To: Junio C Hamano <gitster@pobox.com>
Cc: Fredrik Tolf <fredrik@dolda2000.com>, git@vger.kernel.org
Subject: [PATCH] Update listingblock monospace fix to support all docbook versions
Date: Fri, 20 Jul 2007 13:06:21 +0100	[thread overview]
Message-ID: <20070720121153.23352.73276.julian@quantumfyre.co.uk> (raw)
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:

> 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

  reply	other threads:[~2007-07-20 12:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-18 18:47 Manpage rendering faults Fredrik Tolf
2007-07-18 19:29 ` Julian Phillips
2007-07-18 20:06   ` Fredrik Tolf
2007-07-18 21:33     ` [PATCH] Force listingblocks to be monospaced in manpages Julian Phillips
2007-07-18 23:56       ` Junio C Hamano
2007-07-19  1:21         ` Julian Phillips
2007-07-18 21:33           ` Julian Phillips
2007-07-20  7:00             ` Junio C Hamano
2007-07-20  7:09               ` Julian Phillips
2007-07-20 12:06                 ` Julian Phillips [this message]
2007-07-20 16:42                   ` [PATCH] Update listingblock monospace fix to support all docbook versions Junio C Hamano
2007-07-20 19:32                   ` Brian Gernhardt
2007-07-20 22:14                     ` Julian Phillips
2007-07-19 11:37           ` [PATCH] Force listingblocks to be monospaced in manpages Jonas Fonseca
2007-07-19 11:44             ` Julian Phillips
2007-07-19 12:25               ` Jonas Fonseca

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070720121153.23352.73276.julian@quantumfyre.co.uk \
    --to=julian@quantumfyre.co.uk \
    --cc=fredrik@dolda2000.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).