texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/makeinfo cmds.c,1.21,1.22 html.c,1.9,1.10 html.h,1.1.1.1,1.2


From: dirt
Subject: texinfo/makeinfo cmds.c,1.21,1.22 html.c,1.9,1.10 html.h,1.1.1.1,1.2
Date: Sat, 17 Jan 2004 12:03:56 +0100

Update of /cvsroot/texinfo/texinfo/makeinfo
In directory sheep:/tmp/cvs-serv4193/makeinfo

Modified Files:
        cmds.c html.c html.h 
Log Message:
2004-01-17  Alper Ersoy  <address@hidden>

        * makeinfo/html.c (insert_html_tag_with_attribute): new function.
        (insert_html_tag): only call insert_html_tag_with_attribute with
        NULL attribute string and return.
        (push_tag, pop_tag): keep the element attributes in stack too.
        (html_output_head): fixed span.roman in the default CSS.

        * makeinfo/html.h: new attribs member in hstack struct.

        * makeinfo/cmds.c (cm_dmn, cm_code, cm_sc, cm_r): use
        insert_html_tag_with_attribute for setting element class.



Index: cmds.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/cmds.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** cmds.c      13 Jan 2004 19:55:07 -0000      1.21
--- cmds.c      17 Jan 2004 11:03:54 -0000      1.22
***************
*** 532,544 ****
  {
    if (html)
!     {
!       insert_html_tag (arg, "span");
! 
!       if (arg == START)
!         {
!           output_paragraph_offset--;
!           insert_string (" class=\"dmn\">");
!         }
!     }
    else if (docbook)
      /* No units in docbook yet.  */
--- 532,536 ----
  {
    if (html)
!     insert_html_tag_with_attribute (arg, "span", "class=\"dmn\"");
    else if (docbook)
      /* No units in docbook yet.  */
***************
*** 831,846 ****
          insert_html_tag (arg, "code");
        else
!         insert_html_tag (arg, "span");
! 
!       /* We overwrite the closing '>' with the class attribute.  */
!       if (arg == START)
!         {
!           extern int in_html_elt;
! 
!           output_paragraph_offset--;
!           in_html_elt++;
!           add_word_args (" class=\"%s\">", command);
!           in_html_elt--;
!         }
      }
    else
--- 823,827 ----
          insert_html_tag (arg, "code");
        else
!         insert_html_tag_with_attribute (arg, "span", "class=\"%s\"", command);
      }
    else
***************
*** 959,968 ****
          {
            if (html)
!             {
!               insert_html_tag (arg, "span");
!               /* Rollback closing > char.  */
!               output_paragraph_offset--;
!               insert_string (" class=\"sc\">");
!             }
          }
        else
--- 940,944 ----
          {
            if (html)
!             insert_html_tag_with_attribute (arg, "span", "class=\"sc\"");
          }
        else
***************
*** 1199,1212 ****
      xml_insert_element (R, arg);
    else if (html)
!     {
!       insert_html_tag (arg, "span");
! 
!       /* We overwrite the closing '>' with the class attribute.  */
!       if (arg == START)
!         {
!           output_paragraph_offset--;
!           insert_string (" class=\"roman\">");
!         }
!     }
    else
      not_fixed_width (arg);
--- 1175,1179 ----
      xml_insert_element (R, arg);
    else if (html)
!     insert_html_tag_with_attribute (arg, "span", "class=\"roman\"");
    else
      not_fixed_width (arg);

Index: html.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/html.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** html.c      13 Jan 2004 23:37:13 -0000      1.9
--- html.c      17 Jan 2004 11:03:54 -0000      1.10
***************
*** 155,159 ****
      /* Roman font class.  */
  #define CSS_FONT_ROMAN "font-family: serif; font-weight: normal;"
!     add_word ("  span.roman { %s } \n", CSS_FONT_ROMAN);
  
      /* Write out any css code from the user's --css-file.  */
--- 155,159 ----
      /* Roman font class.  */
  #define CSS_FONT_ROMAN "font-family: serif; font-weight: normal;"
!     add_word_args ("  span.roman { %s } \n", CSS_FONT_ROMAN);
  
      /* Write out any css code from the user's --css-file.  */
***************
*** 397,406 ****
  /* Save current tag.  */
  void
