From 26935233a6565bd73e53e2228ac98779fd3ab33d Mon Sep 17 00:00:00 2001 From: Marius Date: Mon, 15 Oct 2012 20:20:24 +0300 Subject: beta 2012.10.15 19:10 --- tex/context/base/strc-not.mkvi | 95 ++++++++++++++++++++++++++---------------- 1 file changed, 58 insertions(+), 37 deletions(-) (limited to 'tex/context/base/strc-not.mkvi') diff --git a/tex/context/base/strc-not.mkvi b/tex/context/base/strc-not.mkvi index 6daf4e9ad..18289cc96 100644 --- a/tex/context/base/strc-not.mkvi +++ b/tex/context/base/strc-not.mkvi @@ -122,11 +122,14 @@ %D The code here is mostly the same as enumersations but we want to keep them %D isolated and at some point we might differentiate. +% \installcorenamespace{noteclass} + \unexpanded\def\strc_define_commands_notation#1#2#3% current level parent {\doifelsenothing{#3} {\normalexpanded{\defineconstruction[#1][\s!handler=\v!notation,\c!level=#2]}% \setevalue{\??notation#1:\s!parent}{\??notation}}% {\normalexpanded{\defineconstruction[#1][#3][\s!handler=\v!notation,\c!level=#2]}% + \setevalue{\??note#1:\s!parent}{\??note#3}% see later for \s!note \setevalue{\??notation#1:\s!parent}{\??notation#3}}% \setuevalue{\e!next #1}{\strc_notations_next }% \setuevalue{\c!reset#1}{\strc_notations_reset }% @@ -174,7 +177,6 @@ \strc_notes_setup_counter\currentnotation \to \everydefinenotation - \let\p_strc_constructions_title \empty \let\p_strc_constructions_number\empty @@ -362,19 +364,38 @@ %D Insertions are part of notes. -\installcorenamespace{noteinsertion} +% \installcorenamespace{noteinsertion} + +\def\currentnoteinsertion {\noteparameter\s!insert} +\def\currentnoteinsertionnumber{\namedinsertionnumber{\noteparameter\s!insert}} + +% \appendtoks +% \doifinsertionelse\currentnote +% \donothing +% {\defineinsertion[\currentnote]% could be an option +% \normalexpanded{\t_strc_notes{\the\t_strc_notes\noexpand\strc_notes_process_list{\currentnote}}}}% +% \letnoteparameter\s!insert\currentnote +% \ctxcommand{definenote("\currentnote","insert",\number\currentnoteinsertionnumber)}% +% \ifx\currentnoteparent\empty +% \definenotation[\currentnote][\c!type=\v!note]% +% \else +% \definenotation[\currentnote][\currentnoteparent][\c!type=\v!note]% +% \fi +% \to \everydefinenote \appendtoks - \defineinsertion[\currentnote]% - \doifinsertionelse\currentnote - {\normalexpanded{\t_strc_notes{\the\t_strc_notes\noexpand\strc_notes_process_list{\currentnote}}}} - \donothing - \ctxcommand{definenote("\currentnote","insert",\number\namedinsertionnumber\currentnote)}% \ifx\currentnoteparent\empty + \doifinsertionelse\currentnote + \donothing + {\defineinsertion[\currentnote]% could be an option + \normalexpanded{\t_strc_notes{\the\t_strc_notes\noexpand\strc_notes_process_list{\currentnote}}}}% + \letnoteparameter\s!insert\currentnote \definenotation[\currentnote][\c!type=\v!note]% \else + \setexpandednoteparameter\s!insert{\namednoteparameter\currentnoteparent\s!insert}% \definenotation[\currentnote][\currentnoteparent][\c!type=\v!note]% \fi + \ctxcommand{definenote("\currentnote","insert",\number\currentnoteinsertionnumber)}% \to \everydefinenote % maybe we will share this at some point: @@ -847,7 +868,7 @@ \ifx\p_factor\empty \else \ifnum\p_factor<\zerocount \else % \global - \count\namedinsertionnumber\currentnote\p_factor % new: global + \count\currentnoteinsertionnumber\p_factor % new: global \fi \fi} @@ -963,10 +984,10 @@ {\setfalse\c_strc_notes_delayed \strc_notes_set_distance \strc_notes_set_columns - \page_inserts_set_location\currentnote\v!page % \setupinsertion[\currentnote][\c!location=\v!page]% - \global\count\namedinsertionnumber\currentnote\numexpr\plusthousand/\c_strc_notes_columns\relax - \global\dimen\namedinsertionnumber\currentnote\ifnotelimit\dimexpr\noteparameter\c!height*\c_strc_notes_columns\relax\else\maxdimen\fi - \global\skip \namedinsertionnumber\currentnote\s_strc_notes_distance} + \page_inserts_set_location\currentnoteinsertion\v!page % \setupinsertion[\currentnote][\c!location=\v!page]% + \global\count\currentnoteinsertionnumber\numexpr\plusthousand/\c_strc_notes_columns\relax + \global\dimen\currentnoteinsertionnumber\ifnotelimit\dimexpr\noteparameter\c!height*\c_strc_notes_columns\relax\else\maxdimen\fi + \global\skip \currentnoteinsertionnumber\s_strc_notes_distance} \def\strc_notes_set_location_columns {\setfalse\c_strc_notes_delayed @@ -975,19 +996,19 @@ \ifnum\currentnofcolumns=\zerocount \c_strc_notes_columns\plusone \fi - \page_inserts_set_location\currentnote\v!columns % \setupinsertion[\currentnote][\c!location=\v!columns]% - \global\count\namedinsertionnumber\currentnote\numexpr\plusthousand/\c_strc_notes_columns\relax - \global\dimen\namedinsertionnumber\currentnote\ifnotelimit\dimexpr\noteparameter\c!height*\c_strc_notes_columns\relax\else\maxdimen\fi - \global\skip \namedinsertionnumber\currentnote\s_strc_notes_distance} + \page_inserts_set_location\currentnoteinsertion\v!columns % \setupinsertion[\currentnote][\c!location=\v!columns]% + \global\count\currentnoteinsertionnumber\numexpr\plusthousand/\c_strc_notes_columns\relax + \global\dimen\currentnoteinsertionnumber\ifnotelimit\dimexpr\noteparameter\c!height*\c_strc_notes_columns\relax\else\maxdimen\fi + \global\skip \currentnoteinsertionnumber\s_strc_notes_distance} \def\strc_notes_set_location_somecolumn#whatcolumn% {\setfalse\c_strc_notes_delayed \strc_notes_set_distance \strc_notes_set_columns - \page_inserts_set_location\currentnote#whatcolumn% \setupinsertion[\currentnote][\c!location=#whatcolumn]% - \global\count\namedinsertionnumber\currentnote\plusthousand - \global\dimen\namedinsertionnumber\currentnote\ifnotelimit\noteparameter\c!height\else\maxdimen\fi - \global\skip \namedinsertionnumber\currentnote\s_strc_notes_distance} + \page_inserts_set_location\currentnoteinsertion#whatcolumn% \setupinsertion[\currentnote][\c!location=#whatcolumn]% + \global\count\currentnoteinsertionnumber\plusthousand + \global\dimen\currentnoteinsertionnumber\ifnotelimit\noteparameter\c!height\else\maxdimen\fi + \global\skip \currentnoteinsertionnumber\s_strc_notes_distance} \def\strc_notes_set_location_firstcolumn{\strc_notes_set_location_somecolumn\v!firstcolumn} \def\strc_notes_set_location_lastcolumn {\strc_notes_set_location_somecolumn\v!lastcolumn } @@ -995,10 +1016,10 @@ \def\strc_notes_set_location_text % we don't use inserts anyway (e.g. endnotes) {\settrue\c_strc_notes_delayed \ctxcommand{setnotestate("\currentnote","store")}% - \page_inserts_set_location\currentnote\v!text % \setupinsertion[\currentnote][\c!location=\v!text]% - \global\count\namedinsertionnumber\currentnote\zerocount - \global\dimen\namedinsertionnumber\currentnote\maxdimen - \global\skip \namedinsertionnumber\currentnote\zeropoint} + \page_inserts_set_location\currentnoteinsertion\v!text % \setupinsertion[\currentnote][\c!location=\v!text]% + \global\count\currentnoteinsertionnumber\zerocount + \global\dimen\currentnoteinsertionnumber\maxdimen + \global\skip \currentnoteinsertionnumber\zeropoint} \let\strc_notes_set_location_none\strc_notes_set_location_text @@ -1022,7 +1043,7 @@ \newconditional\c_notes_bottom_present \def\strc_notes_check_if_bottom_present_indeed % in otr ! - {\ifvoid\namedinsertionnumber\currentnote\else + {\ifvoid\currentnoteinsertionnumber\else \strc_notes_set_position \fi} @@ -1143,7 +1164,7 @@ \strc_constructions_initialize{#1}% \strc_notes_synchronize \the\everybeforenoteinsert - \insert\namedinsertionnumber\currentnote\bgroup + \insert\currentnoteinsertionnumber\bgroup \the\everyinsidenoteinsert\relax \doprocesslocalsetups{\noteparameter\c!setups}% experimental \doifelse{\noteparameter\c!paragraph}\v!yes @@ -1166,7 +1187,7 @@ \edef\currentnote{#1}% \strc_constructions_initialize{#1}% \strc_notes_synchronize - \edef\currentconstructionlistentry{\ctxcommand{notelistindex("#1",#2)}}% index in list cache + \edef\currentconstructionlistentry{\ctxcommand{notelistindex("\currentnote",#2)}}% index in list cache % as we can have collected notes (e.g. in tables) we need to recover % \currentdescriptionattribute and \currentdescriptionsynchronize % @@ -1186,7 +1207,7 @@ % \endgroup } -\unexpanded\def\strc_notes_inject_text +\unexpanded\def\strc_notes_inject_text % hm main? {\ctxcommand{savedlisttitle("\currentconstructionmain",\currentconstructionlistentry)}} \let\startpushnote\relax @@ -1245,14 +1266,14 @@ \def\strc_notes_place_inserts {\strc_notes_set_delayed % \strc_notes_synchronize % we need to know if it's delayed \ifconditional\c_strc_notes_delayed \else - \ifdim\ht\namedinsertionnumber\currentnote>\zeropoint % or a faster delayed test + \ifdim\ht\currentnoteinsertionnumber>\zeropoint % or a faster delayed test \strc_notes_place_inserts_indeed \fi \fi} \def\strc_notes_place_inserts_indeed {\relax - \ifdim\ht\namedinsertionnumber\currentnote>\zeropoint + \ifdim\ht\currentnoteinsertionnumber>\zeropoint \endgraf \ifvmode \whitespace @@ -1320,7 +1341,7 @@ {\doifelse{\noteparameter\c!paragraph}\v!yes {\vbox {\beginofshapebox - \iftrialtypesetting\unvcopied\else\unvboxed\fi\namedinsertionnumber\currentnote + \iftrialtypesetting\unvcopied\else\unvboxed\fi\currentnoteinsertionnumber \endofshapebox \let\strc_notes_between_paragraphs_indeed\strc_notes_between_paragraphs_first % shape works reverse \doreshapebox @@ -1328,7 +1349,7 @@ \donothing \donothing \donothing % get rid of penalties etc \innerflushshapebox \convertvboxtohbox}} - {\iftrialtypesetting\unvcopied\else\unvboxed\fi\namedinsertionnumber\currentnote}} + {\iftrialtypesetting\unvcopied\else\unvboxed\fi\currentnoteinsertionnumber}} %D Supporting end notes is surprisingly easy. Even better, we %D can combine this feature with solving the common \TEX\ @@ -1598,7 +1619,7 @@ \strc_notes_process\strc_notes_check_presence} \def\strc_notes_check_presence - {\ifdim\ht\namedinsertionnumber\currentnote>\zeropoint + {\ifdim\ht\currentnoteinsertionnumber>\zeropoint \notespresenttrue \fi} @@ -1638,16 +1659,16 @@ \def\docalculatetotalnoteheight {\ifcase\c_strc_notes_page_location % tricky here ! ! ! to be sorted out ! ! ! - \advance\totalnoteheight\normalexpanded{\additionaltotalnoteheight\namedinsertionnumber\currentnote}% + \advance\totalnoteheight\normalexpanded{\additionaltotalnoteheight\currentnoteinsertionnumber}% \fi} \def\docalculatetotalclevernoteheight {\ifcase\c_strc_notes_page_location \else % tricky here ! ! ! to be sorted out ! ! ! - \advance\totalnoteheight\normalexpanded{\additionaltotalnoteheight\namedinsertionnumber\currentnote}% + \advance\totalnoteheight\normalexpanded{\additionaltotalnoteheight\currentnoteinsertionnumber}% \fi} \def\docalculatetotalpagenoteheight - {\advance\totalnoteheight\normalexpanded{\additionaltotalnoteheight\namedinsertionnumber\currentnote}} + {\advance\totalnoteheight\normalexpanded{\additionaltotalnoteheight\currentnoteinsertionnumber}} \def\calculatetotalnoteheight {\totalnoteheight\zeropoint\strc_notes_process\docalculatetotalnoteheight} \def\calculatetotalclevernoteheight{\totalnoteheight\zeropoint\strc_notes_process\docalculatetotalclevernoteheight} @@ -1675,7 +1696,7 @@ %D \stoptyping % \def\dosynchronizenotes -% {\ifvoid\namedinsertionnumber\currentnote\else\insert\namedinsertionnumber\currentnote{\unvbox\namedinsertionnumber\currentnote}\fi} +% {\ifvoid\currentnoteinsertionnumber\else\insert\currentnoteinsertionnumber{\unvbox\currentnoteinsertionnumber}\fi} % % \def\synchronizenotes % {\strc_notes_process\dosynchronizenotes} -- cgit v1.2.3