On Mon, Jul 31, 2006 at 02:25:27PM +0200, Sven Hoexter wrote:
> notforwarded 193792
> retitle 193792 linuxdoc stops processing <sect[1-x]> at the end of line
> reassign 193792 linuxdoc-tools
> thanks
> 
> Hi,
> linuxdoc stops the processing of <sect[1-x]> at the end of the line
> without checking if there is something following in the next line.
> It also ignores the explicit use of </sect1> end tags.
> This results in a broken TOC.
> 
> You can find a discussion about this bug in the LyX bugzilla:
> http://bugzilla.lyx.org/show_bug.cgi?id=2722

This was one of the historical nasty bugs I had when maintaining the
spanish TeX FAQ (still linuxdoc). I have looked at linuxdoc-tools in debug
mode with file

-------------------------- test-longlines.sgml ---------------------------
<!doctype linuxdoc system>
<article>
<title>TITLE</title>
<author>AUTHOR</author>
<date>DATE</date>
<abstract>ABSTRACT</abstract>
<toc>
<sect>First Section
<sect1>Just added a new long subsection to the template to show where
the html translator stops too soon. \n is put here to see if it is skipped by 
the fix.
</article>
------------------------------ End of file -------------------------------

and noticed that nsgmls output for the relevant line looks like

(HEADING
-Just added a new long subsection to the template to show where\nthe html
translator stops too soon. \\n is put here to see if it is skipped by the
fix.
)HEADING

with everything not HEADING in one line. Note the spurious \n that confuses
html creation.

I have prepared a possible NMU that modifies fmt_html.pl so that
$html->{preASP} takes care of that for \n not part of \\n. I also compacted
that function and added more error generation info to nsmls call from
LinuxDocTools.pm. It also adds texlive alternative dependencies. Everything
seems to work well at my site, but further testing is of course welcome.

I have put packages at

  http://corbu.aq.upm.es/~agmartin/linux/store/debian-linuxdoc-tools/

and sarge backports at

  http://people.debian.org/~agmartin/debian-store/misc/

(sources at sources subdir)

Patch is attached,

