projects/guix·blob javascript-team · refs

91 lines · 3.3 KiB

1# Source: <https://sources.debian.org/patches/docbook2x/0.8.8-18/04_fix_442782_preprocessor_declaration_syntax.patch/>
2
3## 04_fix_442782_preprocessor_declaration_syntax.dpatch by Colin Watson <[email protected]>.
4##
5## All lines beginning with `## DP:' are a description of the patch.
6## DP: Conventionally, preprocessor declarations should start with
7## DP: '\"
8## DP: rather than
9## DP: .\"
10## DP: Current man-db only supports the first (and recommended) syntax. So
11## DP: Colin Watson provided this patch to fix docbook2x.
12## DP:
13## DP: <URL:http://bugs.debian.org/442782>
14## DP: <URL:http://lists.gnu.org/archive/html/groff/2007-11/msg00023.html>
15
16Edit by Bruno Victal <[email protected]>:
17 Removed dpatch lines.
18
19--- trunk~/perl/db2x_manxml.pl 2006-04-22 17:21:32.000000000 +0200
20+++ trunk/perl/db2x_manxml.pl 2007-11-24 01:27:37.000000000 +0100
21@@ -342,6 +342,25 @@
22 $self->{line_start} = 1;
23 }
24
25+#
26+# Print a comment in the output, without causing a break.
27+# Params: comment - the comment text.
28+# May use any characters; they need not be escaped.
29+#
30+sub comment_nobreak
31+{
32+ my ($self, $comment) = @_;
33+ $self->write("\n") unless $self->{line_start};
34+
35+ foreach my $line (split(/\n/, $comment)) {
36+ $self->write('\'\" ');
37+ $self->write($line);
38+ $self->write("\n");
39+ }
40+
41+ $self->{line_start} = 1;
42+}
43+
44
45 #
46 # Use a roff "escape" i.e. commands embedded in text starting with \
47@@ -510,16 +529,20 @@
48
49 $self->{'adjust-stack'} = [ 'b' ];
50
51- $self->{rw}->comment($elem->attr('preprocessors'))
52- if($elem->attr('preprocessors') ne '');
53-
54+ my $preprocessors = $elem->attr('preprocessors');
55 # I've dug through the Internet to see if there was any
56 # standard way to specify encoding with man pages.
57 # The following seems to be a reasonable proposal:
58 # <URL:http://mail.nl.linux.org/linux-utf8/2001-04/msg00168.html>
59 my $encoding = $self->{options}->{'encoding'};
60 $encoding =~ s#//TRANSLIT$##i;
61- $self->{rw}->comment("-*- coding: $encoding -*-");
62+ $encoding = "-*- coding: $encoding -*-";
63+ if ($preprocessors eq '') {
64+ $preprocessors = $encoding;
65+ } else {
66+ $preprocessors = "$preprocessors $encoding";
67+ }
68+ $self->{rw}->comment_nobreak($preprocessors);
69
70 # Define escapes for switching to and from monospace fonts (groff only)
71 $self->{rw}->request(qw{ .if \n(.g .ds T< \\\\FC});
72--- trunk~/xslt/backend/db2x_manxml.xsl 2006-04-23 16:44:52.000000000 +0200
73+++ trunk/xslt/backend/db2x_manxml.xsl 2007-11-24 01:27:37.000000000 +0100
74@@ -528,7 +528,7 @@
75 <exslt:document method="text"
76 encoding="{$encoding}"
77 href="{$path}">
78- <xsl:text>.\" -*- coding: </xsl:text>
79+ <xsl:text>'\" -*- coding: </xsl:text>
80 <xsl:value-of select="$encoding" />
81 <xsl:text> -*-&#10;</xsl:text>
82 <xsl:copy-of select="$content" />
83@@ -538,7 +538,7 @@
84 <saxon:output method="text"
85 encoding="{$encoding}"
86 href="{$path}">
87- <xsl:text>.\" -*- coding: </xsl:text>
88+ <xsl:text>'\" -*- coding: </xsl:text>
89 <xsl:value-of select="$encoding" />
90 <xsl:text> -*-&#10;</xsl:text>
91 <xsl:copy-of select="$content" />