[PATCH] Force listingblocks to be monospaced in manpages

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Junio C Hamano <gitster@...>
Cc: Fredrik Tolf <fredrik@...>, <git@...>
Date: Wednesday, July 18, 2007 - 5:33 pm

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 <julian@quantumfyre.co.uk>
---

On Thu, 19 Jul 2007, Julian Phillips wrote:


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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: Manpage rendering faults, Fredrik Tolf, (Wed Jul 18, 4:06 pm)
[PATCH] Force listingblocks to be monospaced in manpages, Julian Phillips, (Wed Jul 18, 5:33 pm)
Re: [PATCH] Force listingblocks to be monospaced in manpages, Julian Phillips, (Wed Jul 18, 9:21 pm)
[PATCH] Force listingblocks to be monospaced in manpages, Jonas Fonseca, (Thu Jul 19, 7:37 am)
Re: [PATCH] Force listingblocks to be monospaced in manpages, Julian Phillips, (Thu Jul 19, 7:44 am)
[PATCH] Force listingblocks to be monospaced in manpages, Julian Phillips, (Wed Jul 18, 5:33 pm)
Re: [PATCH] Force listingblocks to be monospaced in manpages, Julian Phillips, (Fri Jul 20, 3:09 am)