bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: makeinfo 4.0f generates bogus html


From: Eli Zaretskii
Subject: Re: makeinfo 4.0f generates bogus html
Date: Fri, 01 Feb 2002 14:33:09 +0200

> From: Per Bothner <address@hidden>
> Date: Thu, 31 Jan 2002 20:01:21 -0800
> 
> Running makeinfo --html (from texinfo-4.0f), I get files like this:
> 
> <p>
> Node:<a name="Keywords">Keywords</a>,
> Next:<a rel=next href="Procedures.html#Procedures">Procedures</a>,
> Previous:<a rel=previous 
> href="Special-named-constants.html#Special%20named%20constants">Special 
> named constants</a>,
> Up:<a rel=up href="Extensions.html#Extensions">Extensions</a>
> <hr><br>
> 
> <h3>Keywords</h2>
> 
> <p>Keywords are similar to symbols.
> ...
> </body></html>
> 
> Note there is no <html>, no <head>, and no <body>!

Thanks for reporting this.

AFAICS, this never worked in split-HTML mode (I traced as far as
v4.0c, and didn't see any code which would make it work).

Anyway, please try the changes below, which should fix this, and
please tell if the HTML header this produces in the subfiles is good
enough.


2002-02-01  Eli Zaretskii  <address@hidden>

        * makeinfo/node.c (cm_node): Call html_output_head whenever we
        create a new split-HTML file.

        * makeinfo/html.c (html_output_head): Make html_title static.
        Compute it only once, and don't free it.  Output the <h1> title
        header only once per run.


--- makeinfo/node.c~1   Wed Jan 30 20:56:16 2002
+++ makeinfo/node.c     Fri Feb  1 14:07:32 2002
@@ -846,7 +846,11 @@ cm_node ()
             with other nodes or anchors.  If it clashes with an
             anchor, we complain and nuke that anchor's file.  */
          if (!tag)
-           output_stream = fopen (filename, "w");
+           {
+             output_stream = fopen (filename, "w");
+             html_output_head_p = 0; /* so that we generate HTML preamble */
+             html_output_head ();
+           }
          else if ((tag->flags & TAG_FLAG_ANCHOR) != 0)
            {
              line_error (_("Anchor `%s' and node `%s' map to the same file 
name"),
@@ -862,6 +866,8 @@ cm_node ()
              free (tag->html_fname);
              tag->html_fname = NULL;
              output_stream = fopen (filename, "w");
+             html_output_head_p = 0; /* so that we generate HTML preamble */
+             html_output_head ();
            }
          else
            {
--- makeinfo/html.c~0   Sat Jan 19 03:04:56 2002
+++ makeinfo/html.c     Fri Feb  1 14:03:54 2002
@@ -30,14 +30,16 @@ int html_output_head_p = 0;
 void
 html_output_head ()
 {
-  char *html_title;
-  
+  static char *html_title = NULL;
+  static int html_title_written = 0;
+
   if (html_output_head_p)
     return;
   html_output_head_p = 1;
 
   /* The <title> should not have markup, so use text_expansion.  */
-  html_title = title ? text_expansion (title) : _("Untitled");
+  if (!html_title)
+    html_title = title ? text_expansion (title) : _("Untitled");
 
   add_word_args ("<html lang=\"%s\">\n<head>\n<title>%s</title>\n",
                  language_table[language_code].abbrev, html_title);
@@ -47,7 +49,7 @@ html_output_head ()
     add_word_args ("; charset=%s",
                    encoding_table[document_encoding_code].ecname);
   add_word ("\">\n");
-  
+
   if (!document_description)
     document_description = html_title;
 
@@ -57,10 +59,10 @@ html_output_head ()
   add_word ("<link href=\"http://texinfo.org/\"; rel=generator-home>\n");
   add_word ("</head>\n<body>\n");
 
-  if (title)
+  if (title && !html_title_written)
     {
       add_word_args ("<h1>%s</h1>\n", html_title);
-      free (html_title);
+      html_title_written = 1;
     }
 }
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]