texinfo-commits
[Top][All Lists]
Advanced

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

texinfo update (Mon Nov 29 21:22:01 EST 2004)


From: Karl Berry
Subject: texinfo update (Mon Nov 29 21:22:01 EST 2004)
Date: Mon, 29 Nov 2004 21:22:10 -0500

Index: ChangeLog
===================================================================
RCS file: /cvsroot/texinfo/texinfo/ChangeLog,v
retrieving revision 1.416
retrieving revision 1.417
diff -c -r1.416 -r1.417
*** ChangeLog   26 Nov 2004 18:17:36 -0000      1.416
--- ChangeLog   30 Nov 2004 02:03:23 -0000      1.417
***************
*** 1,3 ****
--- 1,18 ----
+ 2004-11-29  Karl Berry  <address@hidden>
+ 
+       Support for writing <a name="..."> using the old-style node name
+               to HTML name conversion, to keep the gcc folks happy.
+       * makeinfo/node.c (add_html_names): new routine, factoring out
+       common code (plus new code) from cm_node.
+       (cm_node) <html>: call it.
+       * makeinfo/makeinfo.h (OLD_HTML_SAFE, OLD_URL_SAFE_CHAR):
+       (re)define these.
+       * makeinfo/html.c (add_escaped_anchor_name): take new argument to
+       optionally output the old-style conversion.
+       (add_anchor_name): change call.
+       * index.c: change calls.
+       * makeinfo/html.h (add_escaped_anchor_name): change decl.
+ 
  2004-11-26  Karl Berry  <address@hidden>
  
        * makeinfo/makeinfo.c (reader_loop): allow <wbr> after &mdash;
Index: NEWS
===================================================================
RCS file: /cvsroot/texinfo/texinfo/NEWS,v
retrieving revision 1.97
retrieving revision 1.98
diff -c -r1.97 -r1.98
*** NEWS        26 Nov 2004 00:48:35 -0000      1.97
--- NEWS        30 Nov 2004 02:03:23 -0000      1.98
***************
*** 1,4 ****
! $Id: NEWS,v 1.97 2004/11/26 00:48:35 karl Exp $
  This file records noteworthy changes.
  
    Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
--- 1,4 ----
! $Id: NEWS,v 1.98 2004/11/30 02:03:23 karl Exp $
  This file records noteworthy changes.
  
    Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
***************
*** 27,32 ****
--- 27,36 ----
    . new command @abbr for general abbreviations.
    . new command @slanted to typeset text in a slanted font,
      and @sansserif to typeset in a sans serif font.
+ * makeinfo:
+   . HTML output: <a name="..."> constructs are added for the old-style
+     conversion of node names to HTML names, so that external references
+     to them can continue to work.
  * texi2dvi:
    . calls recode if installed and @documentencoding is specified.
  * Distribution:
Index: makeinfo/html.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/html.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -c -r1.26 -r1.27
*** makeinfo/html.c     26 Nov 2004 00:48:35 -0000      1.26
--- makeinfo/html.c     30 Nov 2004 02:03:23 -0000      1.27
***************
*** 1,5 ****
  /* html.c -- html-related utilities.
!    $Id: html.c,v 1.26 2004/11/26 00:48:35 karl Exp $
  
     Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software
     Foundation, Inc.
--- 1,5 ----
  /* html.c -- html-related utilities.
!    $Id: html.c,v 1.27 2004/11/30 02:03:23 karl Exp $
  
     Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software
     Foundation, Inc.
***************
*** 591,599 ****
  }
  
  /* Output NAME with characters escaped as appropriate for an anchor
!    name, i.e., escape URL special characters as %<n>.  */
  void
! add_escaped_anchor_name (char *name)
  {
    canon_white (name);
  
--- 591,607 ----
  }
  
  /* Output NAME with characters escaped as appropriate for an anchor
!    name, i.e., escape URL special characters with our _00hh convention
!    if OLD is zero.  (See the manual for details on the new scheme.)
!    
!    If OLD is nonzero, generate the node name with the 4.6-and-earlier
!    convention of %hh (and more special characters output as-is, notably
!    - and *).  This is only so that external references to old names can
!    still work with HTML generated by the new makeinfo; the gcc folks
!    needed this.  Our own HTML does not refer to these names.  */
! 
  void
