docbook2X-0.8.8-preprocessor_declaration_syntax.patch 3.3 KB

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