! push_tag (tag)
       char *tag;
  {
    HSTACK *newstack = xmalloc (sizeof (HSTACK));
  
    newstack->tag = tag;
    newstack->next = htmlstack;
    htmlstack = newstack;
--- 397,408 ----
  /* Save current tag.  */
  void
! push_tag (tag, attribs)
       char *tag;
+      char *attribs;
  {
    HSTACK *newstack = xmalloc (sizeof (HSTACK));
  
    newstack->tag = tag;
+   newstack->attribs = xstrdup (attribs);
    newstack->next = htmlstack;
    htmlstack = newstack;
***************
*** 419,422 ****
--- 421,426 ----
      }
  
+   free (htmlstack->attribs);
+ 
    htmlstack = htmlstack->next;
    free (tos);
***************
*** 485,493 ****
  /* Open or close TAG according to START_OR_END. */
  void
! insert_html_tag (start_or_end, tag)
!      int start_or_end;
!      char *tag;
  {
    char *old_tag = NULL;
    int do_return = 0;
    extern int in_html_elt;
--- 489,505 ----
  /* Open or close TAG according to START_OR_END. */
  void
! #if defined (VA_FPRINTF) && __STDC__
! insert_html_tag_with_attribute (int start_or_end, char *tag, char *format, 
...)
! #else
! insert_html_tag_with_attribute (elt, arg, format, va_alist)
!      int arg;
!      char *elt;
!      char *format;
!      va_dcl
! #endif
  {
    char *old_tag = NULL;
+   char *old_attribs = NULL;
+   char formatted_attribs[2000]; /* xx no fixed limits */
    int do_return = 0;
    extern int in_html_elt;
***************
*** 497,509 ****
  
    if (htmlstack)
!     old_tag = htmlstack->tag;
  
    if (htmlstack
        && STREQ (htmlstack->tag, tag)
!       && !STREQ (tag, "span"))
      do_return = 1;
  
    if (start_or_end == START)
!     push_tag (tag);
  
    if (do_return)
--- 509,542 ----
  
    if (htmlstack)
!     {
!       old_tag = htmlstack->tag;
!       old_attribs = htmlstack->attribs;
!     }
!   
!   if (format)
!     {
! #ifdef VA_SPRINTF
!       va_list ap;
! #endif
! 
!       VA_START (ap, format);
! #ifdef VA_SPRINTF
!       VA_SPRINTF (formatted_attribs, format, ap);
! #else
!       sprintf (formatted_attribs, format, a1, a2, a3, a4, a5, a6, a7, a8);
! #endif
!       va_end (ap);
!     }
!   else
!     formatted_attribs[0] = '\0';
  
+   /* Exception: can nest multiple spans.  */
    if (htmlstack
        && STREQ (htmlstack->tag, tag)
!       && !(STREQ (tag, "span") && STREQ (old_attribs, formatted_attribs)))
      do_return = 1;
  
    if (start_or_end == START)
!     push_tag (tag, formatted_attribs);
  
    if (do_return)
***************
*** 520,524 ****
    if (*tag)
      if (start_or_end == START)
!       add_word_args ("<%s>", tag);
      else if (!rollback_empty_tag (tag))
        /* Insert close tag only if we didn't rollback,
--- 553,557 ----
    if (*tag)
      if (start_or_end == START)
!       add_word_args (format ? "<%s %s>" : "<%s>", tag, formatted_attribs);
      else if (!rollback_empty_tag (tag))
        /* Insert close tag only if we didn't rollback,
***************
*** 527,536 ****
  
    if ((start_or_end != START) && old_tag && *old_tag)
!     add_word_args ("<%s>", old_tag);
  
    in_html_elt--;
  }
  
! 
  
  /* Output an HTML <link> to the filename for NODE, including the
--- 560,576 ----
  
    if ((start_or_end != START) && old_tag && *old_tag)
!     add_word_args (strlen (old_attribs) > 0 ? "<%s %s>" : "<%s>",
!         old_tag, old_attribs);
  
    in_html_elt--;
  }
  
! void
! insert_html_tag (start_or_end, tag)
!      int start_or_end;
!      char *tag;
! {
!   insert_html_tag_with_attribute (start_or_end, tag, NULL);
! }
  
  /* Output an HTML <link> to the filename for NODE, including the

Index: html.h
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/html.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** html.h      6 Dec 2003 01:33:30 -0000       1.1.1.1
--- html.h      17 Jan 2004 11:03:54 -0000      1.2
***************
*** 26,29 ****
--- 26,30 ----
    struct hstack *next;
    char *tag;
+   char *attribs;
  } HSTACK;
  



reply via email to

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