<..HTable..>+
\def\T:ABLE{%
\ifx \bgroup\:temp \let\:temp=\HT:ble
\else \ifx [\:temp \let\:temp=\HT:ble
\else <.character options for TABLE.>%
\fi \fi \:temp}
\def\TA:BLE#1{%
\let\:tempb=\:TR \al:gn\:TR#1%
\ifx \:tempb\:TR \expand:after{\HT:ble#1}%
\else \expand:after{\futurelet\:temp\T:ABLE}\fi
}
-_-_-
We stay above for all the characters before the caption.
<..character options for TABLE..>
\let\:tempb=\TA:BLE
\ifx B\:temp \edef\TABLE:{\HTable:B \TABLE:}%
\def\:tempb##1{\futurelet\:temp\T:ABLE}%
\fi
\HTable:brdr P{cellpadding}%
\HTable:brdr S{cellspacing}%
\let\:temp=\:tempb
-_-_-
<..HTable..>+
\def\HTable:brdr#1#2{\ifx #1\:temp
\def\:tempb##1{\afterassignment\:tempa\tmp:cnt=}%
\def\:tempa{%
\edef\TABLE:{#2="\the\tmp:cnt" \TABLE:}%
\futurelet\:temp\T:ABLE }%
\fi}
-_-_-
<..HTable..>+
\def\arg:HTable#1#2{%
\def\:temp{#1}\ifx \:temp\empty \else
\expandafter\def\csname HTable:\string#1\endcsname{#2}%
\expandafter\arg:HTable
\fi
}
\NewConfigure{HTable+}[2]{\arg:HTable{#1}{#2}}
-_-_-
The options are inserted into the entries.
<..HTable..>+
\def\al:gn#1#2{%
\add:TD#1<#2{\csname HTable:<\endcsname }%
\add:TD#1>#2{\csname HTable:>\endcsname }%
\add:TD#1-#2{\csname HTable:-\endcsname }%
\add:TD#1^#2{\csname HTable:\string^\endcsname }%
\add:TD#1|#2{\csname HTable:|\endcsname }%
\add:TD#1_#2{\csname HTable:\string_\endcsname }%
\add:TD#1=#2{\csname HTable:=\endcsname }%
}
\def\add:TD#1#2#3#4{\chardef\:temp=‘#2
\chardef\:tempa=‘#3
\ifnum \:temp=\:tempa\edef#1{#1\space #4}\fi}
\let\:TR=\empty
-_-_-
The above is superior to ‘\def\add:TD#1#2#3#4{\ifx #2#3\edef#1{#1\space #4}\fi}’ because it is indepndent of category codes and ‘_’ and ‘^’, for instance, may change their meaning.