--- texi2html.pl.orig	2006-05-21 16:16:05.000000000 +0200
+++ texi2html.pl	2008-12-11 13:33:00.000000000 +0100
@@ -58,7 +58,7 @@
 #--##############################################################################
 
 # CVS version:
-# $Id: texi2html.patch 31722 2008-12-11 12:34:07Z res2002 $
+# $Id: texi2html.patch 31722 2008-12-11 12:34:07Z res2002 $
 
 # Homepage:
 my $T2H_HOMEPAGE = "http://texi2html.cvshome.org/";
@@ -259,6 +259,10 @@
 $MENU_SYMBOL
 $OPEN_QUOTE_SYMBOL
 $CLOSE_QUOTE_SYMBOL
+$OPEN_DOUBLE_QUOTE_SYMBOL
+$CLOSE_DOUBLE_QUOTE_SYMBOL
+$DASH_EN
+$DASH_EM
 $TOC_LIST_STYLE
 $TOC_LIST_ATTRIBUTE
 $TOP_NODE_FILE
@@ -618,9 +622,10 @@
 sub t2h_gpl_normal_text($)
 {
     my $text = shift;
-    $text =~ s/``/"/go;
-    $text =~ s/''/"/go;
-    $text =~ s/-(--?)/$1/go;
+    $text =~ s/``/$OPEN_DOUBLE_QUOTE_SYMBOL/go;
+    $text =~ s/''/$CLOSE_DOUBLE_QUOTE_SYMBOL/go;
+    $text =~ s/---/$DASH_EM/go;
+    $text =~ s/--/$DASH_EN/go;
     return $text;
 }
 # @INIT@
@@ -3680,6 +3685,7 @@
                             $node_ref->{'current_place'} = [];
                             merge_element_before_anything($node_ref);
                             $node_ref->{'index_names'} = [];
+                            $node_ref->{'counter'} = 0;
                             $state->{'place'} = $node_ref->{'current_place'};
                             $state->{'element'} = $node_ref;
                             $state->{'after_element'} = 1;
@@ -3742,7 +3748,16 @@
                         {
                             $sec_num++;
                             $num = $sec_num;
-                            $docid = "SEC$sec_num";
+                            if ($Texi2HTML::Config::NODE_FILES)
+                            {
+                              $docid = $state->{'node_ref'}->{'counter'};
+                              $state->{'node_ref'}->{'counter'}++;
+			    }
+			    else
+			    {
+                              $docid = "SEC$sec_num";
+                              $num = $state->{'node_ref'}->{'counter'};
+			    }
                         }
                         else
                         {
@@ -4407,17 +4422,16 @@
                 {
                     $section->{'number'} = $number;
                 }    
-		$section->{'id'} = $section->{'number'};
                 $level--;
             }
             my $toplevel_number = $previous_numbers[$toplevel];
             $toplevel_number = 0 if (!defined($toplevel_number));
             $section->{'number'} = "$toplevel_number.$section->{'number'}";
-	    $section->{'id'} = $section->{'number'};
+	    $section->{'id'} = $section->{'number'} unless $Texi2HTML::Config::NODE_FILES;
         }
 	else
 	{
-	    $section->{'id'} = $section->{'texi'};
+	    $section->{'id'} = $section->{'texi'} unless $Texi2HTML::Config::NODE_FILES;
 	}
         # find the previous section
         if (defined($previous_sections[$section->{'level'}]))
@@ -5105,7 +5119,8 @@
                              'nodeprev' => $back,
                              'place' => [],
                              'seen' => 1,
-                             'page' => $page
+                             'page' => $page,
+                             'file' => "${docu_name}_index$index_num.$docu_ext"
                             };
                             $index_page->{'node'} = 1 if ($element->{'node'});
                             while ($nodes{$index_page->{'texi'}})
@@ -7616,6 +7631,11 @@
     my $text = shift;
     my $state = shift;
     return $text if ($state->{'keep_texi'});
+    # Protect first to allow normal_text to emit entities
+    if (!$state->{'no_protection'})
+    {
+        $text = &$Texi2HTML::Config::protect_text($text);
+    }
     if (defined($state) and !$state->{'preformatted'} and !$state->{'code_style'})
     {
         # in normal text `` and '' serve as quotes, --- is for a long dash 
@@ -7623,11 +7643,7 @@
         # (see texinfo.txi, @node Conventions)
         $text = &$Texi2HTML::Config::normal_text($text);
     }
-    if ($state->{'no_protection'})
-    {
-        return $text;
-    }
-    return &$Texi2HTML::Config::protect_text($text);
+    return $text;
 }
 
 sub end_simple_format($$)
