texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/makeinfo html.c,1.14,1.15 xref.c,1.8,1.9 makeinfo.h,1.7,1.8


From: dirt
Subject: texinfo/makeinfo html.c,1.14,1.15 xref.c,1.8,1.9 makeinfo.h,1.7,1.8
Date: Wed, 10 Mar 2004 23:34:23 +0100

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

Modified Files:
        html.c xref.c makeinfo.h 
Log Message:
2004-03-11  Alper Ersoy  <address@hidden>

        * makeinfo/makeinfo.h: changed URL_SAFE_CHAR to isalnum.

        * makeinfo/html.c (add_escaped_anchor_name, add_anchor_name)
        (fix_filename): generate links following html cross refs proposal
        from Patrice Dumas.

        * makeinfo/xref.c (cm_xref): tweaked references to external manuals,
        to better follow html cross refs proposal.



Index: html.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/html.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** html.c      28 Feb 2004 12:46:50 -0000      1.14
--- html.c      10 Mar 2004 22:34:21 -0000      1.15
***************
*** 585,596 ****
  add_escaped_anchor_name (char *name)
  {
    for (; *name; name++)
      {
!       if (*name == '&')
!         add_word ("&amp;");
        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 ("%%%x", (unsigned char) *name);
        else
          add_char (*name);
--- 585,600 ----
  add_escaped_anchor_name (char *name)
  {
+   canon_white (name);
+ 
    for (; *name; name++)
      {
!       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 if (*name == '&')
!         add_word ("&amp;");
        else
          add_char (*name);
***************
*** 618,621 ****
--- 622,627 ----
      /* Strip the parens, but keep the original letter-case.  */
      add_word_args ("%.3s", nodename + 1);
+   else if (strcasecmp (nodename, "top") == 0)
+     add_word ("Top");
    else
      add_escaped_anchor_name (nodename);
***************
*** 630,650 ****
  }
  
! /* Only allow [-0-9a-zA-Z_.] when nodifying filenames.  This may
!    result in filename clashes; e.g.,
! 
!    @node Foo ],,,
!    @node Foo [,,,
! 
!    both map to Foo--.html.  If that happens, cm_node will put all
!    the nodes whose file names clash on the same file.  */
  static void
  fix_filename (char *filename)
  {
!   char *p;
!   for (p = filename; *p; p++)
      {
!       if (!(isalnum (*p) || strchr ("-._", *p)))
!       *p = '-';
      }
  }
  
--- 636,681 ----
  }
  
! /* Convert non [A-Za-z0-9] to _00xx, where xx means the hexadecimal
!    representation of the ASCII character.  Also convert spaces and
!    newlines to dashes.  */
  static void
  fix_filename (char *filename)
  {
!   int i;
!   int len = strlen (filename);
!   char *oldname = xstrdup (filename);
! 
!   {
!     /* Determine the size needed for the fixed name.  */
!     int size = 0;
!     for (i = 0; i < len; i++)
!       {
!         /* Add 5 for non [A-Za-z0-9] (``_00xx'').  */
!         if (!isalnum (filename[i]))
!           size += 5;
!         else
!           size++;
!       }
! 
!     filename = (char *) xrealloc (filename, (size + 1) * sizeof (char));
!     filename[0] = 0;
!   }
! 
!   for (i = 0; i < len; i++)
      {
!       if (cr_or_whitespace (oldname[i]))
!         strcat (filename, "-");
!       else if (URL_SAFE_CHAR (oldname[i]))
!         strncat (filename, (char *) oldname + i, 1);
!       else
!         {
!           char *hexchar = xmalloc (6 * sizeof (char));
!           sprintf (hexchar, "_00%x", (unsigned char) oldname[i]);
!           strcat (filename, hexchar);
!           free (hexchar);
!         }
      }
+ 
+   free (oldname);
  }
  

Index: xref.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/xref.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** xref.c      18 Feb 2004 13:58:14 -0000      1.8
--- xref.c      10 Mar 2004 22:34:21 -0000      1.9
***************
*** 235,238 ****
--- 235,247 ----
                       much use to us with numbered nodes. */
                    add_html_elt ("<a href=");
+ 
+                   /* If there's a dot, make it a NULL terminator, so the
+                      extension does not get into the way.  */
+                   {
+                     char *p = strrchr (arg4 , '.');
+                     if (p != NULL)
+                       *p = 0;
+                   }
+ 
                    /* Note that if we are splitting, and the referenced
                       tag is an anchor rather than a node, we will
***************
*** 243,247 ****
                       with that problem.  */
                    if (splitting)
!                     execute_string ("\"../%s/", arg4);
                    else
                      execute_string ("\"%s.html", arg4);
--- 252,256 ----
                       with that problem.  */
                    if (splitting)
!                     execute_string ("\"%s/", arg4);
                    else
                      execute_string ("\"%s.html", arg4);

Index: makeinfo.h
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/makeinfo.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** makeinfo.h  24 Feb 2004 21:14:39 -0000      1.7
--- makeinfo.h  10 Mar 2004 22:34:21 -0000      1.8
***************
*** 270,275 ****
  #endif
  
! #define HTML_SAFE "$-_.+!*'()"
! #define URL_SAFE_CHAR(ch) (isalnum (ch) || strchr (HTML_SAFE, ch))
  
  #define COMMAND_PREFIX '@'
--- 270,276 ----
  #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 '@'



reply via email to

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