Skip to content

Commit

Permalink
add child selector every (#576)
Browse files Browse the repository at this point in the history
  • Loading branch information
lvjr committed Jan 24, 2025
1 parent d047a1f commit 366281a
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 9 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com).
- Add `\DeclareTblrKeys` and `\SetTblrKeys` commands ([#547])
- Add `\lTblrDefaultHruleWidthDim` and `\lTblrDefaultVruleWidthDim` ([#102], [#527])
- Add `\lTblrDefaultHruleColorTl` and `\lTblrDefaultVruleColorTl` ([#172])
- Always parse entire child index list ([#577])
- Allow mixing child selectors and child indexes ([#577])
- Add child selector `every` ([#576])
- Add benchmark tests and publish results to `gh-pages` branch ([#480])
- Add new chapter "Experimental Interfaces" in the manual
- Document how to use color models with `functional` library ([#106])
Expand Down Expand Up @@ -384,6 +385,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com).
[#563]: https://github.com/lvjr/tabularray/issues/563
[#574]: https://github.com/lvjr/tabularray/issues/574
[#575]: https://github.com/lvjr/tabularray/issues/575
[#576]: https://github.com/lvjr/tabularray/issues/576
[#577]: https://github.com/lvjr/tabularray/issues/577
[#578]: https://github.com/lvjr/tabularray/issues/578
[#580]: https://github.com/lvjr/tabularray/issues/580
Expand Down
17 changes: 17 additions & 0 deletions tabularray.sty
Original file line number Diff line number Diff line change
Expand Up @@ -1338,6 +1338,23 @@
}
}

%% #1: step; #2: start index; #3: end index
\NewChildSelector { every } [3] [1]
{
\clist_set:Ne \lTblrChildClist
{
{
\int_compare:nNnTF {#2} < {0}
{ \int_eval:n { \lTblrChildTotalInt + 1 #2 } } {#2}
}
{ #1 }
{
\int_compare:nNnTF {#3} < {0}
{ \int_eval:n { \lTblrChildTotalInt + 1 #3 } } {#3}
}
}
}

\clist_new:N \l__tblr_child_whole_clist
\seq_new:N \l__child_spec_seq
\str_new:N \l__tblr_child_item_head_str
Expand Down
2 changes: 1 addition & 1 deletion testfiles/extra-002.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9d7895b1283ee571643baaf1b0828fd4
8d5666c4c023be5c759f4b7bd946b687
Binary file modified testfiles/extra-002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions testfiles/extra-002.tex
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

\START

\BEGINTEST{even and odd selectors with options}
\BEGINTEST{even, odd and every selectors with options}
\begin{tblr}{
row{1} = {gray9},
cell{odd}{1} = {red9},
cell{odd[4]}{2} = {green9},
cell{odd[3-X]}{3} = {blue9},
cell{every[2]{3}{-3}}{3} = {blue9},
}
Head &Head &Head \\
Talk A&Place A&Date A\\
Expand All @@ -42,7 +42,7 @@
row{1} = {gray9},
cell{even}{1} = {yellow9},
cell{even[4]}{2} = {cyan9},
cell{even[3-X]}{3} = {purple9},
cell{every[2]{4}{-3}}{3} = {purple9},
}
Head &Head &Head \\
Talk A&Place A&Date A\\
Expand Down Expand Up @@ -87,10 +87,10 @@

\bigskip\hrule\bigskip

\BEGINTEST{named indexes U-Z in child from}
\BEGINTEST{every selector with negative start and end indexes}
\begin{tblr}{
hlines, vlines,
cell{-}{even[X-Z]}={preto=x}
cell{-}{every{-3}{-1}}={preto=x}
}
& & & \\
\end{tblr}
Expand Down
4 changes: 2 additions & 2 deletions testfiles/extra-002.tlg
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
This is a generated file for the l3build validation system.
Don't change this file in any respect.
============================================================
TEST 1: even and odd selectors with options
TEST 1: even, odd and every selectors with options
============================================================
============================================================
============================================================
TEST 2: named indexes U-Z
============================================================
============================================================
============================================================
TEST 3: named indexes U-Z in child from
TEST 3: every selector with negative start and end indexes
============================================================
============================================================
============================================================
Expand Down

0 comments on commit 366281a

Please sign in to comment.