[latex3-commits] [git/LaTeX3-latex3-latex3] xparse: Trim spaces at end of xparse environment names (48eff3b)
Bruno Le Floch
bruno at le-floch.fr
Wed Feb 27 18:11:03 CET 2019
Repository : https://github.com/latex3/latex3
On branch : xparse
Link : https://github.com/latex3/latex3/commit/48eff3b5b2b8921e2f77b16c364d834742f1b6fd
>---------------------------------------------------------------
commit 48eff3b5b2b8921e2f77b16c364d834742f1b6fd
Author: Bruno Le Floch <bruno at le-floch.fr>
Date: Wed Feb 27 18:11:03 2019 +0100
Trim spaces at end of xparse environment names
>---------------------------------------------------------------
48eff3b5b2b8921e2f77b16c364d834742f1b6fd
l3packages/CHANGELOG.md | 1 +
l3packages/xparse/testfiles/xparse005.lvt | 2 +-
l3packages/xparse/xparse.dtx | 12 +++++++-----
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/l3packages/CHANGELOG.md b/l3packages/CHANGELOG.md
index 42253d6..9bacceb 100644
--- a/l3packages/CHANGELOG.md
+++ b/l3packages/CHANGELOG.md
@@ -13,6 +13,7 @@ this project uses date-based 'snapshot' version identifiers.
### Changed
- `xparse`: make \IfBooleanTF safer
- `xparse`: clearer error messages, especially for environments
+- `xparse`: when defining an environment, trim spaces at ends of its name
## [2018-09-24]
diff --git a/l3packages/xparse/testfiles/xparse005.lvt b/l3packages/xparse/testfiles/xparse005.lvt
index d3051d2..aed6486 100644
--- a/l3packages/xparse/testfiles/xparse005.lvt
+++ b/l3packages/xparse/testfiles/xparse005.lvt
@@ -214,7 +214,7 @@
\NewDocumentCommand { \testG } { v } { \TYPE {#1} }
\testG+
\TYPE+
-\NewDocumentEnvironment {testH} { v } { \TYPE {#1} } { }
+\NewDocumentEnvironment { testH } { v } { \TYPE {#1} } { }
\begin{testH}+
\TYPE+
\end{testH}
diff --git a/l3packages/xparse/xparse.dtx b/l3packages/xparse/xparse.dtx
index 79fa3b3..c245abb 100644
--- a/l3packages/xparse/xparse.dtx
+++ b/l3packages/xparse/xparse.dtx
@@ -1311,23 +1311,25 @@
% \begin{macrocode}
\cs_new_protected:Npn \@@_declare_env:nnnn #1#2
{
+ \str_set:Nx \l_@@_environment_str {#1}
+ \str_set:Nx \l_@@_environment_str
+ { \tl_trim_spaces:o { \l_@@_environment_str } }
%<*initex>
- \cs_if_exist:cTF { environment~ #1 }
+ \cs_if_exist:cTF { environment~ \l_@@_environment_str }
%</initex>
%<*package>
- \cs_if_exist:cTF {#1}
+ \cs_if_exist:cTF { \l_@@_environment_str }
%</package>
{
\__kernel_msg_info:nnxx { xparse } { redefine-environment }
- {#1} { \tl_to_str:n {#2} }
+ { \l_@@_environment_str } { \tl_to_str:n {#2} }
}
{
\__kernel_msg_info:nnxx { xparse } { define-environment }
- {#1} { \tl_to_str:n {#2} }
+ { \l_@@_environment_str } { \tl_to_str:n {#2} }
}
\bool_set_false:N \l_@@_expandable_bool
\bool_set_true:N \l_@@_environment_bool
- \str_set:Nx \l_@@_environment_str {#1}
\exp_args:NV \@@_declare_env_internal:nnnn
\l_@@_environment_str {#2}
}
More information about the latex3-commits
mailing list