-- 
Agustin
diff -Nru /tmp/rzX52jLN4Y/linuxdoc-tools-0.9.21/debian/changelog 
/tmp/qDr0llVnx8/linuxdoc-tools-0.9.21/debian/changelog
--- /tmp/rzX52jLN4Y/linuxdoc-tools-0.9.21/debian/changelog      2006-05-10 
15:33:03.000000000 +0200
+++ /tmp/qDr0llVnx8/linuxdoc-tools-0.9.21/debian/changelog      2006-11-15 
12:46:08.000000000 +0100
@@ -1,3 +1,17 @@
+linuxdoc-tools (0.9.21-0.5) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * lib/dist/fmt_html.pl:
+    - Make sure multiline sect names are correctly treated
+      in $html->{preASP} (closes: #193792).
+    - Minor simplifications in $html->{preASP}.
+  * lib/LinuxDocTools.pm:
+    - Signal error and provide more info if system call fails.
+  * debian/control:
+    - Add texlive alternative TeX dependencies closes: #381468)
+
+ -- Agustin Martin Domingo <[EMAIL PROTECTED]>  Wed, 15 Nov 2006 12:45:35 +0100
+
 linuxdoc-tools (0.9.21-0.4) unstable; urgency=low
 
   * Non-maintainer upload.
diff -Nru /tmp/rzX52jLN4Y/linuxdoc-tools-0.9.21/debian/control 
/tmp/qDr0llVnx8/linuxdoc-tools-0.9.21/debian/control
--- /tmp/rzX52jLN4Y/linuxdoc-tools-0.9.21/debian/control        2006-05-10 
12:39:35.000000000 +0200
+++ /tmp/qDr0llVnx8/linuxdoc-tools-0.9.21/debian/control        2006-11-15 
12:46:08.000000000 +0100
@@ -61,7 +61,7 @@
 
 Package: linuxdoc-tools-latex
 Architecture: all
-Depends: linuxdoc-tools, tetex-base, tetex-bin, tetex-extra
+Depends: linuxdoc-tools, tetex-base | texlive-latex-base, tetex-bin | 
texlive-base-bin, tetex-extra | texlive-latex-recommended
 Conflicts: linuxdoc-tools (<< 0.9.20)
 Description: LaTeX/PS/PDF output facility of LinuxDoc-Tools
  LinuxDoc-Tools is a SGML converter for the LinuxDoc DTD only.
diff -Nru /tmp/rzX52jLN4Y/linuxdoc-tools-0.9.21/lib/dist/fmt_html.pl 
/tmp/qDr0llVnx8/linuxdoc-tools-0.9.21/lib/dist/fmt_html.pl
--- /tmp/rzX52jLN4Y/linuxdoc-tools-0.9.21/lib/dist/fmt_html.pl  2001-05-24 
17:57:40.000000000 +0200
+++ /tmp/qDr0llVnx8/linuxdoc-tools-0.9.21/lib/dist/fmt_html.pl  2006-11-15 
12:46:14.000000000 +0100
@@ -64,39 +64,37 @@
 #
 #  Translate character entities and escape HTML special chars.
 #
-$html->{preASP} = sub
-{
-  my ($infile, $outfile) = @_;
-  # note the conversion of `sdata_dirs' list to an anonymous array to
-  # make a single argument
-  my $char_maps = load_char_maps ('.2html', [ Text::EntityMap::sdata_dirs() ]);
-
-  while (<$infile>)
-    {
-      if (/^-/)
-        {
-           my ($str) = $';
-           chop ($str);
-           print $outfile "-" . parse_data ($str, $char_maps, $html_escape) . 
"\n";
-        }
-      elsif (/^A/)
-        {
-         /^A(\S+) (IMPLIED|CDATA|NOTATION|ENTITY|TOKEN)( (.*))?$/
-             || die "bad attribute data: $_\n";
-         my ($name,$type,$value) = ($1,$2,$4);
-         if ($type eq "CDATA")
-           {
-             # CDATA attributes get translated also
-             $value = parse_data ($value, $char_maps, $html_escape);
+$html->{preASP} = sub {
+    my ($infile, $outfile) = @_;
+    my $inheading = '';
+    # note the conversion of `sdata_dirs' list to an anonymous array to
+    # make a single argument
+    my $char_maps = load_char_maps ('.2html', [ Text::EntityMap::sdata_dirs() 
]);
+    
+    while (<$infile>){
+       if (s/^-//){
+           chomp;
+           s/([^\\])\\n/$1 /g if $inheading;      # Remove spurious \n in 
headings
+           print $outfile "-" . parse_data ($_, $char_maps, $html_escape) . 
"\n";
+        } elsif (/^A/){
+           /^A(\S+) (IMPLIED|CDATA|NOTATION|ENTITY|TOKEN)( (.*))?$/
+               || die "bad attribute data: $_\n";
+           my ($name,$type,$value) = ($1,$2,$4);
+           if ($type eq "CDATA"){
+               # CDATA attributes get translated also
+               $value = parse_data ($value, $char_maps, $html_escape);
            }
-         print $outfile "A$name $type $value\n";
-        }
-      else
-        {
-         print $outfile $_;
+           print $outfile "A$name $type $value\n";
+       } else {
+           if (/^\(HEADING/){
+               $inheading = 1;
+           } elsif (/^\)HEADING/){
+               $inheading = '';
+           }       
+           print $outfile $_;
         }
     }
-  return 0;
+    return 0;
 };
 
 #
diff -Nru /tmp/rzX52jLN4Y/linuxdoc-tools-0.9.21/lib/LinuxDocTools.pm 
/tmp/qDr0llVnx8/linuxdoc-tools-0.9.21/lib/LinuxDocTools.pm
--- /tmp/rzX52jLN4Y/linuxdoc-tools-0.9.21/lib/LinuxDocTools.pm  2006-05-10 
14:09:17.000000000 +0200
+++ /tmp/qDr0llVnx8/linuxdoc-tools-0.9.21/lib/LinuxDocTools.pm  2006-11-15 
12:46:11.000000000 +0100
@@ -607,8 +607,12 @@
     }
 
   create_temp("$tmpbase.3");
-  system ("$main::progs->{SGMLSASP} $style $mapping <\"$tmpbase.2\" |
-      expand -$global->{tabsize} >\"$tmpbase.3\"");
+  {
+      my $mycommand = "$main::progs->{SGMLSASP} $style $mapping 
<\"$tmpbase.2\" |
+      expand -$global->{tabsize} >\"$tmpbase.3\"";
+      system ($mycommand) == 0
+         or die "Error running $mycommand\n";
+  }
   ! -e "$tmpbase.3" and die "can't create file - exiting";
 
 

Reply via email to