[latex3-commits] [latex3/latex2e] ltproperties-activechars: use protected at edef in ltproperties (4c733902)
github at latex-project.org
github at latex-project.org
Wed Sep 20 14:37:40 CEST 2023
Repository : https://github.com/latex3/latex2e
On branch : ltproperties-activechars
Link : https://github.com/latex3/latex2e/commit/4c7339027363cd90bc4dfd0f1485e183746859f1
>---------------------------------------------------------------
commit 4c7339027363cd90bc4dfd0f1485e183746859f1
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Wed Sep 20 14:37:40 2023 +0200
use protected at edef in ltproperties
>---------------------------------------------------------------
4c7339027363cd90bc4dfd0f1485e183746859f1
base/changes.txt | 4 +++
base/ltproperties.dtx | 21 ++++++++++-----
base/testfiles-search/properties-009-babel.lvt | 36 ++++++++++++++++++++++++++
base/testfiles-search/properties-009-babel.tlg | 21 +++++++++++++++
base/testfiles/properties-009_babel.tlg | 0
5 files changed, 76 insertions(+), 6 deletions(-)
diff --git a/base/changes.txt b/base/changes.txt
index 3454f49a..e62f0d68 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -5,6 +5,10 @@ It is provided for convenience only. It therefore makes no claims to
completeness or accuracy and it contains some references to files that
are not part of the distribution.
================================================================================
+2023-09-13 Ulrike Fischer <Ulrike.Fischer at latex-project.org>
+ * ltproperties.dtx:
+ use \protected at edef for expansion in the LaTeX2e commands.
+
2023-09-13 Ulrike Fischer <Ulrike.Fischer at latex-project.org>
* ltproperties.dtx:
expand consistently the label/property names in the LaTeX2e commands.
diff --git a/base/ltproperties.dtx b/base/ltproperties.dtx
index 71b6e2a1..d1e32125 100644
--- a/base/ltproperties.dtx
+++ b/base/ltproperties.dtx
@@ -22,8 +22,8 @@
%
% for those people who are interested.
% \begin{macrocode}
-\def\ltpropertiesversion{1.0b}
-\def\ltpropertiesdate{2023-09-13}
+\def\ltpropertiesversion{1.0c}
+\def\ltpropertiesdate{2023-09-20}
% \end{macrocode}
%<*driver>
@@ -302,6 +302,8 @@
% \section{\LaTeXe{} interface}
%
% The LaTeXe{} interfaces always expand label and property arguments.
+% This means that one must be careful when using active chars or commands in the
+% names. UTF8-chars are protected and should be safe, similar most babel shorthands.
%
% \begin{function}{\NewProperty,\SetProperty}
% \begin{syntax}
@@ -511,14 +513,17 @@
% \begin{macro}{\NewProperty,\SetProperty}
% For consistency we expand the property name, but this doesn't warant a
% variant of the L3-commands.
+% \changes{v1.0c}{2023-09-20}{use \cs{protected at edef}}
% \begin{macrocode}
\cs_new_protected:Npn \NewProperty #1#2#3#4
{
- \exp_args:Nx \property_new:nnnn {#1}{#2}{#3}{#4}
+ \protected at edef\reserved at a{#1}
+ \exp_args:NV \property_new:nnnn \reserved at a {#2}{#3}{#4}
}
\cs_new_protected:Npn \SetProperty #1#2#3#4
{
- \exp_args:Nx \property_gset:nnnn {#1}{#2}{#3}{#4}
+ \protected at edef\reserved at a{#1}
+ \exp_args:NV \property_gset:nnnn\reserved at a {#2}{#3}{#4}
}
% \end{macrocode}
% \end{macro}
@@ -529,6 +534,7 @@
% \property_record:nn,
% \property_record:nV,
% \property_record:xx,
+% \property_record:oo,
% \@@_record:nn,
% \@@_record:xn
% }
@@ -543,7 +549,7 @@
{ \property_record:nV {#1} #2 }
\cs_new_protected:Npn \property_record:nn #1#2
{ \@@_record:xn { \tl_to_str:n {#1} } {#2} }
-\cs_generate_variant:Nn \property_record:nn { nV , xx }
+\cs_generate_variant:Nn \property_record:nn { nV , xx, oo }
\cs_new_protected:Npn \@@_record:nn #1#2
{
\legacy_if:nT { @filesw }
@@ -580,11 +586,14 @@
% \end{macro}
%
% \begin{macro}{\RecordProperties}
+% \changes{v1.0c}{2023-09-20}{use \cs{protected at edef} for safer handling of active chars.} %
% \begin{macrocode}
\NewDocumentCommand\RecordProperties { m m }
{
\@bsphack
- \property_record:xx {#1}{#2}
+ \protected at edef\reserved at a{#1}
+ \protected at edef\reserved at b{#2}
+ \property_record:oo {\reserved at a}{\reserved at b}
\@esphack
}
% \end{macrocode}
diff --git a/base/testfiles-search/properties-009-babel.lvt b/base/testfiles-search/properties-009-babel.lvt
new file mode 100644
index 00000000..b3381d1f
--- /dev/null
+++ b/base/testfiles-search/properties-009-babel.lvt
@@ -0,0 +1,36 @@
+\documentclass{article}
+\input{regression-test}
+
+
+\usepackage[ngerman,safe=none]{babel}
+
+\START
+
+\SHOWFILE{\jobname.aux}
+
+\OMIT
+\begin{document}
+\TIMO
+
+
+\ExplSyntaxOn
+xxxxx
+\RecordProperties{label"A}{page}
+\property_record:nn{label"B}{page}
+
+\TEST{Ref~with~active~char}
+ {
+ \ASSERT{11}
+ {
+ \RefProperty{label"A}{page}
+ \property_ref:ee{label"B}{page}
+ }
+ }
+
+
+\RefUndefinedWarn { label"C}{ page }
+
+\ExplSyntaxOff
+
+
+\end{document}
diff --git a/base/testfiles-search/properties-009-babel.tlg b/base/testfiles-search/properties-009-babel.tlg
new file mode 100644
index 00000000..441c7098
--- /dev/null
+++ b/base/testfiles-search/properties-009-babel.tlg
@@ -0,0 +1,21 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+-------- properties-009-babel.aux (start) ---------
+(properties-009-babel.aux) \relax^^M
+\providecommand\babel at aux[2]{}^^M
+\@nameuse{bbl at beforestart}^^M
+\catcode `"\active^^M
+\babel at aux{ngerman}{}^^M
+\new at label@record{label"A}{{page}{1}}^^M
+\new at label@record{label"B}{{page}{1}}^^M
+\gdef \@abspage at last{1}^^M
+-------- properties-009-babel.aux (end) -----------
+============================================================
+TEST 1: Ref with active char
+============================================================
+PASSED
+============================================================
+LaTeX Warning: Reference `label"C' on page 1 undefined on input line ....
+[1
+] (properties-009-babel.aux)
+LaTeX Warning: There were undefined references.
diff --git a/base/testfiles/properties-009_babel.tlg b/base/testfiles/properties-009_babel.tlg
new file mode 100644
index 00000000..e69de29b
More information about the latex3-commits
mailing list.