[latex3-commits] [l3svn] r6839 - Make @@@@ (four ats) give @@ in l3docstrip and l3doc (fixes #328)

noreply at latex-project.org noreply at latex-project.org
Mon Feb 6 19:52:08 CET 2017


Author: bruno
Date: 2017-02-06 19:52:08 +0100 (Mon, 06 Feb 2017)
New Revision: 6839

Modified:
   trunk/l3experimental/xgalley/l3galley.dtx
   trunk/l3kernel/l3doc.dtx
   trunk/l3kernel/l3docstrip.dtx
   trunk/l3trial/l3htoks/l3htoks.dtx
Log:
Make @@@@ (four ats) give @@ in l3docstrip and l3doc (fixes #328)

Other changes simply use this new feature


Modified: trunk/l3experimental/xgalley/l3galley.dtx
===================================================================
--- trunk/l3experimental/xgalley/l3galley.dtx	2017-02-06 18:24:51 UTC (rev 6838)
+++ trunk/l3experimental/xgalley/l3galley.dtx	2017-02-06 18:52:08 UTC (rev 6839)
@@ -2606,7 +2606,7 @@
 % \begin{macro}{\@@par}
 %   The primitive is moved as otherwise the clever skipping code will fail.
 %    \begin{macrocode}
-\cs_set_eq:cN { @ @ par } \galley_par:
+\cs_set_eq:NN \@@@@par \galley_par:
 %    \end{macrocode}
 % \end{macro}
 %

Modified: trunk/l3kernel/l3doc.dtx
===================================================================
--- trunk/l3kernel/l3doc.dtx	2017-02-06 18:24:51 UTC (rev 6838)
+++ trunk/l3kernel/l3doc.dtx	2017-02-06 18:52:08 UTC (rev 6839)
@@ -975,7 +975,7 @@
 % \begin{macro}[aux]{\@@_replace_at_at_aux:Nn}
 %   The goal is to replace |@@| by the current module name.  If there is
 %   no \meta{module~name}, do nothing.  Otherwise, sanitize the catcodes
-%   of |@| and~|_| and replace both |_@@| and |@@| by
+%   of |@| and~|_|, temporarily change |@@@@| to |aa| with different catcodes and later to |@@|, and replace |__@@| and |_@@| and |@@| by
 %   |__|\meta{module~name}.  The result contains |_| with category
 %   code letter because this is what the |macrocode| environment
 %   expects.  Other use cases can apply \cs{tl_to_str:n} if needed.
@@ -991,12 +991,15 @@
           #1 \g_@@_module_name_tl
       }
   }
-\cs_new_protected:Npn \@@_replace_at_at_aux:Nn #1#2
+\cs_new_protected:Npx \@@_replace_at_at_aux:Nn #1#2
   {
-    \tl_replace_all:Non #1 { \token_to_str:N @ } { @ }
-    \tl_replace_all:Non #1 { \token_to_str:N _ } { _ }
-    \tl_replace_all:Nnn #1 { _ @ @ } { _ _ #2 }
-    \tl_replace_all:Nnn #1 {   @ @ } { _ _ #2 }
+    \tl_replace_all:Nnn #1 { \token_to_str:N @ } { @ }
+    \tl_replace_all:Nnn #1 { \token_to_str:N _ } { _ }
+    \tl_replace_all:Nnn #1 { @ @ @ @ } { \token_to_str:N a a }
+    \tl_replace_all:Nnn #1 { _ _ @ @ } { _ _ #2 }
+    \tl_replace_all:Nnn #1 {   _ @ @ } { _ _ #2 }
+    \tl_replace_all:Nnn #1 {     @ @ } { _ _ #2 }
+    \tl_replace_all:Nnn #1 { \token_to_str:N a a } { @ @ }
   }
 %    \end{macrocode}
 % \end{macro}

Modified: trunk/l3kernel/l3docstrip.dtx
===================================================================
--- trunk/l3kernel/l3docstrip.dtx	2017-02-06 18:24:51 UTC (rev 6838)
+++ trunk/l3kernel/l3docstrip.dtx	2017-02-06 18:52:08 UTC (rev 6839)
@@ -100,7 +100,7 @@
 %
 % To extract the code using \pkg{l3docstrip}, the \enquote{guard} concept
 % used by \textsf{DocStrip} is extended by introduction of the syntax
-% \texttt{\%<@@=\meta{module}}. The \meta{module} name will be used when the
+% \texttt{\%<@@=\meta{module}>}. The \meta{module} name will be used when the
 % code is extracted to replace the |@@|, so that
 % \begin{verbatim}
 %   %<*package>
@@ -123,6 +123,10 @@
 % where the |__| indicates that the functions and variables are internal
 % to the \texttt{foo} module.
 %
+% Use |@@@@| to obtain |@@| in the output (|@@@@@| to get |@@@|).  For
+% longer pieces of code the replacement can be completely suppressed by
+% giving an empty module name, namely using the syntax \texttt{\%<@@=>}.
+%
 % \end{documentation}
 %
 % \begin{implementation}
@@ -188,7 +192,10 @@
 %   The argument (|#1|) is the replacement text to use, or if empty an
 %   indicator that no replacement should be done. The search material is
 %   one of |__@@|, |_@@| or |@@|, done in order such that all three will end
-%   up the same in the output. The replacement function is initialised as a
+%   up the same in the output. The string |@@@@| is hidden from these
+%   replacements by temporarily turning it into a pair of letters with
+%   different category codes, not produced by \pkg{docstrip}; this allows to
+%   get |@@| in the output. The replacement function is initialised as a
 %   do-nothing for the case where |%<@@=| is never seen.
 %    \begin{macrocode}
 \begingroup
@@ -197,10 +204,12 @@
     \ifx\relax#1\relax
        \let\replaceModuleInLine\empty
     \else
-      \def\replaceModuleInLine{%
-        \replaceAllIn\inLine{__@@}{__#1}%
-        \replaceAllIn\inLine{_@@}{__#1}%
-        \replaceAllIn\inLine{@@}{__#1}%
+      \edef\replaceModuleInLine{%
+        \noexpand\replaceAllIn\noexpand\inLine{@@@@}{\string aa}%
+        \noexpand\replaceAllIn\noexpand\inLine{__@@}{__#1}%
+        \noexpand\replaceAllIn\noexpand\inLine{_@@}{__#1}%
+        \noexpand\replaceAllIn\noexpand\inLine{@@}{__#1}%
+        \noexpand\replaceAllIn\noexpand\inLine{\string aa}{@@}%
       }%
     \fi
   }

Modified: trunk/l3trial/l3htoks/l3htoks.dtx
===================================================================
--- trunk/l3trial/l3htoks/l3htoks.dtx	2017-02-06 18:24:51 UTC (rev 6838)
+++ trunk/l3trial/l3htoks/l3htoks.dtx	2017-02-06 18:52:08 UTC (rev 6839)
@@ -1314,11 +1314,11 @@
     \htoks_code:n
       {
         \ifnum \lastpenalty =\z@
-          \csname @ @ italiccorr\endcsname
+          \@@@@italiccorr
         \else
           \count@ \lastpenalty
           \unpenalty
-          \csname @ @ italiccorr\endcsname
+          \@@@@italiccorr
           \penalty \count@
         \fi
       }



More information about the latex3-commits mailing list