texinfo-commits
[Top][All Lists]
Advanced

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

[6568] implement @cindex @sortas{} for texinfo.tex


From: Gavin D. Smith
Subject: [6568] implement @cindex @sortas{} for texinfo.tex
Date: Mon, 24 Aug 2015 18:51:42 +0000

Revision: 6568
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6568
Author:   gavin
Date:     2015-08-24 18:51:41 +0000 (Mon, 24 Aug 2015)
Log Message:
-----------
implement @cindex @sortas{} for texinfo.tex

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/doc/texinfo.tex

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2015-08-24 15:11:39 UTC (rev 6567)
+++ trunk/ChangeLog     2015-08-24 18:51:41 UTC (rev 6568)
@@ -1,5 +1,11 @@
 2015-08-24  Gavin Smith  <address@hidden>
 
+       * doc/texinfo.tex (\sortas): New macro.
+       (\dosubindwrite): Give it a special definition.  Trim spaces
+       from index entry.
+
+2015-08-24  Gavin Smith  <address@hidden>
+
        * ti/ti.twjr (extract_initial): Read initials delimited by 
        balanced curly braces, to be compatible with older versions
        of texinfo.tex.

Modified: trunk/doc/texinfo.tex
===================================================================
--- trunk/doc/texinfo.tex       2015-08-24 15:11:39 UTC (rev 6567)
+++ trunk/doc/texinfo.tex       2015-08-24 18:51:41 UTC (rev 6568)
@@ -3,7 +3,7 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2015-08-24.15}
+\def\texinfoversion{2015-08-24.20}
 %
 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -4433,16 +4433,13 @@
   \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
 }
 
-% Define \doindex, the driver for all \fooindex macros.
+% Define \doindex, the driver for all index macros.
 % Argument #1 is generated by the calling \fooindex macro,
-%  and it is "foo", the name of the index.
+% and it the two-letter name of the index.
 
 % \doindex just uses \parsearg; it calls \doind for the actual work.
 % This is because \doind is more useful to call from other macros.
 
-% There is also \dosubind {index}{topic}{subtopic}
-% which makes an entry in a two-level index such as the operation index.
-
 \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
 \def\singleindexer #1{\doind{\indexname}{#1}}
 
@@ -4799,7 +4796,11 @@
 % #1 is the index name, #2 is the entry text.
 \def\doind#1#2{\dosubind{#1}{#2}{}}
 
-% Workhorse for all \fooindexes.
+% There is also \dosubind {index}{topic}{subtopic}
+% which makes an entry in a two-level index such as the operation index.
+% TODO: Two-level index?  Operation index?
+
+% Workhorse for all indexes.
 % #1 is name of index, #2 is stuff to put there, #3 is subentry --
 % empty if called from \doind, as we usually are (the main exception
 % is with most defuns, which call us directly).
@@ -4829,6 +4830,15 @@
   @address@hidden@address@hidden
 }
 
+% Definition for writing index entry text.
+\def\sortas#1{}%
+
+% Definition for writing index entry sort key.  @sortas{} must occur at
+% the beginning of the index entry, like
+% @cindex @sortas{september} \september
+\def\indexwritesortas#1#2\endofindexentry{#1}
+
+
 % Write the entry in \toks0 to the index file:
 %
 \def\dosubindwrite{%
@@ -4841,12 +4851,13 @@
   \indexdummies % Must do this here, since \bf, etc expand at this stage
   \useindexbackslash % \indexbackslash isn't defined now so it will be output 
                      % as is; and it will print as backslash.
-  %
-  % Process the index entry with all font commands turned off, to
-  % get the string to sort by.
+  % Get the string to sort by, by processing the index entry with all
+  % font commands turned off.
   {\indexnofonts
-   \edef\temp{\the\toks0}% need full expansion
-   \xdef\indexsorttmp{\temp}%
+   \def\endofindexentry{}%
+   \let\sortas=\indexwritesortas
+   \edef\temp{\the\toks0 \noexpand\endofindexentry}%
+   \xdef\indexsortkey{\temp}%
   }%
   %
   % Set up the complete index entry, with both the sort key and
@@ -4856,7 +4867,9 @@
   % sorted result.
   \edef\temp{%
     \write\writeto{%
-      \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}%
+      \string\entry{\indexsortkey}{\noexpand\folio}%
+                   {\expandafter\eatspaces\expandafter{\the\toks0}}}%
+                         % This (^) removes a space after a @sortas.
   }%
   \temp
 }




reply via email to

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