[latex3-commits] [l3svn] 04/05: l3doc: Quote some special characters in index entry

noreply at latex-project.org noreply at latex-project.org
Sat Dec 17 14:50:42 CET 2016


This is an automated email from the git hooks/post-receive script.

joseph pushed a commit to branch master
in repository l3svn.

commit 169e0b0de22c82166978eeed9c45c378123362b2
Author: Qing Lee <sobenlee at gmail.com>
Date:   Sat Dec 17 18:23:34 2016 +0800

    l3doc: Quote some special characters in index entry
---
 l3kernel/l3doc.dtx |   39 +++++++++++++++++++++++++++++----------
 1 file changed, 29 insertions(+), 10 deletions(-)

diff --git a/l3kernel/l3doc.dtx b/l3kernel/l3doc.dtx
index 03ef1a8..0ec5885 100644
--- a/l3kernel/l3doc.dtx
+++ b/l3kernel/l3doc.dtx
@@ -3715,8 +3715,8 @@ Do not distribute a modified version of this file.
     \use:x
       {
         \@@_special_index_module:nnnnN
-          { \quotechar #1 }
-          { \quotechar \bslash \quotechar #1 }
+          {#1}
+          { \bslash #1 }
           { }
           { }
           \c_false_bool
@@ -3758,6 +3758,7 @@ Do not distribute a modified version of this file.
 %   a construct such as |\meta{...}|.
 %    \begin{macrocode}
 \tl_new:N \l_@@_index_escaped_macro_tl
+\tl_new:N \l_@@_index_escaped_key_tl
 \cs_new_protected:Npn \@@_special_index_module:nnnnN #1#2#3#4#5
   {
     \use:x
@@ -3783,6 +3784,8 @@ Do not distribute a modified version of this file.
 \cs_generate_variant:Nn \@@_special_index_module:nnnnN { ooo }
 \cs_new_protected:Npn \@@_special_index_aux:nnnnnn #1#2#3#4#5#6
   {
+    \tl_set:Nn \l_@@_index_escaped_key_tl {#1}
+    \@@_quote_special_char:N \l_@@_index_escaped_key_tl
     \@@_special_index_set:Nn \l_@@_index_escaped_macro_tl {#2}
     \str_if_eq:onTF { \@currenvir } { macrocode }
       { \codeline at wrindex }
@@ -3797,7 +3800,7 @@ Do not distribute a modified version of this file.
       {
         \tl_if_empty:nF { #3 #4 #5 }
           { #3 #5 \actualchar #4 #5 \levelchar }
-        #1
+        \l_@@_index_escaped_key_tl
         \actualchar
         {
           \token_to_str:N \verbatim at font \c_space_tl
@@ -3812,23 +3815,24 @@ Do not distribute a modified version of this file.
     \tl_set:Nx #1 { \tl_to_str:n {#2} }
     \@@_if_almost_str:nTF {#2}
       {
+        \tl_replace_all:Non #1 { \tl_to_str:n { __ } }
+          {
+            \verbatimchar
+            \token_to_str:N \_ \token_to_str:N \_
+            \token_to_str:N \verb * \verbatimchar
+          }
         \exp_args:Nx \tl_map_inline:nn
           { \tl_to_str:N \verbatimchar \token_to_str:N _ }
           {
             \tl_replace_all:Nnn #1 {##1}
               {
                 \verbatimchar \c_@@_backslash_tl ##1
-                \token_to_str:N \verb \quotechar * \verbatimchar
+                \token_to_str:N \verb * \verbatimchar
               }
           }
-        \tl_map_inline:nn { \actualchar \encapchar \levelchar }
-          {
-            \tl_replace_all:Nxn #1
-              { \tl_to_str:N ##1 } { \quotechar \tl_to_str:N ##1 }
-          }
         \tl_set:Nx #1
           {
-            \token_to_str:N \verb \quotechar * \verbatimchar
+            \token_to_str:N \verb * \verbatimchar
             #1 \verbatimchar
           }
       }
@@ -3838,6 +3842,21 @@ Do not distribute a modified version of this file.
           { \c_@@_backslash_tl }
           { \token_to_str:N \bslash \c_space_tl }
       }
+    \@@_quote_special_char:N #1
+  }
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[aux]{\@@_quote_special_char:N}
+% Quote some special characters.
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_quote_special_char:N #1
+  {
+    \tl_map_inline:nn { \quotechar \actualchar \encapchar \levelchar }
+      {
+        \tl_replace_all:Nxn #1
+          { \tl_to_str:N ##1 } { \quotechar \tl_to_str:N ##1 }
+      }
   }
 %    \end{macrocode}
 % \end{macro}

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the latex3-commits mailing list