bug-texinfo
[Top][All Lists]
Advanced

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

[PATCH] Add accesskey attributes to html output.


From: Matthew Woodcraft
Subject: [PATCH] Add accesskey attributes to html output.
Date: Wed, 13 Mar 2002 20:14:30 +0000
User-agent: Mutt/1.3.27i

This patch makes makeinfo --html add 'accesskey' attributes to the
<a href> elements it emits.

Access keys for 'n', 'p', 'u', and numbers for menu items are
implemented. This gives an approximation to the keyboard navigation from
standalone info. Access keys are supported in Mozilla (with the Alt
key), for example, but not in Lynx.

I hope you'll consider this patch for inclusion. One caveat is that the
'accesskey' attribute was only introduced in html 4, but it will surely
cause no problems in browsers which do not recognise it.

-M-



Patch against texinfo 4.1:

        * makeinfo/makeinfo.h (next_menu_item_number): New global.
        * makeinfo/insertion.c (begin_insertion): Initialise it.
        * makeinfo/makeinfo.c (handle_menu_entry): Emit accesskey attribute
        in html output, according to next_menu_item_number.
        * makeinfo/node.c (cm_node): Emit accesskey attributes in html output.


*** makeinfo.h  10 Mar 2002 19:30:56 -0000      1.1.1.1
--- makeinfo.h  10 Mar 2002 22:19:22 -0000      1.2
*************** DECLARE (int, enable_encoding, 0);
*** 128,133 ****
--- 128,137 ----
  /* Nonzero means escape characters in HTML output. */
  DECLARE (int, escape_html, 1);
  extern char *escape_string (); /* do HTML escapes */
+ 
+ /* Access key number for next menu entry to be generated (1 to 9, or 10 to
+    mean no access key)  */
+ DECLARE (int, next_menu_item_number, 1);
  
  /* Nonzero means that the use of paragraph_start_indent is inhibited.
     @example uses this to line up the left columns of the example text.


*** insertion.c 10 Mar 2002 19:30:56 -0000      1.1.1.1
--- insertion.c 10 Mar 2002 22:19:22 -0000      1.2
*************** begin_insertion (type)
*** 382,388 ****
  
        if (xml)
        xml_insert_element (MENU, START);
!       
        in_menu++;
        in_fixed_width_font++;
        no_discard++;
--- 382,389 ----
  
        if (xml)
        xml_insert_element (MENU, START);
! 
!       next_menu_item_number = 1;
        in_menu++;
        in_fixed_width_font++;
        no_discard++;


*** makeinfo.c  10 Mar 2002 19:30:56 -0000      1.1.1.1
--- makeinfo.c  10 Mar 2002 22:19:22 -0000      1.2
*************** handle_menu_entry ()
*** 1692,1698 ****
            in_paragraph = 0;
          }
  
!       add_word ("<li><a href=\"");
        string = expansion (tem, 0);
        add_anchor_name (string, 1);
        add_word ("\">");
--- 1692,1705 ----
            in_paragraph = 0;
          }
  
!       add_word ("<li><a");
!       if (next_menu_item_number <= 9)
!       {
!         add_word(" accesskey=");
!         add_word_args("%d", next_menu_item_number);
!         next_menu_item_number++;
!       }
!       add_word (" href=\"");
        string = expansion (tem, 0);
        add_anchor_name (string, 1);
        add_word ("\">");


*** node.c      10 Mar 2002 19:30:56 -0000      1.1.1.1
--- node.c      10 Mar 2002 22:19:22 -0000      1.2
*************** cm_node ()
*** 928,934 ****
                tem = expansion (next, 0);
              add_word (",\n");
              add_word (_("Next:"));
!             add_word ("<a rel=next href=\"");
              add_anchor_name (tem, 1);
              add_word_args ("\">%s</a>", tem);
                free (tem);
--- 928,934 ----
                tem = expansion (next, 0);
              add_word (",\n");
              add_word (_("Next:"));
!             add_word ("<a rel=next accesskey=n href=\"");
              add_anchor_name (tem, 1);
              add_word_args ("\">%s</a>", tem);
                free (tem);
*************** cm_node ()
*** 938,944 ****
                tem = expansion (prev, 0);
              add_word (",\n");
              add_word (_("Previous:"));
!             add_word ("<a rel=previous href=\"");
              add_anchor_name (tem, 1);
              add_word_args ("\">%s</a>", tem);
                free (tem);
--- 938,944 ----
                tem = expansion (prev, 0);
              add_word (",\n");
              add_word (_("Previous:"));
!             add_word ("<a rel=previous accesskey=p href=\"");
              add_anchor_name (tem, 1);
              add_word_args ("\">%s</a>", tem);
                free (tem);
*************** cm_node ()
*** 948,954 ****
                tem = expansion (up, 0);
              add_word (",\n");
              add_word (_("Up:"));
!             add_word ("<a rel=up href=\"");
              add_anchor_name (tem, 1);
              add_word_args ("\">%s</a>", tem);
                free (tem);
--- 948,954 ----
                tem = expansion (up, 0);
              add_word (",\n");
              add_word (_("Up:"));
!             add_word ("<a rel=up accesskey=u href=\"");
              add_anchor_name (tem, 1);
              add_word_args ("\">%s</a>", tem);
                free (tem);



reply via email to

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