Re: [docbook2X] man pages from docbook

Steve Cheng <[email protected]> Sun, 25 May 2003 11:35:54 -0400
Newsgroups gmane.text.docbook.docbook2x.general
Message-ID <[email protected]>
On May 24, 2003 11:39 pm, Gordon Messmer wrote:
> I'm having trouble generating man pages from docbook sources.  When I
> have a line beginning with a dot character, the line will be discarded
> when displayed by man.  For example:
>
> <programlisting><emphasis>./Maildir/
>
> |/usr/bin/holiday username</emphasis></programlisting>
>
> becomes:
>
> .nf
> \fB./Maildir/
>
>   |/usr/bin/holiday username\fR
>
> In the nroff document, I might use either '\ ' or '\&' to tell nroff to
> ignore the subsequent '.', and the line would be displayed normally.  

Indeed.  The attached patch to perl/db2x_manxml.pl fixes it.
Patch that file, and then do make; make install. I'm in the process of banging 
out table support, so I can't do a release with this fix just yet.

(The problem is basically that when processing "verbatim" elements
db2x_manxml forgets to do what you just described.  For non-verbatim elements
it already did know how to use the \& trick.)

-- 
Steve Cheng 
&#x912D;&#x541B;&#x535A;
db2x_manxml.pl.diff (text/x-diff, 656 B)
Index: db2x_manxml.pl
===================================================================
RCS file: /cvsroot/docbook2x/docbook2X/perl/db2x_manxml.pl,v
retrieving revision 1.15
diff -u -r1.15 db2x_manxml.pl
--- db2x_manxml.pl	22 May 2003 00:03:27 -0000	1.15
+++ db2x_manxml.pl	25 May 2003 15:30:53 -0000
@@ -207,7 +207,14 @@
 sub print
 {
     my ($self, $text) = @_;
+            
+    # "." and "'" get misinterpreted as a request
+    # at beginning of lines, so use a no-width space
+    # to prevent that.
+    $text =~ s/^([.'])/\\\&$1/ if $self->{line_start};
+    
     $self->{fh}->print($text);
+
     $self->{line_start} = ($text =~ /\n$/);
 }