summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/cellprops/cellprops.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-07-19 21:11:25 +0000
committerKarl Berry <karl@freefriends.org>2018-07-19 21:11:25 +0000
commitb6d8bcb0726858b9b9e77624a875e495f38f602d (patch)
tree15251e5308a40b3094f27bfde1351226731254e0 /Master/texmf-dist/source/latex/cellprops/cellprops.dtx
parentb2755ff8357a47e3679b78fa53889d2bd533e369 (diff)
cellprops (19jul18)
git-svn-id: svn://tug.org/texlive/trunk@48227 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/cellprops/cellprops.dtx')
-rw-r--r--Master/texmf-dist/source/latex/cellprops/cellprops.dtx117
1 files changed, 85 insertions, 32 deletions
diff --git a/Master/texmf-dist/source/latex/cellprops/cellprops.dtx b/Master/texmf-dist/source/latex/cellprops/cellprops.dtx
index 2a86acdba6a..1ee1a858b55 100644
--- a/Master/texmf-dist/source/latex/cellprops/cellprops.dtx
+++ b/Master/texmf-dist/source/latex/cellprops/cellprops.dtx
@@ -1,7 +1,7 @@
% \iffalse meta-comment
% vim: tw=80 spl=en
%
-%% File: cellprops.dtx (C) Copyright 2016 RIVAUD Julien
+%% File: cellprops.dtx (C) Copyright 2018 RIVAUD Julien
%%
%% It may be distributed and/or modified under the conditions of the
%% General Public License (GPL), either version 3 of this
@@ -14,8 +14,8 @@
\RequirePackage{expl3}[2016/01/19]
\def\ExplFileName{cellprops}
\def\ExplFileDescription{CSS-like cell and table properties}
-\def\ExplFileDate{2018/06/14}
-\def\ExplFileVersion{1.3}
+\def\ExplFileDate{2018/07/16}
+\def\ExplFileVersion{1.4}
%</driver|package>
%<*driver>
\documentclass[full]{l3doc}
@@ -80,10 +80,12 @@
% min-height: 0pt;
% min-depth: 0pt;
% border-style: none solid solid none;
-% background-color: black!5!white;
% text-align: center;
% }
-% tr:nth-child(even) td {
+% table {
+% background-color: black!5!white;
+% }
+% tr:nth-child(even) {
% background-color: black!15!white;
% }
% td:nth-child(even) {
@@ -118,10 +120,12 @@
% min-height: 0pt;
% min-depth: 0pt;
% border-style: none solid solid none;
-% background-color: black!5!white;
% text-align: center;
% }
-% tr:nth-child(even) td {
+% table {
+% background-color: black!5!white;
+% }
+% tr:nth-child(even) {
% background-color: black!15!white;
% }
% td:nth-child(even) {
@@ -226,7 +230,8 @@
% "'table'" \OR
% "'tr'"[\<pseudo-class>] ["' '" \<element2>] \OR
% \<element2>
-% \item[element2] "'td'"[\<pseudo-class>]
+% \item[element2] "'td'"[\<pseudo-class>] ["' '" \<parbox>] \OR \<parbox>
+% \item[parbox] "'p'"
% \item[pseudo-class] "':nth-child('"\<nth>"')"
% \item[nth] \<number> \OR "'odd'" \OR "'even'" \OR \<number>"'n+'"\<number>
% \item[properties] [ \<property> "';'" ]*
@@ -357,6 +362,7 @@
\RequirePackage{xparse}
\RequirePackage{xcolor}
% \end{macrocode}
+%
% \subsection{Loading and fixing \pkg{mdwtab}}
%
% There is a bug in the command \cs{colpop} of \pkg{mdwtab}: instead of just
@@ -364,11 +370,10 @@
% completely because one \cs{expandafter} is missing. This is proof that not
% many package authors really use this API as recommended by Mark
% \textsc{Wooding}\ldots We thus load \pkg{mdwtab} and fix \cs{colpop}.
+%
% \begin{macrocode}
\RequirePackage{mdwtab}
\cs_set_nopar:Npn \tab@pop #1 { \tl_set:Nx #1 { \tl_tail:N #1 } }
-
-
% \end{macrocode}
%
% \subsection{Parsing CSS properties}
@@ -407,6 +412,7 @@
}
}
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
% \end{macro}
@@ -416,6 +422,7 @@
% \begin{macro}{\@@_define_properties:nn}
% The control sequence \cs{_@@_property_type_<name>:nn} holds the setter for
% the property \meta{name}. It can be set by the following helper:
+%
% \begin{macrocode}
\cs_new_protected:Nn \@@_define_properties:nn {
\clist_map_inline:nn {#2} {
@@ -423,12 +430,14 @@
}
}
% \end{macrocode}
+%
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@@_use_setter:nn}
% Sometimes we need to use a setter right away rather than save its action
% somewhere. The following helper does that with an x-expansion.
+%
% \begin{macrocode}
\cs_new:Nn \@@_delegate_setter:nn {
\use:c {_@@_property_type_#1:nn} {#1} {#2}
@@ -439,6 +448,7 @@
}
}
% \end{macrocode}
+%
% \end{macro}
%
% \begin{macrocode}
@@ -668,7 +678,9 @@
\cs_new_protected:Nn \@@_parse_selector:Nn {
\str_set:Nx \l_tmpa_str {#2}
% \end{macrocode}
+%
% Replace some aliases with their meaning:
+%
% \begin{macrocode}
\prop_map_inline:Nn \c_@@_parse_replace_prop {
\use:x {
@@ -677,15 +689,19 @@
}
}
% \end{macrocode}
+%
% Replace all spaces by \cs{q_stop} to defeat the space removal feature of
% \cs{seq_set_split:Nnn}.
+%
% \begin{macrocode}
\tl_replace_all:Nnn \l_tmpa_str {~} {\q_stop}
\exp_args:NNVV
\seq_set_split:Nnn \l_tmpa_seq \c_@@_parse_nthchild_str \l_tmpa_str
\seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl
% \end{macrocode}
+%
% And replace them back.
+%
% \begin{macrocode}
\tl_replace_all:Nnn \l_tmpa_tl {\q_stop} {~}
\seq_clear:N \l_@@_parse_selector_seq
@@ -693,15 +709,19 @@
\seq_map_inline:Nn \l_tmpa_seq {
\tl_set:Nn \l_tmpa_tl { ##1 }
% \end{macrocode}
+%
% And replace them back again.
+%
% \begin{macrocode}
\tl_replace_all:Nnn \l_tmpa_tl {\q_stop} {~}
% \end{macrocode}
+%
% Now replace the first closing parenthesis by \cs{q_stop}\cs{prg_do_nothing:}
% to use \cs{q_stop} as a delimiter for \cs{seq_set_split:Nnn} and thus split
% at most once. Note that here the space trimming feature is desired for the
% left part, but not just at the right of the parenthesis, so
% \cs{prg_do_nothing:} will act as a guard and will be removed afterwards.
+%
% \begin{macrocode}
\tl_replace_once:Nnn \l_tmpa_tl { ) } { \q_stop\prg_do_nothing: }
\seq_set_split:NnV \l_tmpa_seq { \q_stop } \l_tmpa_tl
@@ -841,13 +861,17 @@
\cs_set_eq:NN \@@_orig_tab@readpreamble:n \tab@readpreamble
\cs_set_eq:NN \tab@readpreamble \@@_readpreamble:n
% \end{macrocode}
+%
% Zero \cs{col@sep} but remember its value for the default padding.
+%
% \begin{macrocode}
\dim_set_eq:NN \l_@@_colsep_dim \col@sep
\dim_zero:N \col@sep
% \end{macrocode}
+%
% Also ignore \cs{*extrasep} dimensions that are not part of cellprop
% interface and should be replaced by CSS equivalents.
+%
% \begin{macrocode}
\dim_zero:N \tab@extrasep
\group_begin:
@@ -902,13 +926,14 @@
\@@_orig_LTarray:w [#1]{#2}
\@@_array_startcontent:
}
-
% \end{macrocode}
+%
% The color inheritance is handled with \cs{l_@@_inherit_color_tl},
% \cs{l_@@_color_tl} and \cs{l_@@_bgcolor_tl}. The role of
% \cs{@@_update_color:Nn} is to set the inherit fallback to the already
% existing value of \verb|#1| then set \verb|#1| to the CSS value, which can be
% the inherit variable.
+%
% \begin{macrocode}
\cs_new_protected_nopar:Nn \@@_update_color:Nn {
\@@_get_property:nN {#2} \l_tmpa_tl
@@ -1001,6 +1026,15 @@
}
}
}
+% \end{macrocode}
+%
+% Reset \cs{firsthline} and \cs{lasthline} to \cs{hline} because the version
+% from \pkg{array} which might be loaded already will mess up the spacing and is
+% unneeded anyway.
+%
+% \begin{macrocode}
+\cs_set_eq:NN \firsthline \hline
+\cs_set_eq:NN \lasthline \hline
\colpush{tabular}
@@ -1068,6 +1102,7 @@
% \end{macrocode}
%
% Handle various \verb|:nth-child()| forms.
+%
% \begin{macrocode}
\cs_new_protected_nopar:Nn \@@_seq_nthchild:Nn {
\seq_clear:N #1
@@ -1081,27 +1116,6 @@
\cs_new_protected_nopar:Nn \@@_begincell:n {
\@@_begin_raw_cell:n {
- \@@_seq_nthchild:Nn \l_tmpa_seq { \g_@@_row_int }
- \@@_seq_nthchild:Nn \l_tmpb_seq { \g_@@_col_int }
- \seq_map_inline:Nn \l_tmpa_seq {
- \@@_recall_properties:n {tr:nth-child(##1)}
- }
- \@@_update_colors:
- \@@_recall_properties:n {td}
- \@@_recall_properties:n {tr~td}
- \seq_map_inline:Nn \l_tmpb_seq {
- \@@_recall_properties:n {td:nth-child(##1)}
- }
- \seq_map_inline:Nn \l_tmpa_seq {
- \@@_recall_properties:n {tr:nth-child(##1)~td}
- }
- \seq_map_inline:Nn \l_tmpa_seq {
- \seq_map_inline:Nn \l_tmpb_seq {
- \@@_recall_properties:n {tr:nth-child(##1)~
- td:nth-child(####1)}
- }
- }
- \@@_update_colors:
#1
\hbox_set:Nw \l_@@_cell_box
\str_case_x:nnF {\@@_get_property:n {math-mode}} {
@@ -1137,7 +1151,25 @@
\global\@minipagefalse
\everypar{}
}
+ \@@_seq_nthchild:Nn \l_tmpa_seq { \g_@@_row_int }
+ \@@_seq_nthchild:Nn \l_tmpb_seq { \g_@@_col_int }
\@@_recall_properties:n {td~p}
+ \seq_map_inline:Nn \l_tmpa_seq {
+ \@@_recall_properties:n {tr:nth-child(##1)~p}
+ }
+ \seq_map_inline:Nn \l_tmpb_seq {
+ \@@_recall_properties:n {td:nth-child(##1)~p}
+ }
+ \@@_recall_properties:n {tr~td~p}
+ \seq_map_inline:Nn \l_tmpa_seq {
+ \@@_recall_properties:n {tr:nth-child(##1)~td~p}
+ }
+ \seq_map_inline:Nn \l_tmpa_seq {
+ \seq_map_inline:Nn \l_tmpb_seq {
+ \@@_recall_properties:n {tr:nth-child(##1)~
+ td:nth-child(####1)~p}
+ }
+ }
}
}
\cs_new_protected_nopar:Nn \@@_end_par_cell:n {
@@ -1152,6 +1184,27 @@
\cs_new_protected_nopar:Nn \@@_begin_raw_cell:n {
\group_begin:
+ \@@_seq_nthchild:Nn \l_tmpa_seq { \g_@@_row_int }
+ \@@_seq_nthchild:Nn \l_tmpb_seq { \g_@@_col_int }
+ \seq_map_inline:Nn \l_tmpa_seq {
+ \@@_recall_properties:n {tr:nth-child(##1)}
+ }
+ \@@_update_colors:
+ \@@_recall_properties:n {td}
+ \@@_recall_properties:n {tr~td}
+ \seq_map_inline:Nn \l_tmpb_seq {
+ \@@_recall_properties:n {td:nth-child(##1)}
+ }
+ \seq_map_inline:Nn \l_tmpa_seq {
+ \@@_recall_properties:n {tr:nth-child(##1)~td}
+ }
+ \seq_map_inline:Nn \l_tmpa_seq {
+ \seq_map_inline:Nn \l_tmpb_seq {
+ \@@_recall_properties:n {tr:nth-child(##1)~
+ td:nth-child(####1)}
+ }
+ }
+ \@@_update_colors:
% Additional init code
#1
% Install the cell color