diff options
author | Hans Hagen <pragma@wxs.nl> | 2012-06-06 01:05:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2012-06-06 01:05:00 +0200 |
commit | 5c3cbbccc5b63bea40e181825fb9290f2b7c7fa5 (patch) | |
tree | 65d51e09ac699b2e9ba075429fe94fcb60160555 /tex/context/base | |
parent | 2a50db46043ea7113c18e87887c371552efd1af9 (diff) | |
download | context-5c3cbbccc5b63bea40e181825fb9290f2b7c7fa5.tar.gz |
beta 2012.06.06 01:05
Diffstat (limited to 'tex/context/base')
-rw-r--r-- | tex/context/base/cont-new.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4140 -> 4135 bytes | |||
-rw-r--r-- | tex/context/base/context-version.png | bin | 105875 -> 103468 bytes | |||
-rw-r--r-- | tex/context/base/context.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/core-ini.mkiv | 9 | ||||
-rw-r--r-- | tex/context/base/mult-aux.mkiv | 10 | ||||
-rw-r--r-- | tex/context/base/mult-sys.mkiv | 1 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24400 -> 24397 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 181183 -> 181178 bytes | |||
-rw-r--r-- | tex/context/base/status-mkiv.lua | 9 | ||||
-rw-r--r-- | tex/context/base/strc-bkm.mkiv | 150 | ||||
-rw-r--r-- | tex/context/base/strc-blk.mkiv | 96 | ||||
-rw-r--r-- | tex/context/base/tabl-ntb.mkiv | 10 | ||||
-rw-r--r-- | tex/context/base/tabl-nte.mkiv | 67 | ||||
-rw-r--r-- | tex/context/base/tabl-pln.mkiv | 155 |
17 files changed, 278 insertions, 237 deletions
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index d32abd77b..c21bfa3ab 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2012.06.05 21:45} +\newcontextversion{2012.06.06 01:05} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 6fb6e57f0..bf03831ef 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2012.06.05 21:45} +\newcontextversion{2012.06.06 01:05} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 4c102355b..05a65df9e 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png Binary files differindex 3bf4eaab6..df021a2b3 100644 --- a/tex/context/base/context-version.png +++ b/tex/context/base/context-version.png diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index 885983754..d2ba098e6 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2012.06.05 21:45} +\edef\contextversion{2012.06.06 01:05} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index f717384e8..b241d3702 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -23,7 +23,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2012.06.05 21:45} +\edef\contextversion{2012.06.06 01:05} %D For those who want to use this: diff --git a/tex/context/base/core-ini.mkiv b/tex/context/base/core-ini.mkiv index de37bf08f..6235d5bde 100644 --- a/tex/context/base/core-ini.mkiv +++ b/tex/context/base/core-ini.mkiv @@ -32,7 +32,6 @@ \flushnotes \synchronizenotes \OTRSETshowstatus - \flushpostponedbookmark \registerparoptions %\flushsyncpositions \flushpostponednodedata @@ -41,14 +40,6 @@ \to \everypar \appendtoks - \flushpostponedbookmark -\to \neverypar - -\appendtoks - \flushpostponedbookmark -\to \everylistentry - -\appendtoks \flushnotes \to \everydisplay diff --git a/tex/context/base/mult-aux.mkiv b/tex/context/base/mult-aux.mkiv index 011fba7d3..788e8cd42 100644 --- a/tex/context/base/mult-aux.mkiv +++ b/tex/context/base/mult-aux.mkiv @@ -499,12 +499,11 @@ \expandafter\noexpand\csname detokenized#2parameter\endcsname \expandafter\noexpand\csname direct#2parameter\endcsname}} -\unexpanded\def\mult_interfaces_install_direct_setup_handler#1#2#3#4% +\unexpanded\def\mult_interfaces_install_direct_setup_handler#1#2#3#4#5% {\unexpanded\def#2{\dosingleempty#3}% - \newtoks#4% - \def#3[##1]% - {\mult_interfaces_get_parameters#1[##1]% - \the#4}} + \newtoks#5% + \def#3[##1]{\mult_interfaces_get_parameters#1[##1]\the#5}% + \def#4{\mult_interfaces_get_parameters#1}} \unexpanded\def\installdirectsetuphandler#1#2% {\normalexpanded @@ -512,6 +511,7 @@ {\noexpand#1}% \??aa \expandafter\noexpand\csname setup#2\endcsname \expandafter\noexpand\csname setup_#2\endcsname % semi-public + \expandafter\noexpand\csname setupcurrent#2\endcsname % no \every (we use 'current' for rconsistency) \expandafter\noexpand\csname everysetup#2\endcsname}} \unexpanded\def\mult_interfaces_install_direct_parameter_set_handler#1#2#3#4#5% diff --git a/tex/context/base/mult-sys.mkiv b/tex/context/base/mult-sys.mkiv index 9b67ab4ba..06e6787c6 100644 --- a/tex/context/base/mult-sys.mkiv +++ b/tex/context/base/mult-sys.mkiv @@ -459,7 +459,6 @@ \definesystemvariable {an} % ANchor \definesystemvariable {as} % AlignmentSwitch \definesystemvariable {bg} % BleedinG -\definesystemvariable {bm} % BookMark \definesystemvariable {bp} % BreakPoint \definesystemvariable {bx} % BackendExport \definesystemvariable {cb} % CollectBox diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex bf8e1debb..4c0eaa861 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 8eca647c1..450288ff9 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/status-mkiv.lua b/tex/context/base/status-mkiv.lua index cbb7040db..492d0cea6 100644 --- a/tex/context/base/status-mkiv.lua +++ b/tex/context/base/status-mkiv.lua @@ -877,7 +877,7 @@ return { { filename = "strc-blk", marktype = "mkiv", - status = "unknown", + status = "okay", }, { filename = "page-imp", @@ -921,7 +921,7 @@ return { { filename = "strc-bkm", marktype = "mkiv", - status = "unknown", + status = "okay", }, { filename = "tabl-com", @@ -932,7 +932,8 @@ return { { filename = "tabl-pln", marktype = "mkiv", - status = "unknown", + status = "okay", + comment = "unchecked", }, { filename = "tabl-tab", @@ -953,7 +954,7 @@ return { { filename = "tabl-nte", marktype = "mkiv", - status = "unknown", + status = "okay", }, { filename = "tabl-ltb", diff --git a/tex/context/base/strc-bkm.mkiv b/tex/context/base/strc-bkm.mkiv index 8ddf0a6df..8e1252329 100644 --- a/tex/context/base/strc-bkm.mkiv +++ b/tex/context/base/strc-bkm.mkiv @@ -11,93 +11,109 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -%D This might become scrn-bkm.mkiv. - \writestatus{loading}{ConTeXt Structure Macros / Bookmarks} \registerctxluafile{strc-bkm}{1.001} \unprotect -%D Due to requests I finally decided to support bookmarks, a -%D driver dependant way of showing tables of content. The most -%D simple way of support is hooking bookmark generation into -%D the existing list mechanisms. That way users can generate -%D bookmarks automatically, although its entirely valid to add -%D bookmarks by defining alternative ones. These will be added -%D at the appropriate place in the list. - -% \hoofdstuk{het eerste hoofdstuk} -% -% \bookmark {de eerste bookmark} % optional overruled hoofdstuk -% -% .... text .... -% -% \placebookmarks [hoofdstuk,paragraaf,subparagraaf,subsubparagraaf,mylist] -% [open list] -% -% \bookmark[mylist]{whatever} - -%D This will go away. - -\let\flushpostponedbookmark\relax +%D Bookmarks are a very viewer dependent feature. They are mostly used +%D as additional table of contents and therefore relate directly to lists. +%D +%D A bookmark list is added to the document only when interaction is +%D enabled. The given lists are bookmarked and a second argument specifies +%D the opened bookmark trees. +%D +%D \starttyping +%D \placebookmarks +%D [chapter,section,subsection,mylist] +%D [chapter] +%D \stoptyping +%D +%D You can overloads the last set bookmark in a sectioning command: +%D +%D \starttyping +%D \chapter {the first chapter} +%D \bookmark {the first bookmark} +%D \stoptyping +%D +%D However, in practice you can better use \type {\startchapter} and set the +%D \type {bookmark} parameter. +%D +%D You can add entries to the bookmarklist: +%D +%D \starttyping +%D \bookmark[mylist]{whatever} +%D \stoptyping +%D +%D Use force to get titles in the bookmarklist. This is somewhat tricky as +%D one does not want "Contents" in a table of contents but it has to be in +%D the bookmark list. + +\installcorenamespace{bookmark} + +\installsetuponlycommandhandler \??bookmark {bookmark} % installdirectparametersethandler + +\setupbookmark + [\c!force=\v!no, % it's easier to force that to inhibit + \c!number=\v!yes] % might become v!no -%D We have better ways now. +\let\setupbookmarks\setupbookmark \unexpanded\def\bookmark - {\dosingleempty\dobookmark} + {\dosingleempty\strc_bookmarks_bookmark} -\def\dobookmark[#1]#2% +\def\strc_bookmarks_bookmark + {\iflocation + \expandafter\strc_bookmarks_bookmark_yes + \else + \expandafter\strc_bookmarks_bookmark_nop + \fi} + +\def\strc_bookmarks_bookmark_yes[#1]#2% {\begingroup \simplifycommands \ctxcommand{overloadbookmark("#1",\!!bs\detokenize\expandafter{\normalexpanded{#2}}\!!es)}% \endgroup} -%D Placement \unknown\ look how simple compared to \MKII: - -\newtoks \everysetupbookmarks - -\def\bookmarkparameter#1{\ifcsname\??bm#1\endcsname\csname\??bm#1\endcsname\fi} - -\unexpanded\def\setupbookmarks[#1]% - {\getparameters[\??bm][#1]% - \the\everysetupbookmarks} +\def\strc_bookmarks_bookmark_nop[#1]#2% + {} \unexpanded\def\placebookmarks - {\dotripleempty\doplacebookmarks} - -% Use force to get titles in the bookmarklist. This is somewhat tricky as one -% does not want "Contents" in a table of contents but it has to be in the -% bookmark list. + {\dotripleempty\strc_bookmarks_place} -\def\doplacebookmarks[#1][#2][#3]% +\def\strc_bookmarks_place {\iflocation - \begingroup - \edef\askednames{#1}% - \edef\askedopened{#2}% - \ifx\askednames\empty - \edef\askednames{\getvalue{\??ih\v!content\c!list}}% - \fi - \ifx\askednames\empty - \let\askednames\v!all - \fi - \ifthirdargument - \getparameters[\??bm][#3]% - \else\ifsecondargument - \doifassignmentelse{#2}{\let\askedopened\empty\getparameters[\??bm][#2]}\donothing - \fi\fi - \ctxcommand{registerbookmark { - names = "\askednames", - opened = "\askedopened", - force = "\bookmarkparameter\c!force", - number = "\bookmarkparameter\c!number", - }}% - \endgroup + \expandafter\strc_bookmarks_place_yes + \else + \expandafter\gobblethreeoptionals \fi} -\setupbookmarks - [\c!force=\v!no, % it's easier to force that to inhibit - \c!number=\v!yes] % might become v!no +\let\m_bookmarks_names \empty +\let\m_bookmarks_opened\empty + +\def\strc_bookmarks_place_yes[#1][#2][#3]% + {\begingroup + \edef\m_bookmarks_names{#1}% + \edef\m_bookmarks_opened{#2}% + \ifx\m_bookmarks_names\empty + \edef\m_bookmarks_names{\namedlistparameter\v!content\c!list}% + \fi + \ifx\m_bookmarks_names\empty + \let\m_bookmarks_names\v!all + \fi + \ifthirdargument + \setupcurrentbookmark[#3]% no every so not all possible + \else\ifsecondargument + \doifassignmentelse{#2}{\let\m_bookmarks_opened\empty\setupcurrentbookmark[#2]}\donothing + \fi\fi + \ctxcommand{registerbookmark { + names = "\m_bookmarks_names", + opened = "\m_bookmarks_opened", + force = "\bookmarkparameter\c!force", + number = "\bookmarkparameter\c!number", + }}% + \endgroup} \appendtoks \ctxcommand{setupbookmarks { @@ -107,7 +123,7 @@ stopper = \!!bs\bookmarkparameter\c!numberstopper\!!es, segments = "\bookmarkparameter\c!numbersegments", }}% -\to \everysetupbookmarks +\to \everysetupbookmark \protect \endinput diff --git a/tex/context/base/strc-blk.mkiv b/tex/context/base/strc-blk.mkiv index 3bd5d04ed..1dd144aa9 100644 --- a/tex/context/base/strc-blk.mkiv +++ b/tex/context/base/strc-blk.mkiv @@ -22,92 +22,78 @@ % todo: prefix numbers (needs further integration elsewhere) % check functionality % alternative files (needs further integration elsewhere) +% +% order matters: \c!before (think of: \c!before=\startitemize) +% +% no \endgroups -\def\namedblockparameter#1#2{\ifcsname\??tb#1#2\endcsname\csname\??tb#1#2\endcsname\fi} - -\unexpanded\def\setupblockparameters{\dodoubleargument \dosetupblock} % fast one (for compatibility) -\unexpanded\def\setupblock {\dodoubleargumentwithset\dosetupblock} % handles set - -\def\dosetupblock[#1]{\getparameters[\??tb#1]} % [#1][#2]} +\installcorenamespace {block} +\installcorenamespace {blocktemp} -\unexpanded\def\defineblock[#1]% - {\processcommalist[#1]\dodefineblock} +\installcommandhandler \??block {block} \??block -\def\dodefineblock#1% - {\getparameters - [\??tb#1] - [\c!before=\blank, - \c!after=\blank, - \c!inner=, - \c!style=, - \c!file=]% todo - \ctxcommand{definestructureblock("#1")}% - \setuvalue{\e!begin#1}{\dodoubleempty\dobeginofblock[#1]}% - \letvalue{\e!end#1}\relax} +\appendtoks + \ctxcommand{definestructureblock("\currentblock")}% + \setuevalue{\e!begin\currentblock}{\dodoubleempty\strc_blocks_begin[\currentblock]}% + \setuevalue{\e!end \currentblock}{}% +\to \everydefineblock -\def\dobeginofblock[#1][#2]% +\unexpanded\def\strc_blocks_begin[#1][#2]% {\normalexpanded{\buff_pickup{@block@}{\e!begin#1}{\e!end#1}} {}% before {\ctxcommand{savestructureblock("#1","#2","@block@")}}}% after -\def\dostarthiddenblock +\let\strc_blocks_setup\relax + +\unexpanded\def\dostarthiddenblock % called at lua end {\startnointerference \dostartnormalblock} -\def\dostophiddenblock +\unexpanded\def\dostophiddenblock % called at lua end {\dostopnormalblock \stopnointerference} -% order matters: \c!before (think of: \c!before=\startitemize) - -% no \endgroups - -\let\doblocksetups\gobbleoneargument - -\def\dostartnormalblock#1% name +\unexpanded\def\dostartnormalblock#1% called at lua end {\bgroup - \visibletrue + \visibletrue % will change \edef\currentblock{#1}% - \doblocksetups\currentblock - \let\doblocksetups\gobbleoneargument - \namedblockparameter\currentblock\c!before - \dousestylehashparameter{\??tb\currentblock}\c!style - \dousecolorhashparameter{\??tb\currentblock}\c!color - \namedblockparameter\currentblock\c!inner + \strc_blocks_setup + \let\strc_blocks_setup\relax + \blockparameter\c!before + \useblockstyleandcolor\c!style\c!color % maybe moev one line up (font spacing) + \blockparameter\c!inner % better \c!setups \ignorespaces} -\def\dostopnormalblock +\unexpanded\def\dostopnormalblock % called at lua end {\removeunwantedspaces - \namedblockparameter\currentblock\c!after + \blockparameter\c!after \par % todo: alternative = text, paragraph \egroup} -\def\dosetblockstate[#1][#2][#3]% state name tag +\def\strc_blocks_set_state[#1][#2][#3]% state name tag {\ctxcommand{setstructureblockstate("#1","#2","#3")}} -\def\doselectblocks[#1][#2][#3][#4]% state name tag setups +\def\strc_blocks_select[#1][#2][#3][#4]% state name tag setups {\bgroup \doifassignmentelse{#3} - {\getparameters[\??tb\??tb][\c!criterium=\v!text,#3]% - \def\doblocksetups##1{\getparameters[\??tb##1][#3]}% - \ctxcommand{selectstructureblock("#1","#2","","\@@tb@@tbcriterium")}} - {\getparameters[\??tb\??tb][\c!criterium=\v!text,#4]% - \def\doblocksetups##1{\getparameters[\??tb##1][#4]}% - \ctxcommand{selectstructureblock("#1","#2","#3","\@@tb@@tbcriterium")}}% + {\getparameters[\??blocktemp][\c!criterium=\v!text,#3]% + \def\strc_blocks_setup{\setupcurrentblock[#3]}% + \ctxcommand{selectstructureblock("#1","#2","","\csname\??blocktemp\c!criterium\endcsname")}} + {\getparameters[\??blocktemp][\c!criterium=\v!text,#4]% + \def\strc_blocks_setup{\setupcurrentblock[#4]}% + \ctxcommand{selectstructureblock("#1","#2","#3","\csname\??blocktemp\c!criterium\endcsname")}}% \egroup} -% hide: save, if [+] also hidden execute -% keep: save and normal execute - -\def\hideblocks{\dotripleempty\dosetblockstate[hide]} -\def\keepblocks{\dotripleempty\dosetblockstate[keep]} - +% hide : save, if [+] also hidden execute +% keep : save and normal execute % use : normal execute unless [-] % process: hidden execute unless [-] % select : idem use -\def\useblocks {\doquadrupleempty\doselectblocks[use]} -\def\processblocks{\doquadrupleempty\doselectblocks[process]} -\def\selectblocks {\doquadrupleempty\doselectblocks[use]} +\unexpanded\def\hideblocks {\dotripleempty \strc_blocks_set_state[hide]} +\unexpanded\def\keepblocks {\dotripleempty \strc_blocks_set_state[keep]} +\unexpanded\def\useblocks {\doquadrupleempty\strc_blocks_select [use]} +\unexpanded\def\processblocks{\doquadrupleempty\strc_blocks_select [process]} +\unexpanded\def\selectblocks {\doquadrupleempty\strc_blocks_select [use]} \protect \endinput diff --git a/tex/context/base/tabl-ntb.mkiv b/tex/context/base/tabl-ntb.mkiv index 99da4b5e8..dd1dc819f 100644 --- a/tex/context/base/tabl-ntb.mkiv +++ b/tex/context/base/tabl-ntb.mkiv @@ -686,7 +686,7 @@ \long\def\doTABLEbody[#1]#2\eTABLEbody{\appendtoks\doTABLEsection[#1]{#2}\to\TBLbody} \long\def\doTABLEfoot[#1]#2\eTABLEfoot{\appendtoks\doTABLEsection[#1]{#2}\to\TBLfoot} -\long\def\doTABLEsection[#1]#2% +\long\def\doTABLEsection[#1]#2% also used in tabl-nte {\unexpanded\def\setupTBLsection{\getparameters[\@@tbl\@@tbl][#1]}% #2% \let\setupTBLsection\relax} @@ -744,10 +744,10 @@ \let\bTH\dobTH \let\bTN\dobTN} -\unexpanded\def\dobTR{\dosingleempty\parseTR} -\unexpanded\def\dobTD{\dosingleempty\parseTD} -\unexpanded\def\dobTH{\dosingleempty\parseTH} -\unexpanded\def\dobTN{\dosingleempty\parseTN} +\unexpanded\def\dobTR{\dosingleempty\parseTR} % also used in tabl-nte +\unexpanded\def\dobTD{\dosingleempty\parseTD} % also used in tabl-nte +\unexpanded\def\dobTH{\dosingleempty\parseTH} % also used in tabl-nte +\unexpanded\def\dobTN{\dosingleempty\parseTN} % also used in tabl-nte % permits \expanded{\bTD ... \eTD} 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 diff --git a/tex/context/base/tabl-pln.mkiv b/tex/context/base/tabl-pln.mkiv index 9e65f7e40..3638006c7 100644 --- a/tex/context/base/tabl-pln.mkiv +++ b/tex/context/base/tabl-pln.mkiv @@ -9,83 +9,124 @@ \writestatus{loading}{ConTeXt Table Macros / Plain Tabular} +%D This code might become a module. + \unprotect -\newif \if@@plnusetab -\newif \if@@plncr -\newbox \@@plntabs -\newbox \@@plntabsyet -\newbox \@@plntabsdone -\newdimen \@@plntabdimen +\newconditional \c_tabl_plain_cr +\newconditional \c_tabl_plain_use_tab +\newbox \b_tabl_plain_tabs +\newbox \b_tabl_plain_tabs_yet +\newbox \b_tabl_plain_tabs_done +\newdimen \d_tabl_plain_tab + +\let\m_tabl_plain_next\relax \def\cleartabs % visible - {\global\setbox\@@plntabsyet\emptyhbox - \setbox\@@plntabs\emptyhbox} + {\global\setbox\b_tabl_plain_tabs_yet\emptyhbox + \setbox\b_tabl_plain_tabs\emptyhbox} \def\settabs % visible - {\setbox\@@plntabs\emptyhbox - \futurelet\next\@@plnsettabs} + {\setbox\b_tabl_plain_tabs\emptyhbox + \futurelet\m_tabl_plain_next\tabl_plain_set_tabs} \def\tabalign % visible - {\@@plnusetabtrue\@@plnmaketabbox} + {\settrue\c_tabl_plain_use_tab + \tabl_plain_make_tab_box} -\let\+\tabalign % no outer here (can be overloaded) +\ifdefined\+ \else + \let\+\tabalign % no outer here (can be overloaded) +\fi -\def\@@plnsettabs - {\ifx\next\+% - \def\nxt{\afterassignment\@@plnsettab\let\nxt}% +\def\tabl_plain_set_tabs + {\ifx\m_tabl_plain_next\+% + \let\tabl_plain_nxt\tabl_plain_align + \else\ifx\m_tabl_plain_next\tabalign % added hh + \let\tabl_plain_nxt\tabl_plain_align \else - \let\nxt\@@plnsetcols - \fi - \let\next\relax - \nxt} + \let\tabl_plain_nxt\tabl_plain_set_cols + \fi\fi + \let\m_tabl_plain_next\relax + \tabl_plain_nxt} -\def\@@plnsettab - {\let\nxt\relax - \@@plnusetabfalse\@@plnmaketabbox} +\def\tabl_plain_align + {\afterassignment\tabl_plain_set_tab + \let\tabl_plain_nxt} -\def\@@plnsetcols#1\columns - {\scratchcounter#1% - \@@plntabdimen\hsize +\def\tabl_plain_set_tab + {\let\tabl_plain_nxt\relax + \setfalse\c_tabl_plain_use_tab + \tabl_plain_make_tab_box} + +\def\tabl_plain_set_cols#1\columns + {\scratchcounter#1\relax + \d_tabl_plain_tab\hsize \loop - \ifnum\scratchcounter>\zerocount \@nother + \ifnum\scratchcounter>\zerocount + \tabl_plain_other \repeat} -\def\@nother - {\scratchdimen\@@plntabdimen +\def\tabl_plain_other + {\scratchdimen\d_tabl_plain_tab \divide\scratchdimen\scratchcounter - \setbox\@@plntabs\hbox{\hbox to\scratchdimen{}\unhbox\@@plntabs}% - \advance\@@plntabdimen-\scratchdimen + \setbox\b_tabl_plain_tabs\hbox + {\hbox to\scratchdimen{}% + \unhbox\b_tabl_plain_tabs}% + \advance\d_tabl_plain_tab-\scratchdimen \advance\scratchcounter\minusone} -\def\@@plnmaketabbox +\def\tabl_plain_make_tab_box {\begingroup - \global\setbox\@@plntabsyet\copy\@@plntabs - \global\setbox\@@plntabsdone\emptyhbox - \def\cr - {\@@plncrtrue\crcr\egroup\egroup - \if@@plnusetab\unvbox\zerocount\lastbox\fi\endgroup - \setbox\@@plntabs\hbox{\unhbox\@@plntabsyet\unhbox\@@plntabsdone}}% - \setbox\zerocount\vbox\bgroup\@@plncrfalse - \ialign\bgroup&\@@plnbegintabbox##\@@plnendtabbox\crcr} - -\def\@@plnbegintabbox - {\setbox\zerocount\hbox\bgroup} - -\def\@@plnendtabbox - {\if@@plncr - \egroup % now \box\zerocount holds the column + \let\+\tabalign % added hh + \global\setbox\b_tabl_plain_tabs_yet\copy\b_tabl_plain_tabs + \global\setbox\b_tabl_plain_tabs_done\emptyhbox + \let\cr\tabl_plain_cr + \setbox\scratchbox\vbox\bgroup + \setfalse\c_tabl_plain_cr + \ialign\bgroup + \aligntab + \tabl_plain_begin_tab_box + \alignmark\alignmark + \tabl_plain_end_tab_box + \crcr} + +\def\tabl_plain_cr + {\settrue\c_tabl_plain_cr + \crcr + \egroup + \egroup + \ifconditional\c_tabl_plain_use_tab + \unvbox\scratchbox + \lastbox % okay? + \fi + \endgroup + \setbox\b_tabl_plain_tabs\hbox + {\unhbox\b_tabl_plain_tabs_yet + \unhbox\b_tabl_plain_tabs_done}} + +\def\tabl_plain_begin_tab_box + {\setbox\scratchbox\hbox\bgroup} + +\def\tabl_plain_end_tab_box + {\ifconditional\c_tabl_plain_cr + \egroup % now \box\scratchbox holds the column \else - \hss\egroup - \global\setbox\@@plntabsyet\hbox - {\unhbox\@@plntabsyet\global\setbox\plusone\lastbox}% now \box\plusone holds its size - \ifvoid\plusone - \global\setbox\plusone\hbox to\wd\zerocount{}% - \else - \setbox\zerocount\hbox to\wd\plusone{\unhbox\zerocount}% - \fi - \global\setbox\@@plntabsdone\hbox{\box\plusone\unhbox\@@plntabsdone}% - \fi - \box\zerocount} + \hss + \egroup + \global\setbox\b_tabl_plain_tabs_yet\hbox + {\unhbox\b_tabl_plain_tabs_yet + \global\setbox\globalscratchbox\lastbox}% now \box\globalscratchbox holds its size + \ifvoid\globalscratchbox + \global\setbox\globalscratchbox\hbox to \wd\scratchbox + {}% + \else + \setbox\scratchbox\hbox to \wd\globalscratchbox + {\unhbox\scratchbox}% + \fi + \global\setbox\b_tabl_plain_tabs_done\hbox + {\box\globalscratchbox + \unhbox\b_tabl_plain_tabs_done}% + \fi + \box\scratchbox} \protect \endinput |