! add_escaped_anchor_name (char *name, int old)
  {
    canon_white (name);
  
***************
*** 601,623 ****
      {
        if (cr_or_whitespace (*name))
          add_char ('-');
!       else if (! URL_SAFE_CHAR (*name))
          /* Cast so characters with the high bit set are treated as >128,
             for example o-umlaut should be 246, not -10.  */
          add_word_args ("_00%x", (unsigned char) *name);
        else
          add_char (*name);
      }
  }
  
  /* Insert the text for the name of a reference in an HTML anchor
!    appropriate for NODENAME.  If HREF is nonzero, it will be
!    appropriate for a href= attribute, rather than name= i.e., including
!    the `#' if it's an internal reference. */
  void
  add_anchor_name (char *nodename, int href)
  {
!   if (href)
      {
        if (splitting)
        add_url_name (nodename, href);
--- 609,641 ----
      {
        if (cr_or_whitespace (*name))
          add_char ('-');
! 
!       else if (!old && !URL_SAFE_CHAR (*name))
          /* Cast so characters with the high bit set are treated as >128,
             for example o-umlaut should be 246, not -10.  */
          add_word_args ("_00%x", (unsigned char) *name);
+ 
+       else if (old && !URL_SAFE_CHAR (*name) && !OLD_URL_SAFE_CHAR (*name))
+         /* Different output convention, but still cast as above.  */
+         add_word_args ("%%%x", (unsigned char) *name);
+ 
        else
          add_char (*name);
      }
  }
  
  /* Insert the text for the name of a reference in an HTML anchor
!    appropriate for NODENAME.
!    
!    If HREF is zero, generate text for name= in the new node name
!      conversion convention.
!    If HREF is negative, generate text for name= in the old convention.
!    If HREF is positive, generate the name for an href= attribute, i.e.,
!      including the `#' if it's an internal reference.   */
  void
  add_anchor_name (char *nodename, int href)
  {
!   if (href > 0)
      {
        if (splitting)
        add_url_name (nodename, href);
***************
*** 633,639 ****
    else if (strcasecmp (nodename, "top") == 0)
      add_word ("Top");
    else
!     add_escaped_anchor_name (nodename);
  }
  
  /* Insert the text for the name of a reference in an HTML url, aprropriate
--- 651,657 ----
    else if (strcasecmp (nodename, "top") == 0)
      add_word ("Top");
    else
!     add_escaped_anchor_name (nodename, href < 0);
  }
  
  /* Insert the text for the name of a reference in an HTML url, aprropriate
Index: makeinfo/html.h
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/html.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -c -r1.5 -r1.6
*** makeinfo/html.h     11 Apr 2004 17:56:47 -0000      1.5
--- makeinfo/html.h     30 Nov 2004 02:03:23 -0000      1.6
***************
*** 1,5 ****
  /* html.h -- declarations for html-related utilities.
!    $Id: html.h,v 1.5 2004/04/11 17:56:47 karl Exp $
  
     Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
  
--- 1,5 ----
  /* html.h -- declarations for html-related utilities.
!    $Id: html.h,v 1.6 2004/11/30 02:03:23 karl Exp $
  
     Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
  
***************
*** 46,53 ****
  /* Output HTML <link> to NODE, plus extra ATTRIBUTES.  */
  extern void add_link (char *nodename, char *attributes);
  
! /* Escape URL-special characters as %xy.  */
! extern void add_escaped_anchor_name (char *name);
  
  /* See html.c.  */
  extern void add_anchor_name (char *nodename, int href);
--- 46,53 ----
  /* Output HTML <link> to NODE, plus extra ATTRIBUTES.  */
  extern void add_link (char *nodename, char *attributes);
  
! /* Escape URL-special characters.  */
! extern void add_escaped_anchor_name (char *name, int old);
  
  /* See html.c.  */
  extern void add_anchor_name (char *nodename, int href);
Index: makeinfo/index.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/index.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -c -r1.16 -r1.17
*** makeinfo/index.c    30 Aug 2004 22:11:39 -0000      1.16
--- makeinfo/index.c    30 Nov 2004 02:03:23 -0000      1.17
***************
*** 1,5 ****
  /* index.c -- indexing for Texinfo.
!    $Id: index.c,v 1.16 2004/08/30 22:11:39 karl Exp $
  
     Copyright (C) 1998, 1999, 2002, 2003, 2004 Free Software Foundation,
     Inc.
--- 1,5 ----
  /* index.c -- indexing for Texinfo.
!    $Id: index.c,v 1.17 2004/11/30 02:03:23 karl Exp $
  
     Copyright (C) 1998, 1999, 2002, 2003, 2004 Free Software Foundation,
     Inc.
***************
*** 247,253 ****
              removed_empty_elt = 2;
  
            add_word ("<a name=\"index-");
!           add_escaped_anchor_name (index_entry);
            add_word_args ("-%d\"></a>", index_counter);
  
            if (removed_empty_elt == 1)
--- 247,253 ----
              removed_empty_elt = 2;
  
            add_word ("<a name=\"index-");
!           add_escaped_anchor_name (index_entry, 0);
            add_word_args ("-%d\"></a>", index_counter);
  
            if (removed_empty_elt == 1)
***************
*** 836,842 ****
  
                add_html_block_elt_args ("\n<li><a href=\"%s#index-",
                    (splitting && index->output_file) ? index->output_file : 
"");
!               add_escaped_anchor_name (index->entry_text);
                add_word_args ("-%d\">%s</a>: ", index->entry_number,
                    html_entry);
                free (html_entry);
--- 836,842 ----
  
                add_html_block_elt_args ("\n<li><a href=\"%s#index-",
                    (splitting && index->output_file) ? index->output_file : 
"");
!               add_escaped_anchor_name (index->entry_text, 0);
                add_word_args ("-%d\">%s</a>: ", index->entry_number,
                    html_entry);
                free (html_entry);
Index: makeinfo/makeinfo.h
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/makeinfo.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -c -r1.16 -r1.17
*** makeinfo/makeinfo.h 11 Nov 2004 18:34:28 -0000      1.16
--- makeinfo/makeinfo.h 30 Nov 2004 02:03:23 -0000      1.17
***************
*** 1,5 ****
  /* makeinfo.h -- declarations for Makeinfo.
!    $Id: makeinfo.h,v 1.16 2004/11/11 18:34:28 karl Exp $
  
     Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free
     Software Foundation, Inc.
--- 1,5 ----
  /* makeinfo.h -- declarations for Makeinfo.
!    $Id: makeinfo.h,v 1.17 2004/11/30 02:03:23 karl Exp $
  
     Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free
     Software Foundation, Inc.
***************
*** 269,276 ****
  #define digit_value(c) ((c) - '0')
  #endif
  
! /* #define HTML_SAFE "$-_.+!*'()" */
! /* #define URL_SAFE_CHAR(ch) (isalnum (ch) || strchr (HTML_SAFE, ch)) */
  #define URL_SAFE_CHAR(ch) (isalnum (ch))
  
  #define COMMAND_PREFIX '@'
--- 269,283 ----
  #define digit_value(c) ((c) - '0')
  #endif
  
! /* These characters are not really HTML-safe (with strict XHTML),
!    and also there are possible collisions.  That's the whole reason we
!    designed a new conversion scheme in the first place.  But we
!    nevertheless need to generate the old names.  See
!    `add_escaped_anchor_name' in html.c.  */
! #define OLD_HTML_SAFE "$-_.+!*'()"
! #define OLD_URL_SAFE_CHAR(ch) (strchr (OLD_HTML_SAFE, ch))
! 
! /* For the current/stable scheme.  */
  #define URL_SAFE_CHAR(ch) (isalnum (ch))
  
  #define COMMAND_PREFIX '@'
Index: makeinfo/node.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/node.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -c -r1.23 -r1.24
*** makeinfo/node.c     18 Oct 2004 01:04:27 -0000      1.23
--- makeinfo/node.c     30 Nov 2004 02:03:23 -0000      1.24
***************
*** 1,5 ****
  /* node.c -- nodes for Texinfo.
!    $Id: node.c,v 1.23 2004/10/18 01:04:27 karl Exp $
  
     Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
     Foundation, Inc.
--- 1,5 ----
  /* node.c -- nodes for Texinfo.
!    $Id: node.c,v 1.24 2004/11/30 02:03:23 karl Exp $
  
     Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
     Foundation, Inc.
***************
*** 482,487 ****
--- 482,533 ----
    current_output_filename = xstrdup (fname);
  }
  
+ 
+ /* Output the <a name="..."></a> constructs for NODE.  We output both
+    the new-style conversion and the old-style, if they are different.
+    See comments at `add_escaped_anchor_name' in html.c.  */
+ 
+ static void
+ add_html_names (char *node)
+ {
+   char *tem = expand_node_name (node);
+   char *otem = xstrdup (tem);
+ 
+   /* Determine if the old and new schemes come up with different names;
+      only output the old scheme if that is so.  We don't want to output
+      the same name twice.  */
+   canon_white (otem);
+   {
+     char *optr = otem;
+     int need_old = 0;
+     
+     for (; *optr; optr++)
+       {
+         if (!cr_or_whitespace (*optr) && !URL_SAFE_CHAR (*optr))
+           {
+             need_old = 1;
+             break;
+           }
+       }
+     
+     if (need_old)
+       {
+         add_word ("<a name=\"");
+         add_anchor_name (otem, -1);  /* old anchor name conversion */
+         add_word ("\"></a>\n");
+       }
+     free (otem);
+   }
+ 
+   /* Always output the new scheme.  */
+   add_word ("<a name=\"");
+   add_anchor_name (tem, 0);
+   add_word ("\"></a>\n");
+ 
+   free (tem);
+ }
+ 
+ 
  /* The order is: nodename, nextnode, prevnode, upnode.
     If all of the NEXT, PREV, and UP fields are empty, they are defaulted.
     You must follow a node command which has those fields defaulted
***************
*** 922,933 ****
          }
  
        if (!splitting && no_headers)
!       { /* cross refs need a name="#anchor" even if we're not writing 
headers*/
!           add_word ("<a name=\"");
!           tem = expand_node_name (node);
!           add_anchor_name (tem, 0);
!           add_word ("\"></a>");
!           free (tem);
        }
  
        if (splitting || !no_headers)
--- 968,975 ----
          }
  
        if (!splitting && no_headers)
!       { /* cross refs need a name="#anchor" even if not writing headers */ 
!           add_html_names (node);
        }
  
        if (splitting || !no_headers)
***************
*** 935,945 ****
            add_html_block_elt ("<div class=\"node\">\n");
            /* The <p> avoids the links area running on with old Lynxen. */
            add_word_args ("<p>%s\n", splitting ? "" : "<hr>");
!           add_word ("<a name=\"");
!           tem = expand_node_name (node);
!           add_anchor_name (tem, 0);
!           free (tem);
!           add_word ("\"></a>");
  
            if (next)
              {
--- 977,983 ----
            add_html_block_elt ("<div class=\"node\">\n");
            /* The <p> avoids the links area running on with old Lynxen. */
            add_word_args ("<p>%s\n", splitting ? "" : "<hr>");
!           add_html_names (node);
  
            if (next)
              {
P ChangeLog
P NEWS
P makeinfo/html.c
P makeinfo/html.h
P makeinfo/index.c
P makeinfo/makeinfo.h
P makeinfo/node.c


reply via email to

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