summaryrefslogtreecommitdiff
path: root/tex/context/base/tabl-nte.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/tabl-nte.mkiv')
-rw-r--r--tex/context/base/tabl-nte.mkiv67
1 files changed, 37 insertions, 30 deletions
diff --git a/tex/context/base/tabl-nte.mkiv b/tex/context/base/tabl-nte.mkiv
index 08ab34f0f..4a9774cb0 100644
--- a/tex/context/base/tabl-nte.mkiv
+++ b/tex/context/base/tabl-nte.mkiv
@@ -28,7 +28,7 @@
%D
%D Let us start with the original macros:
%D
-%D \starttyping
+%D \startbuffer
%D \bTABLE
%D \bTR
%D \bTD Text 1 \eTD
@@ -39,65 +39,72 @@
%D \bTD Text 4 \eTD
%D \eTR
%D \eTABLE
-%D \stoptyping
+%D \stopbuffer
+%D
+%D \typebuffer \getbuffer
%D
%D Watch how the new macros use less code:
%D
-%D \starttyping
+%D \startbuffer
%D \startTABLE
%D \NC Text 1 \NC Text 2 \NC\NR
%D \NC Text 3 \NC Text 4 \NC\NR
%D \stopTABLE
-%D \stoptyping
+%D \stopbuffer
+%D
+%D \typebuffer \getbuffer
%D
%D The actual code differs from the prototype that it does not need
%D to collect whole rows and parse them but looks ahead instead.
-\def\startTABLE
- {\dosingleempty\dostartTABLE}
+\newconditional\c_tabl_nte_in_nc
-\def\dostartTABLE[#1]%
+\unexpanded\def\startTABLE
+ {\dosingleempty\tabl_nte_start}
+
+\def\tabl_nte_start[#1]%
{\bgroup
\bTABLE[#1]%
- \let\NC\doTABLENC
- \let\NR\doTABLENR
+ \let\NC\tabl_nte_start_nc
+ \let\NR\tabl_nte_start_nr
\let\bTR\relax
\let\bTD\relax
\let\bTH\relax
\let\bTN\relax}
-\def\stopTABLE
+\unexpanded\def\stopTABLE
{\eTABLE
\egroup}
-\newconditional\inTABLEnc
-
-\unexpanded\def\doTABLENR
+\unexpanded\def\tabl_nte_start_nr
{\eTR
- \setfalse\inTABLEnc}
+ \setfalse\c_tabl_nte_in_nc}
-\unexpanded\def\doTABLENC
- {\futurelet\next\dodoTABLENC}
+\unexpanded\def\tabl_nte_start_nc
+ {\futurelet\next\tabl_nte_start_nc_indeed}
-\def\dodoTABLENC
- {\ifx\next\doTABLENR \else
- \expandafter\dododoTABLENC
+\def\tabl_nte_start_nc_indeed
+ {\ifx\next\tabl_nte_start_nr \else
+ \expandafter\tabl_nte_start_nc_finish
\fi}
-\long\def\dododoTABLENC#1\NC
- {\ifconditional\inTABLEnc\else\settrue\inTABLEnc\dobTR[]\fi
- \dobTD#1\eTD\NC}
+\def\tabl_nte_start_nc_finish#1\NC
+ {\ifconditional\c_tabl_nte_in_nc \else
+ \settrue\c_tabl_nte_in_nc
+ \dobTR[]%
+ \fi
+ \dobTD#1\eTD\NC}
%D The related structure commands are also available:
-\unexpanded\def\startTABLEhead{\dosingleempty\dostartTABLEhead} \let\stopTABLEhead\relax
-\unexpanded\def\startTABLEnext{\dosingleempty\dostartTABLEnext} \let\stopTABLEnext\relax
-\unexpanded\def\startTABLEbody{\dosingleempty\dostartTABLEbody} \let\stopTABLEbody\relax
-\unexpanded\def\startTABLEfoot{\dosingleempty\dostartTABLEfoot} \let\stopTABLEfoot\relax
+\unexpanded\def\startTABLEhead{\dosingleempty\tabl_nte_start_head} \let\stopTABLEhead\relax
+\unexpanded\def\startTABLEnext{\dosingleempty\tabl_nte_start_next} \let\stopTABLEnext\relax
+\unexpanded\def\startTABLEbody{\dosingleempty\tabl_nte_start_body} \let\stopTABLEbody\relax
+\unexpanded\def\startTABLEfoot{\dosingleempty\tabl_nte_start_foot} \let\stopTABLEfoot\relax
-\long\def\dostartTABLEhead[#1]#2\stopTABLEhead{\appendtoks\doTABLEsection[#1]{#2}\to\TBLhead}
-\long\def\dostartTABLEnext[#1]#2\stopTABLEnext{\appendtoks\doTABLEsection[#1]{#2}\to\TBLnext}
-\long\def\dostartTABLEbody[#1]#2\stopTABLEbody{\appendtoks\doTABLEsection[#1]{#2}\to\TBLbody}
-\long\def\dostartTABLEfoot[#1]#2\stopTABLEfoot{\appendtoks\doTABLEsection[#1]{#2}\to\TBLfoot}
+\def\tabl_nte_start_head[#1]#2\stopTABLEhead{\appendtoks\doTABLEsection[#1]{#2}\to\TBLhead}
+\def\tabl_nte_start_next[#1]#2\stopTABLEnext{\appendtoks\doTABLEsection[#1]{#2}\to\TBLnext}
+\def\tabl_nte_start_body[#1]#2\stopTABLEbody{\appendtoks\doTABLEsection[#1]{#2}\to\TBLbody}
+\def\tabl_nte_start_foot[#1]#2\stopTABLEfoot{\appendtoks\doTABLEsection[#1]{#2}\to\TBLfoot}
\protect \endinput