Skip to content

Commit

Permalink
Allow for multiple tokens in "input-ignore" (fixes #531)
Browse files Browse the repository at this point in the history
  • Loading branch information
josephwright committed Aug 15, 2021
1 parent 9434f3d commit ea2dd5b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -17,6 +17,8 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
- Position of non-aligned non-numeric material in table cells when
centering decimal marker (issue
[#526](https://github.com/josephwright/siunitx/issues/526))
- Treatment of multiple tokens for `input-ignore` (issue
[#531](https://github.com/josephwright/siunitx/issues/531))

## [v3.0.24]

Expand Down
10 changes: 7 additions & 3 deletions siunitx-number.dtx
Expand Up @@ -807,6 +807,11 @@
{
\group_begin:
\tl_clear:N \l_@@_parsed_tl
\tl_map_inline:Nn \l_@@_input_ignore_tl
{
\token_if_macro:NT ##1
{ \cs_set_eq:NN ##1 \scan_stop: }
}
\protected@edef \l_@@_arg_tl
{
\bool_if:NTF \l_@@_expression_bool
Expand All @@ -815,9 +820,8 @@
}
\tl_set_eq:NN \l_@@_input_tl \l_@@_arg_tl
\siunitx_number_normalize_symbols:N \l_@@_arg_tl
\protected@edef \l_@@_input_ignore_tl { \l_@@_input_ignore_tl }
\tl_if_empty:NF \l_@@_input_ignore_tl
{ \tl_remove_all:NV \l_@@_arg_tl \l_@@_input_ignore_tl }
\tl_map_inline:Nn \l_@@_input_ignore_tl
{ \tl_remove_all:Nn \l_@@_arg_tl {##1} }
\tl_if_empty:NF \l_@@_arg_tl
{ \@@_parse_comparator: }
\@@_parse_check:
Expand Down
3 changes: 3 additions & 0 deletions testfiles/siunitx-number.lvt
Expand Up @@ -523,6 +523,9 @@
\keys_set:nn { siunitx } { input-ignore = }
\test:n { 1\,234 }
\test:n { +1\,234 }
\test:n { (-3) }
\keys_set:nn { siunitx } { input-ignore = ( ) }
\test:n { (-3) }
}

\TEST { Option~setting~"input-open-uncertainty" }
Expand Down
12 changes: 12 additions & 0 deletions testfiles/siunitx-number.tlg
Expand Up @@ -1093,6 +1093,18 @@ format defined in module documentation.
> \l_tmpa_tl=.
<recently read> }
l. ... }
! Package siunitx Error: Invalid number '(-3)'.
For immediate help type H <return>.
...
l. ... }
The input '(-3)' could not be parsed as a number following the format defined
in module documentation.
> \l_tmpa_tl=.
<recently read> }
l. ... }
> \l_tmpa_tl=-3.
<recently read> }
l. ... }
============================================================
============================================================
TEST 31: Option setting "input-open-uncertainty"
Expand Down

0 comments on commit ea2dd5b

Please sign in to comment.