diff options
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/buff-ver.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4140 -> 4149 bytes | |||
-rw-r--r-- | tex/context/base/context-version.png | bin | 105972 -> 105514 bytes | |||
-rw-r--r-- | tex/context/base/font-ini.mkvi | 8 | ||||
-rw-r--r-- | tex/context/base/font-mat.mkvi | 2 | ||||
-rw-r--r-- | tex/context/base/m-nodechart.mkvi | 257 | ||||
-rw-r--r-- | tex/context/base/scrn-bar.mkvi | 6 | ||||
-rw-r--r-- | tex/context/base/spac-ali.mkiv | 22 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24588 -> 24610 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 196231 -> 196235 bytes | |||
-rw-r--r-- | tex/context/base/strc-flt.mkvi | 6 | ||||
-rw-r--r-- | tex/context/base/strc-itm.mkvi | 26 | ||||
-rw-r--r-- | tex/context/base/strc-mat.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/strc-num.mkiv | 331 | ||||
-rw-r--r-- | tex/context/base/strc-pag.mkiv | 42 | ||||
-rw-r--r-- | tex/context/base/util-sql.lua | 4 |
16 files changed, 472 insertions, 236 deletions
diff --git a/tex/context/base/buff-ver.mkiv b/tex/context/base/buff-ver.mkiv index d18883faf..430834a30 100644 --- a/tex/context/base/buff-ver.mkiv +++ b/tex/context/base/buff-ver.mkiv @@ -11,6 +11,8 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +% check after-first and before-last breaks + \writestatus{loading}{ConTeXt Buffer Macros / Verbatim} \registerctxluafile{buff-ver}{1.001} diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex c8ba227ac..acc17624a 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 010ff8441..ce1935570 100644 --- a/tex/context/base/context-version.png +++ b/tex/context/base/context-version.png diff --git a/tex/context/base/font-ini.mkvi b/tex/context/base/font-ini.mkvi index 7969e58c0..897c56ed3 100644 --- a/tex/context/base/font-ini.mkvi +++ b/tex/context/base/font-ini.mkvi @@ -1746,7 +1746,7 @@ \unexpanded\def\font_helpers_set_current_font_size#size% {\edef\fontsize{#size}% - \font_helpers_check_big_math_synchronization + \font_helpers_check_big_math_synchronization % double? better in everymath? \font_helpers_synchronize_font} \unexpanded\def\font_helpers_set_current_font_style_alternative#style#alternative% \rmsl @@ -1757,20 +1757,20 @@ \unexpanded\def\font_helpers_set_current_font_style_size#style#size% \rma {\edef\fontstyle{#style}% \edef\fontsize {#size}% - \font_helpers_check_big_math_synchronization + \font_helpers_check_big_math_synchronization % double? better in everymath? \font_helpers_synchronize_font} \unexpanded\def\font_helpers_set_current_font_alternative_size#alternative#size% \sla {\edef\fontalternative{#alternative}% \edef\fontsize {#size}% - \font_helpers_check_big_math_synchronization + \font_helpers_check_big_math_synchronization % double? better in everymath? \font_helpers_synchronize_font} \unexpanded\def\font_helpers_set_current_font_style_alternative_size#style#alternative#size% \rmsla {\edef\fontstyle {#style}% \edef\fontalternative{#alternative}% \edef\fontsize {#size}% - \font_helpers_check_big_math_synchronization + \font_helpers_check_big_math_synchronization % double? better in everymath? \font_helpers_synchronize_font} \unexpanded\def\font_helpers_synchronize_font % we can have dups i.e. no need to let fontstrategy diff --git a/tex/context/base/font-mat.mkvi b/tex/context/base/font-mat.mkvi index 2a4abbff0..3fbfa7a55 100644 --- a/tex/context/base/font-mat.mkvi +++ b/tex/context/base/font-mat.mkvi @@ -100,7 +100,7 @@ \csname\??fontinstanceready \fontbody-\s!mm-\fontfamily-\fontsize\endcsname \else \ifcsname\??fontinstanceready \fontbody-\s!mm-\fontfamily \endcsname \settrue \c_font_auto_size \csname\??fontinstanceready \fontbody-\s!mm-\fontfamily \endcsname \else - \nullfont \settrue \c_font_auto_size + \settrue \c_font_auto_size \fi\fi} \def\font_helpers_set_math_family_indeed#mrtag#family% \fontface etc are also used later on diff --git a/tex/context/base/m-nodechart.mkvi b/tex/context/base/m-nodechart.mkvi new file mode 100644 index 000000000..359d598ce --- /dev/null +++ b/tex/context/base/m-nodechart.mkvi @@ -0,0 +1,257 @@ +\usemodule[chart] + +\startluacode + +local format = string.format +local points = number.nopts +local ptfactor = number.dimenfactors.pt + +local nodecodes = nodes.nodecodes +local kerncodes = nodes.kerncodes +local penaltycodes = nodes.penaltycodes +local gluecodes = nodes.gluecodes +local whatsitcodes = nodes.whatsitcodes + +local formatters = { } + +function formatters.glyph(n,comment) + -- subtype font char lang left right uchyph components xoffset yoffset width height depth + return format("\\doFLOWglyphnode{%s}{%s}{%s}{%s}{U+%05X}",comment,n.subtype,n.font,n.char,n.char) +end + +function formatters.disc(n,comment) + -- pre post replace + return format("\\doFLOWdiscnode{%s}{%s}",comment,n.subtype) +end + +function formatters.kern(n,comment) + -- subtype kern + -- return format("\\doFLOWkernnode{%s}{%s}{%s}",comment,kerncodes[n.subtype],points(n.kern)) + return format("\\doFLOWkernnode{%s}{%s}{%.4f}",comment,kerncodes[n.subtype],n.kern*ptfactor) +end + +function formatters.penalty(n,comment) + -- subtype penalty + return format("\\doFLOWpenaltynode{%s}{%s}{%s}",comment,"penalty",n.penalty) +end + +function formatters.glue(n,comment) + -- subtype width leader spec (stretch shrink ... + local s = n.spec + -- return format("\\doFLOWgluenode{%s}{%s}{%s}{%s}{%s}",comment,gluecodes[n.subtype],points(s.width),points(s.stretch),points(s.shrink)) + return format("\\doFLOWgluenode{%s}{%s}{%.4f}{%.4f}{%.4f}",comment,gluecodes[n.subtype],s.width*ptfactor,s.stretch*ptfactor,s.shrink*ptfactor) +end + +function formatters.whatsit(n,comment) + -- subtype width leader spec (stretch shrink ... + local subtype = n.subtype + local whatsit = whatsitcodes[subtype] + if whatsit == "dir" or whatsit == "localpar" then + return format("\\doFLOWdirnode{%s}{%s}{%s}",comment,whatsit,n.dir) + else + return nodecodes[n.id] + end +end + +local shapes = { -- I will make a dedicated set of shapes for this. + glyph = "procedure", + disc = "procedure", + kern = "action", + penalty = "action", + glue = "action", +} + +local function flow_nodes_to_chart(head,comment,x,y,how) + local current = head + while current do + local nodecode = nodecodes[current.id] + local formatter = formatters[nodecode] + local shape = shapes[nodecode] + y = y + 1 + local next = current.next + commands.flow_start_cell { shape = { framecolor = "nodechart:" .. nodecode } } + commands.flow_set_name(tostring(current)) + commands.flow_set_location(x,y) + if shape then + commands.flow_set_shape(shape) + end + if formatter then + commands.flow_set_text("node",formatter(current,comment)) + else + commands.flow_set_text("node",nodecode) + end + if next then + commands.flow_set_connection("bt","",tostring(next)) + end + if nodecode == "glyph" then + local components = current.components + if components then + commands.flow_set_connection("rl","",tostring(components)) + commands.flow_stop_cell() + n = flow_nodes_to_chart(components,"component",x+2,y-1) + else + commands.flow_stop_cell() + end + elseif nodecode == "disc" then + local pre = current.pre + local pos = current.post + local rep = current.replace + if pre and not rep and not rep then + if pre then + commands.flow_set_connection("rl","",tostring(pre)) + end + commands.flow_stop_cell() + if pre then + n = flow_nodes_to_chart(pre,"prebreak",x+1,y-1) + end + else + if pre then + commands.flow_set_connection("+rl","",tostring(pre)) + end + if rep then + commands.flow_set_connection("rl","",tostring(rep)) + end + if pos then + commands.flow_set_connection("-rl","",tostring(pos)) + end + commands.flow_stop_cell() + if pre then + n = flow_nodes_to_chart(pre,"prebreak",x+1,y-2) + end + if rep then + n = flow_nodes_to_chart(rep,"replacement",x+1,y-1) + end + if pos then + n = flow_nodes_to_chart(pos,"postbreak",x+1,y) + end + end + elseif nodecode == "hlist" then + local list = current.list + if list then + commands.flow_set_connection("rl","",tostring(list)) + commands.flow_stop_cell() + n = flow_nodes_to_chart(list,"list",x+2,y-1) + else + commands.flow_stop_cell() + end + else + commands.flow_stop_cell() + end + current = next + end + return n +end + +function commands.flow_nodes_to_chart(name,head,max) + commands.flow_start_chart(name) + flow_nodes_to_chart(head,"",1,0) + commands.flow_stop_chart() +end + +\stopluacode + +\unprotect + +\def\enspaceminus{\hskip.5em minus .25em\relax} + +\starttexdefinition unexpanded doFLOWglyphnode #comment #subtype #font #char #unicode + \dontleavehmode\hbox{\bf\setstrut\strut \doifsomething{#comment}{#comment\enspaceminus:\enspaceminus}glyph #subtype} + \vss + \dontleavehmode\hbox{\tx\setstrut\strut font\enspaceminus#font:\enspace#unicode:\enspaceminus\setfontofid{#font}\char#char} +\stoptexdefinition + +\starttexdefinition unexpanded doFLOWdiscnode #comment #subtype + \dontleavehmode\hbox{\bf\setstrut\strut disc} + \vss + \dontleavehmode\hbox{\tx\setstrut\strut} +\stoptexdefinition + +\starttexdefinition unexpanded doFLOWkernnode #comment #subtype #kern + \dontleavehmode\hbox{\bf\setstrut\strut#subtype} + \vss + \dontleavehmode\hbox{\tx\setstrut\strut#kern} +\stoptexdefinition + +\starttexdefinition unexpanded doFLOWpenaltynode #comment #subtype #penalty + \dontleavehmode\hbox{\bf\setstrut\strut#subtype} + \vss + \dontleavehmode\hbox{\tx\setstrut\strut#penalty} +\stoptexdefinition + +\starttexdefinition unexpanded doFLOWgluenode #comment #subtype #width #shrink #stretch + \dontleavehmode\hbox{\bf\setstrut\strut#subtype} + \vss + \dontleavehmode\hbox{\tx\setstrut\strut#width\enspaceminus-\enspaceminus#shrink\enspaceminus+\enspaceminus#stretch} +\stoptexdefinition + +\starttexdefinition unexpanded doFLOWdirnode #comment #subtype #direction + \dontleavehmode\hbox{\bf\setstrut\strut#subtype} + \vss + \dontleavehmode\hbox{\tx\setstrut\strut#direction} +\stoptexdefinition + +\defineframed + [flowcell:node] + [flowcell:base] + [\c!top=\vss, + \c!bottom=\vss, + \c!align=\v!middle, + \c!foregroundstyle=\tt] + +% this is a temporary interface ... we will have instances and optional settings + +\unexpanded\def\boxtoFLOWchart#name#max#box% + {\ctxcommand{flow_nodes_to_chart("#name",tex.box[\number#box].list,\number#max)}} + +\unexpanded\def\nextboxtoFLOWchart#name#max% + {\dowithnextbox{\boxtoFLOWchart{#name}{#max}\nextbox}} + +\unexpanded\def\hboxtoFLOWchart#name#max% + {\nextboxtoFLOWchart{#name}{#max}\hbox} + +\unexpanded\def\vboxtoFLOWchart#name#max% + {\nextboxtoFLOWchart{#name}{#max}\vbox} + +\protect + +\continueifinputfile{m-nodechart.mkvi} + +\definecolor[nodechart:glyph][darkred] + +\setupbodyfont[dejavu,10pt] + +\starttext + +\startTEXpage[offset=10pt] + + \hboxtoFLOWchart{dummy}{3}{an affil\discretionary{-}{-}{!}iation} + + \FLOWchart[dummy][width=14em,height=3em,dx=1em,dy=.75em,hcompact=yes] + +\stopTEXpage + +\startTEXpage[offset=10pt] + + \hboxtoFLOWchart{dummy}{3}{an affiliation} + + \FLOWchart[dummy][width=14em,height=3em,dx=.5em,dy=.75em,hcompact=yes] + +\stopTEXpage + +\startTEXpage[offset=10pt] + + \hboxtoFLOWchart{dummy}{3}{\nl effe fijn fietsen} + + \FLOWchart[dummy][width=14em,height=3em,dx=.5em,dy=.75em,hcompact=yes] + +\stopTEXpage + +\startTEXpage[offset=10pt] + + \hboxtoFLOWchart{dummy}{3}{\righttoleft t\kern 1pt est} + + \FLOWchart[dummy][width=14em,height=3em,dx=.5em,dy=.75em,hcompact=yes] + +\stopTEXpage + +\stoptext diff --git a/tex/context/base/scrn-bar.mkvi b/tex/context/base/scrn-bar.mkvi index dabc8f77d..1dadc26f3 100644 --- a/tex/context/base/scrn-bar.mkvi +++ b/tex/context/base/scrn-bar.mkvi @@ -280,7 +280,7 @@ \unskip} \def\scrn_bar_alternative_d - {\ifnum\nofsubpages>\plusone \doif{\counterparameter\s!subpage\c!state}\v!start{% + {\ifnum\nofsubpages>\plusone \doif{\namedcounterparameter\s!subpage\c!state}\v!start{% \d_scrn_bar_width \interactionbarparameter\c!width \d_scrn_bar_distance\interactionbarparameter\c!distance \d_scrn_bar_height \interactionbarparameter\c!height @@ -290,7 +290,7 @@ }\fi} \def\scrn_bar_alternative_e - {\ifnum\nofsubpages>\plusone \doif{\counterparameter\s!subpage\c!state}\v!start{% + {\ifnum\nofsubpages>\plusone \doif{\namedcounterparameter\s!subpage\c!state}\v!start{% \d_scrn_bar_width \interactionbarparameter\c!width \d_scrn_bar_distance\interactionbarparameter\c!distance \d_scrn_bar_height \interactionbarparameter\c!height @@ -305,7 +305,7 @@ }\fi} \def\scrn_bar_alternative_f - {\ifnum\nofsubpages>\plusone \doif{\counterparameter\s!subpage\c!state}\v!start{% + {\ifnum\nofsubpages>\plusone \doif{\namedcounterparameter\s!subpage\c!state}\v!start{% \d_scrn_bar_width \interactionbarparameter\c!width \d_scrn_bar_distance\interactionbarparameter\c!distance \d_scrn_bar_height \interactionbarparameter\c!height diff --git a/tex/context/base/spac-ali.mkiv b/tex/context/base/spac-ali.mkiv index d745c3844..9ebe7a761 100644 --- a/tex/context/base/spac-ali.mkiv +++ b/tex/context/base/spac-ali.mkiv @@ -178,10 +178,10 @@ \let\dohyphens\relax -\newconstant\c_spac_tolerance_default \c_spac_tolerance_default = 1500 % shouldn't that be 200 -\newconstant\c_spac_tolerance_minimum \c_spac_tolerance_minimum = 1500 -\newconstant\c_spac_tolerance_normal \c_spac_tolerance_normal = 3000 -\newconstant\c_spac_tolerance_extreme \c_spac_tolerance_extreme = 4500 +\newconstant\c_spac_tolerance_default \c_spac_tolerance_default 1500 % shouldn't that be 200 +\newconstant\c_spac_tolerance_minimum \c_spac_tolerance_minimum 1500 +\newconstant\c_spac_tolerance_normal \c_spac_tolerance_normal 3000 +\newconstant\c_spac_tolerance_extreme \c_spac_tolerance_extreme 4500 \def\spac_align_set_raggedness_left {\plustwo\bodyfontsize} \def\spac_align_set_raggedness_right {\plustwo\bodyfontsize} @@ -262,7 +262,7 @@ \def\v_spac_align_fill_amount_double {\plustwo fil} \def\v_spac_align_fill_amount_space {\plustwo fil} % can be added to xspace if we have a key \def\v_spac_align_fill_amount_half {.5fil} -\let\v_spac_align_space_amount \interwordspace +\let\v_spac_align_space_amount \interwordspace \def\v_spac_align_space_amount_x {.5\emwidth} \newskip\s_zero_plus_one_fil \s_zero_plus_one_fil = 0pt plus 1fil @@ -871,13 +871,13 @@ \let\stoplinealignment\spac_align_wrapper_stop -\unexpanded\def\startleftaligned {\spac_align_wrapper_start[\v!left ]} \let\stopleftaligned \spac_align_wrapper_stop -\unexpanded\def\startmiddlealigned{\spac_align_wrapper_start[\v!middle]} \let\stopmiddlealigned \spac_align_wrapper_stop -\unexpanded\def\startrightaligned {\spac_align_wrapper_start[\v!right ]} \let\stoprightaligned \spac_align_wrapper_stop -\unexpanded\def\startmaxaligned {\spac_align_wrapper_start[\v!max ]} \let\stopmaxaligned \spac_align_wrapper_stop +\unexpanded\def\startleftaligned {\spac_align_wrapper_start[\v!left ]} \let\stopleftaligned \spac_align_wrapper_stop +\unexpanded\def\startmiddlealigned{\spac_align_wrapper_start[\v!middle]} \let\stopmiddlealigned\spac_align_wrapper_stop +\unexpanded\def\startrightaligned {\spac_align_wrapper_start[\v!right ]} \let\stoprightaligned \spac_align_wrapper_stop +\unexpanded\def\startmaxaligned {\spac_align_wrapper_start[\v!max ]} \let\stopmaxaligned \spac_align_wrapper_stop -\let\startmidaligned \startmiddlealigned \let\stopmidaligned \stopmiddlealignment -\let\startcenteraligned\startmiddlealigned \let\stopcenteraligned \stopmiddlealignment +\let\startmidaligned \startmiddlealigned \let\stopmidaligned \stopmiddlealigned +\let\startcenteraligned\startmiddlealigned \let\stopcenteraligned\stopmiddlealigned \unexpanded\def\leftaligned {\spac_align_wrapper_handle\v!left } \unexpanded\def\middlealigned{\spac_align_wrapper_handle\v!middle} diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 2efedc8c8..2dc5dcfce 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 cdf445143..3bf4f7ebe 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-flt.mkvi b/tex/context/base/strc-flt.mkvi index 07013b292..1f1d5c02c 100644 --- a/tex/context/base/strc-flt.mkvi +++ b/tex/context/base/strc-flt.mkvi @@ -140,7 +140,7 @@ %D Individial settings: -\strc_counter_preset_using_parameter\setupcaption\sharedcounterparameter +\strc_counter_preset_using_parameter\setupcaption\rootcounterparameter \appendtoks \let\currentfloat\currentfloatcaption @@ -648,7 +648,7 @@ \strc_floats_check_extra_actions \strc_floats_analyze_variables_two \strc_floats_place_packaged_boxes - \dostoptagged % tricky ... needs checking + \dostoptagged % tricky .... needs checking % we need to carry over the par because of side floats \global\d_page_sides_downshift \zeropoint \global\d_page_sides_extrashift\zeropoint @@ -959,7 +959,7 @@ \setvalue{\??extrafloataction \v!line}#1{} % only -n*line is handled (see ***) \setvalue{\??extrafloataction \s!unknown}#1{\movedownsidefloat[#1]} -\def\strc_floats_check_extra_actions % less tracingthis way ... +\def\strc_floats_check_extra_actions % less tracingthis way .... {\doifnotinset\v!text\floatlocation % fuzzy, text overloads left, since then it's a directive {\let\extrafloatlocation\empty % \d_page_sides_downshift will be reset afterwards, and can diff --git a/tex/context/base/strc-itm.mkvi b/tex/context/base/strc-itm.mkvi index 07a32dd60..2975711db 100644 --- a/tex/context/base/strc-itm.mkvi +++ b/tex/context/base/strc-itm.mkvi @@ -266,27 +266,27 @@ section = structures.sections.currentid(), }, prefixdata = structures.helpers.simplify { - prefix = "\counterparameter\v_strc_itemgroups_counter\c!prefix", - separatorset = "\counterparameter\v_strc_itemgroups_counter\c!prefixseparatorset", - conversion = \!!bs\counterparameter\v_strc_itemgroups_counter\c!prefixconversion\!!es, - conversionset = "\counterparameter\v_strc_itemgroups_counter\c!prefixconversionset", - set = "\counterparameter\v_strc_itemgroups_counter\c!prefixset", - segments = "\counterparameter\v_strc_itemgroups_counter\c!prefixsegments", + prefix = "\namedcounterparameter\v_strc_itemgroups_counter\c!prefix", + separatorset = "\namedcounterparameter\v_strc_itemgroups_counter\c!prefixseparatorset", + conversion = \!!bs\namedcounterparameter\v_strc_itemgroups_counter\c!prefixconversion\!!es, + conversionset = "\namedcounterparameter\v_strc_itemgroups_counter\c!prefixconversionset", + set = "\namedcounterparameter\v_strc_itemgroups_counter\c!prefixset", + segments = "\namedcounterparameter\v_strc_itemgroups_counter\c!prefixsegments", % segments = "\askedprefixsegments", - connector = \!!bs\counterparameter\v_strc_itemgroups_counter\c!prefixconnector\!!es, + connector = \!!bs\namedcounterparameter\v_strc_itemgroups_counter\c!prefixconnector\!!es, }, numberdata = structures.helpers.simplify { numbers = structures.counters.compact("\v_strc_itemgroups_counter",nil,true), - separatorset = "\counterparameter\v_strc_itemgroups_counter\c!numberseparatorset", - % conversion = "\counterparameter\v_strc_itemgroups_counter\c!numberconversion", + separatorset = "\namedcounterparameter\v_strc_itemgroups_counter\c!numberseparatorset", + % conversion = "\namedcounterparameter\v_strc_itemgroups_counter\c!numberconversion", % conversion = "\currentitemgroupconversionset", - % conversionset = "\counterparameter\v_strc_itemgroups_counter\c!numberconversionset", + % conversionset = "\namedcounterparameter\v_strc_itemgroups_counter\c!numberconversionset", % todo: fixedconversion = "\currentitemgroupconversionset", % temp hack: conversionset = "fixed::\currentitemgroupconversionset", % % for the moment no stopper, we need to make references configurable first - % stopper = \!!bs\counterparameter\v_strc_itemgroups_counter\c!numberstopper\!!es, - segments = "\counterparameter\v_strc_itemgroups_counter\c!numbersegments", + % stopper = \!!bs\namedcounterparameter\v_strc_itemgroups_counter\c!numberstopper\!!es, + segments = "\namedcounterparameter\v_strc_itemgroups_counter\c!numbersegments", }, }) }% @@ -613,7 +613,7 @@ \def\strc_itemgroups_insert_item_counter_indeed {\begingroup - \strc_counters_setup + \setupcounter [\v_strc_itemgroups_counter]% [%\c!prefix=\v!no, \c!prefix=\itemgroupparameter\c!prefix, diff --git a/tex/context/base/strc-mat.mkiv b/tex/context/base/strc-mat.mkiv index ec4d7f643..0d84bf8b1 100644 --- a/tex/context/base/strc-mat.mkiv +++ b/tex/context/base/strc-mat.mkiv @@ -57,7 +57,7 @@ [\v!formula] [numbers,characters] % no \v! ? -\strc_counter_preset_using_parameter\setupformulas\sharedcounterparameter +\strc_counter_preset_using_parameter\setupformulas\rootcounterparameter \appendtoks \strc_counter_setup_using_parameter\v!formula\formulaparameter diff --git a/tex/context/base/strc-num.mkiv b/tex/context/base/strc-num.mkiv index 0e5339000..c424bd6bf 100644 --- a/tex/context/base/strc-num.mkiv +++ b/tex/context/base/strc-num.mkiv @@ -23,91 +23,56 @@ \installcorenamespace{counter} -\unexpanded\def\setupstructurecounting{\dodoubleempty\getparameters[\??counter]} +\installcommandhandler \??counter {counter} \??counter -\setupstructurecounting +\let\setupstructurecounting\setupcounter + +\setupcounter [\c!way=\v!by\v!chapter, % \c!blockway=, % \c!prefixstarter=, % \c!prefixstopper=, \c!prefixconnector=., - \c!prefixsegments=\autostructureprefixsegments\sharedcounterparameter, + \c!prefixsegments=\autostructureprefixsegments\rootcounterparameter, \c!start=\zerocount, \c!prefix=\v!yes, \c!state=\v!start] -\def\strc_counters_the#1% we need a nicer name - {\ifcsname\??counter#1\c!number\endcsname - \expandafter\strc_counters_the\csname\??counter#1\c!number\endcsname - \else - #1% - \fi} - \def\autostructureprefixsegments#1% todo: \c!prefixsegments=\v!auto {2:\thenamedheadlevel{\ctxcommand{way("#1\c!way")}}} -\def\counterparameter#1#2% this will become \named.... - {\csname - \ifcsname\??counter#1#2\endcsname - \??counter#1#2% - \else\ifcsname\??counter\strc_counters_the{#1}#2\endcsname - \??counter\strc_counters_the{#1}#2% - \else\ifcsname\??counter#2\endcsname - \??counter#2% - \else - \s!empty - \fi\fi\fi - \endcsname} - -\def\sharedcounterparameter#1% - {\csname - \ifcsname\??counter#1\endcsname - \??counter#1% - \else - \s!empty - \fi - \endcsname} - -\unexpanded\def\definecounter - {\dodoubleempty\strc_counters_define} - -\def\strc_counters_define[#1][#2]% - {\doifassignmentelse{#2} - {\strc_counters_define_yes[#1][#2]} - {\doifelsenothing{#2} - {\strc_counters_define_yes[#1][]} - {\strc_counters_define_nop[#1][#2]}}} - -\def\strc_counters_define_yes[#1][#2]% - {\getparameters[\??counter#1][\s!counter=,#2]% counter is for internal purposes - \edef\p_start{\counterparameter{#1}\c!start}% - \ctxcommand{definecounter { - name = "#1", - start = \ifx\p_start\empty0\else\number\p_start\fi, - counter = "\counterparameter{#1}\s!counter", - method = "\counterparameter{#1}\c!method", - }}% - \strc_counters_check_setup{#1}} - -\def\strc_counters_define_nop[#1][#2]% inherit - {\getparameters[\??counter#1][\c!number=#2]% - \strc_counters_check_setup{#1}} - -\unexpanded\def\setupcounter - {\dodoubleargument\strc_counters_setup} - -% \def\strc_counters_setup[#1][#2]% -% {\getparameters[\??counter#1][\c!start=,#2]% hm, start -% \strc_counters_check_setup{#1}} - -\def\strc_counters_setup[#1][#2]% - {\getparameters[\??counter#1][#2]% no start here - \strc_counters_check_setup{#1}} +\appendtoks + \resetcounterparameter\s!counter +\to \everypresetcounter + +\appendtoks + \ifx\currentcounterparent\empty + \edef\p_start{\counterparameter\c!start}% + \ctxcommand{definecounter { + name = "\currentcounter", + start = \ifx\p_start\empty0\else\number\p_start\fi, + counter = "\counterparameter\s!counter", + method = "\counterparameter\c!method", + }}% + \letcounterparameter\s!name\currentcounter + \else + \letcounterparameter\s!name\currentcounterparent + \fi + \strc_counters_check_setup +\to \everydefinecounter + +\appendtoks + \ifx\currentcounter\empty \else + \edef\p_start{\counterparameter\c!start}% + \setexpandedcounterparameter\c!start{\ifx\p_start\empty0\else\number\p_start\fi}% + \strc_counters_check_setup + \fi +\to \everysetupcounter % % % % \def\strc_counters_way#1% slow, we need to store it at the tex end - {\ctxcommand{way("\counterparameter{#1}\c!way")}} + {\ctxcommand{way("\namedcounterparameter{#1}\c!way")}} % \def\thenamedcounterlevel#1% % {\thenamedheadlevel{\strc_counters_way{#1}}} @@ -115,23 +80,31 @@ \def\thenamedcounterlevel#1% {\xthenamedheadlevel{\strc_counters_way{#1}}} -\def\strc_counters_check_setup#1% does it have to happen here? - {% this can be done at the lua end / a bit messy here ... todo ... - \ifcsname\??counter#1\c!number\endcsname - \doifelsevalue {\??counter#1\c!number}{#1} {\letbeundefined{\??counter#1\c!number}}% - {\doifvaluenothing{\??counter#1\c!number} {\letbeundefined{\??counter#1\c!number}}}% - \fi - \ifcsname\??counter#1\c!number\endcsname - % it's a clone - \else - \edef\currentcounterlevel{\thenamedcounterlevel{#1}}% - \edef\p_start{\counterparameter{#1}\c!start}% - \ctxcommand{checkcountersetup("#1",\currentcounterlevel,\ifx\p_start\empty0\else\number\p_start\fi,"\counterparameter{#1}\c!state")}% +% \def\strc_counters_check_setup#1% does it have to happen here? +% {% this can be done at the lua end / a bit messy here ... todo ... +% \ifcsname\??counter#1\c!number\endcsname +% \doifelsevalue {\??counter#1\c!number}{#1} {\letbeundefined{\??counter#1\c!number}}% +% {\doifvaluenothing{\??counter#1\c!number} {\letbeundefined{\??counter#1\c!number}}}% +% \fi +% \ifcsname\??counter#1\c!number\endcsname +% % it's a clone +% \else +% \edef\currentcounterlevel{\thenamedcounterlevel{#1}}% +% \edef\p_start{\counterparameter{#1}\c!start}% +% \ctxcommand{checkcountersetup("#1",\currentcounterlevel,\ifx\p_start\empty0\else\number\p_start\fi,"\counterparameter{#1}\c!state")}% +% \fi} + +\def\strc_counters_check_setup + {\edef\p_name{\directcounterparameter\s!name}% + \ifx\currentcounter\p_name + \edef\currentcounterlevel{\thenamedcounterlevel\currentcounter}% + \edef\p_start{\counterparameter\c!start}% + \ctxcommand{checkcountersetup("\currentcounter",\currentcounterlevel,\ifx\p_start\empty0\else\number\p_start\fi,"\counterparameter\c!state")}% \fi} -\unexpanded\def\doifcounterelse #1{\ctxcommand{doifelsecounter("\strc_counters_the{#1}")}} -\unexpanded\def\doifcounter #1{\ctxcommand{doifcounter ("\strc_counters_the{#1}")}} -\unexpanded\def\doifnotcounter #1{\ctxcommand{doifnotcounter ("\strc_counters_the{#1}")}} +\unexpanded\def\doifcounterelse #1{\ctxcommand{doifelsecounter("\namedcounterparameter{#1}\s!name")}} +\unexpanded\def\doifcounter #1{\ctxcommand{doifcounter ("\namedcounterparameter{#1}\s!name")}} +\unexpanded\def\doifnotcounter #1{\ctxcommand{doifnotcounter ("\namedcounterparameter{#1}\s!name")}} \unexpanded\def\setcounter {\dotripleempty \strc_counters_set_interfaced} \unexpanded\def\setcounterown {\dotripleempty \strc_counters_setown_interfaced} @@ -317,27 +290,27 @@ \def\strc_counters_prev #1{\strc_counters_prev_sub {#1}\plusone} \def\strc_counters_subs #1{\strc_counters_subs_sub {#1}\plusone} -\unexpanded\def\strc_counters_set_sub #1#2#3{\ctxcommand{setcounter ("\strc_counters_the{#1}",\number#2,\number#3)}} -\unexpanded\def\strc_counters_setown_sub #1#2#3{\ctxcommand{setowncounter ("\strc_counters_the{#1}",\number#2,"#3")}} -\unexpanded\def\strc_counters_restart_sub #1#2#3{\ctxcommand{restartcounter("\strc_counters_the{#1}",\number#2,\number#3)}} -\unexpanded\def\strc_counters_reset_sub #1#2{\ctxcommand{resetcounter ("\strc_counters_the{#1}",\number#2)}} -\unexpanded\def\strc_counters_increment_sub #1#2{\ctxcommand{addcounter ("\strc_counters_the{#1}",\number#2,1)}} -\unexpanded\def\strc_counters_decrement_sub #1#2{\ctxcommand{addcounter ("\strc_counters_the{#1}",\number#2,-1)}} +\unexpanded\def\strc_counters_set_sub #1#2#3{\ctxcommand{setcounter ("\namedcounterparameter{#1}\s!name",\number#2,\number#3)}} +\unexpanded\def\strc_counters_setown_sub #1#2#3{\ctxcommand{setowncounter ("\namedcounterparameter{#1}\s!name",\number#2,"#3")}} +\unexpanded\def\strc_counters_restart_sub #1#2#3{\ctxcommand{restartcounter("\namedcounterparameter{#1}\s!name",\number#2,\number#3)}} +\unexpanded\def\strc_counters_reset_sub #1#2{\ctxcommand{resetcounter ("\namedcounterparameter{#1}\s!name",\number#2)}} +\unexpanded\def\strc_counters_increment_sub #1#2{\ctxcommand{addcounter ("\namedcounterparameter{#1}\s!name",\number#2,1)}} +\unexpanded\def\strc_counters_decrement_sub #1#2{\ctxcommand{addcounter ("\namedcounterparameter{#1}\s!name",\number#2,-1)}} - \def\strc_counters_raw_sub #1#2{\ctxcommand{countervalue ("\strc_counters_the{#1}",\number#2)}} % maybe raw - \def\strc_counters_last_sub #1#2{\ctxcommand{lastcountervalue ("\strc_counters_the{#1}",\number#2)}} - \def\strc_counters_first_sub #1#2{\ctxcommand{firstcountervalue ("\strc_counters_the{#1}",\number#2)}} - \def\strc_counters_next_sub #1#2{\ctxcommand{nextcountervalue ("\strc_counters_the{#1}",\number#2)}} - \def\strc_counters_prev_sub #1#2{\ctxcommand{previouscountervalue("\strc_counters_the{#1}",\number#2)}} - \def\strc_counters_subs_sub #1#2{\ctxcommand{subcountervalues ("\strc_counters_the{#1}",\number#2)}} + \def\strc_counters_raw_sub #1#2{\ctxcommand{countervalue ("\namedcounterparameter{#1}\s!name",\number#2)}} % maybe raw + \def\strc_counters_last_sub #1#2{\ctxcommand{lastcountervalue ("\namedcounterparameter{#1}\s!name",\number#2)}} + \def\strc_counters_first_sub #1#2{\ctxcommand{firstcountervalue ("\namedcounterparameter{#1}\s!name",\number#2)}} + \def\strc_counters_next_sub #1#2{\ctxcommand{nextcountervalue ("\namedcounterparameter{#1}\s!name",\number#2)}} + \def\strc_counters_prev_sub #1#2{\ctxcommand{previouscountervalue("\namedcounterparameter{#1}\s!name",\number#2)}} + \def\strc_counters_subs_sub #1#2{\ctxcommand{subcountervalues ("\namedcounterparameter{#1}\s!name",\number#2)}} -\unexpanded\def\strc_counters_save #1{\ctxcommand{savecounter ("\strc_counters_the{#1}")}} -\unexpanded\def\strc_counters_restore #1{\ctxcommand{restorecounter("\strc_counters_the{#1}")}} +\unexpanded\def\strc_counters_save #1{\ctxcommand{savecounter ("\namedcounterparameter{#1}\s!name")}} +\unexpanded\def\strc_counters_restore #1{\ctxcommand{restorecounter("\namedcounterparameter{#1}\s!name")}} -\unexpanded\def\strc_counters_incremented #1{\ctxcommand{incrementedcounter("\strc_counters_the{#1}",1, 1)}} -\unexpanded\def\strc_counters_decremented #1{\ctxcommand{incrementedcounter("\strc_counters_the{#1}",1,-1)}} +\unexpanded\def\strc_counters_incremented #1{\ctxcommand{incrementedcounter("\namedcounterparameter{#1}\s!name",1, 1)}} +\unexpanded\def\strc_counters_decremented #1{\ctxcommand{incrementedcounter("\namedcounterparameter{#1}\s!name",1,-1)}} -\unexpanded\def\showcounter [#1]{\ctxcommand{tracecounter("\strc_counters_the{#1}")}} +\unexpanded\def\showcounter [#1]{\ctxcommand{tracecounter("\namedcounterparameter{#1}\s!name")}} \unexpanded\def\incrementedcounter [#1]{\strc_counters_incremented{#1}} % expandable, no \dosingleargument \unexpanded\def\decrementedcounter [#1]{\strc_counters_decremented{#1}} % expandable, no \dosingleargument @@ -369,63 +342,64 @@ \strc_counters_reset{#1}% \fi \fi - \ctxcommand{addcounter("\strc_counters_the{#1}",\number#2,1)}} + \ctxcommand{addcounter("\namedcounterparameter{#1}\s!name",\number#2,1)}} \unexpanded\def\convertedcounter {\dodoubleempty\strc_counters_converted} \def\strc_counters_converted[#1][#2]% {\begingroup - \ifsecondargument\getparameters[\??counter#1][#2]\fi + \edef\currentcounter{#1}% + \ifsecondargument\setupcurrentcounter[#2]\fi \ctxlua{structures.sections.prefixedconverted( - "\strc_counters_the{#1}", + "\counterparameter\s!name", { - prefix = "\counterparameter{#1}\c!prefix", - separatorset = "\counterparameter{#1}\c!prefixseparatorset", - conversion = "\counterparameter{#1}\c!prefixconversion", - conversionset = "\counterparameter{#1}\c!prefixconversionset", - starter = \!!bs\counterparameter{#1}\c!prefixstarter\!!es, - stopper = \!!bs\counterparameter{#1}\c!prefixstopper\!!es, - set = "\counterparameter{#1}\c!prefixset", - segments = "\counterparameter{#1}\c!prefixsegments", - connector = \!!bs\counterparameter{#1}\c!prefixconnector\!!es, + prefix = "\counterparameter\c!prefix", + separatorset = "\counterparameter\c!prefixseparatorset", + conversion = "\counterparameter\c!prefixconversion", + conversionset = "\counterparameter\c!prefixconversionset", + starter = \!!bs\counterparameter\c!prefixstarter\!!es, + stopper = \!!bs\counterparameter\c!prefixstopper\!!es, + set = "\counterparameter\c!prefixset", + segments = "\counterparameter\c!prefixsegments", + connector = \!!bs\counterparameter\c!prefixconnector\!!es, }, { - order = "\counterparameter{#1}\c!numberorder", - separatorset = "\counterparameter{#1}\c!numberseparatorset", - conversion = \!!bs\counterparameter{#1}\c!numberconversion\!!es, - conversionset = "\counterparameter{#1}\c!numberconversionset", - starter = \!!bs\counterparameter{#1}\c!numberstarter\!!es, - stopper = \!!bs\counterparameter{#1}\c!numberstopper\!!es, - segments = "\counterparameter{#1}\c!numbersegments", - type = "\counterparameter{#1}\c!type", - criterium = "\counterparameter{#1}\c!criterium", % might change if we also want this with sectioning + order = "\counterparameter\c!numberorder", + separatorset = "\counterparameter\c!numberseparatorset", + conversion = \!!bs\counterparameter\c!numberconversion\!!es, + conversionset = "\counterparameter\c!numberconversionset", + starter = \!!bs\counterparameter\c!numberstarter\!!es, + stopper = \!!bs\counterparameter\c!numberstopper\!!es, + segments = "\counterparameter\c!numbersegments", + type = "\counterparameter\c!type", + criterium = "\counterparameter\c!criterium", % might change if we also want this with sectioning } )}% \endgroup} \def\directconvertedcounter#1#2% name, type {\ctxlua{structures.sections.prefixedconverted( - "\strc_counters_the{#1}", + "\namedcounterparameter{#1}\s!name", { - prefix = "\counterparameter{#1}\c!prefix", - separatorset = "\counterparameter{#1}\c!prefixseparatorset", - conversion = "\counterparameter{#1}\c!prefixconversion", - conversionset = "\counterparameter{#1}\c!prefixconversionset", - % starter = \!!bs\counterparameter{#1}\c!prefixstarter\!!es, - % stopper = \!!bs\counterparameter{#1}\c!prefixstopper\!!es, - set = "\counterparameter{#1}\c!prefixset", - segments = "\counterparameter{#1}\c!prefixsegments", - connector = \!!bs\counterparameter{#1}\c!prefixconnector\!!es, + prefix = "\namedcounterparameter{#1}\c!prefix", + separatorset = "\namedcounterparameter{#1}\c!prefixseparatorset", + conversion = "\namedcounterparameter{#1}\c!prefixconversion", + conversionset = "\namedcounterparameter{#1}\c!prefixconversionset", + % starter = \!!bs\namedcounterparameter{#1}\c!prefixstarter\!!es, + % stopper = \!!bs\namedcounterparameter{#1}\c!prefixstopper\!!es, + set = "\namedcounterparameter{#1}\c!prefixset", + segments = "\namedcounterparameter{#1}\c!prefixsegments", + connector = \!!bs\namedcounterparameter{#1}\c!prefixconnector\!!es, }, { - order = "\counterparameter{#1}\c!numberorder", - separatorset = "\counterparameter{#1}\c!numberseparatorset", - conversion = \!!bs\counterparameter{#1}\c!numberconversion\!!es, - conversionset = "\counterparameter{#1}\c!numberconversionset", - starter = \!!bs\counterparameter{#1}\c!numberstarter\!!es, - stopper = \!!bs\counterparameter{#1}\c!numberstopper\!!es, - segments = "\counterparameter{#1}\c!numbersegments", + order = "\namedcounterparameter{#1}\c!numberorder", + separatorset = "\namedcounterparameter{#1}\c!numberseparatorset", + conversion = \!!bs\namedcounterparameter{#1}\c!numberconversion\!!es, + conversionset = "\namedcounterparameter{#1}\c!numberconversionset", + starter = \!!bs\namedcounterparameter{#1}\c!numberstarter\!!es, + stopper = \!!bs\namedcounterparameter{#1}\c!numberstopper\!!es, + segments = "\namedcounterparameter{#1}\c!numbersegments", type = "#2", } )}} @@ -440,49 +414,53 @@ \secondargumentfalse\strc_counters_converted[#1][]% \fi} -\unexpanded\def\doifdefinedcounter#1% - {\ifcsname\s!number#1\c!number\endcsname - \expandafter\firstofoneargument - \else - \expandafter\gobbleoneargument - \fi} - -\unexpanded\def\doifundefinedcounter#1% - {\ifcsname\s!number#1\c!number\endcsname - \expandafter\gobbleoneargument - \else - \expandafter\firstofoneargument - \fi} +% \unexpanded\def\doifdefinedcounter#1% +% {\ifcsname\namedcounterhash{#1}\s!name\endcsname +% \expandafter\firstofoneargument +% \else +% \expandafter\gobbleoneargument +% \fi} +% +% \unexpanded\def\doifundefinedcounter#1% +% {\ifcsname\namedcounterhash{#1}\s!name\endcsname +% \expandafter\gobbleoneargument +% \else +% \expandafter\firstofoneargument +% \fi} +% +% \unexpanded\def\doifdefinedcounterelse#1% +% {\ifcsname\namedcounterhash{#1}\s!name\endcsname +% \expandafter\firstoftwoarguments +% \else +% \expandafter\secondoftwoarguments +% \fi} -\unexpanded\def\doifdefinedcounterelse#1% - {\ifcsname\s!number#1\c!number\endcsname - \expandafter\firstoftwoarguments - \else - \expandafter\secondoftwoarguments - \fi} +\unexpanded\def\doifdefinedcounter {\doifcommandhandler \??counter} +\unexpanded\def\doifundefinedcounter {\doifnotcommandhandler \??counter} +\unexpanded\def\doifdefinedcounterelse{\doifelsecommandhandler\??counter} %D What follows is a compatibility layer. -\let \numberparameter \counterparameter % {name}\c!key +\let \numberparameter \namedcounterparameter % {name}\c!key -\let \definenumber \definecounter % [name] -\let \setupnumber \setupcounter % [name][setups] +\let \definenumber \definecounter % [name] +\let \setupnumber \setupcounter % [name][setups] -\let \setnumber \setcounter % [name]{value} -\let \resetnumber \resetcounter % [name] -\let \savenumber \savecounter % [name] -\let \restorenumber \restorecounter % [name] -\let \incrementnumber \incrementcounter % [name] -\let \decrementnumber \decrementcounter % [name] -\let \rawnumber \rawcounter % [name] -\let \getnumber \convertedcounter % [name] -\let \convertednumber \convertedcounter % [name] +\let \setnumber \setcounter % [name]{value} +\let \resetnumber \resetcounter % [name] +\let \savenumber \savecounter % [name] +\let \restorenumber \restorecounter % [name] +\let \incrementnumber \incrementcounter % [name] +\let \decrementnumber \decrementcounter % [name] +\let \rawnumber \rawcounter % [name] +\let \getnumber \convertedcounter % [name] +\let \convertednumber \convertedcounter % [name] -\let \doifdefinednumber \doifdefinedcounter % {number}{true} -\let \doifundefinednumber \doifnotdefinedcounter % {number}{true} -\let \doifdefinednumberelse \doifdefinedcounterelse % {number}{true}{false} +\let \doifdefinednumber \doifdefinedcounter % {number}{true} +\let \doifundefinednumber \doifnotdefinedcounter % {number}{true} +\let \doifdefinednumberelse \doifdefinedcounterelse % {number}{true}{false} -\let \setupnumbering \setupstructurecounting +\let \setupnumbering \setupcounter %D Helpers: @@ -642,10 +620,9 @@ \let\m_strc_counters_last_registered_synchronize\relax \def\strc_counter_setup_using_parameter#1#2% name \someparameter - {\edef\p_start{#2\c!start}% - \normalexpanded{\setupcounter + {\setupcounter [#1] - [ \c!start=\ifx\p_start\empty0\else\number\p_start\fi, + [ \c!start=#2\c!start, \c!state=#2\c!state, % beware, "" == start \c!way=#2\c!way, % @@ -665,7 +642,7 @@ \c!numberconversionset=#2\c!numberconversionset, \c!numberstarter=#2\c!numberstarter, \c!numberstopper=#2\c!numberstopper, - \c!numbersegments=#2\c!numbersegments]}} + \c!numbersegments=#2\c!numbersegments]} \def\strc_counter_preset_using_parameter#1#2% \setupcommand \someparameter {#1% diff --git a/tex/context/base/strc-pag.mkiv b/tex/context/base/strc-pag.mkiv index 8071fbab1..85cfeb40f 100644 --- a/tex/context/base/strc-pag.mkiv +++ b/tex/context/base/strc-pag.mkiv @@ -87,11 +87,11 @@ \let\m_strc_pagenumbers_state_old\zerocount \let\m_strc_pagenumbers_state_new\zerocount -\def\strc_pagenumbers_save_state#1{\edef\m_strc_pagenumbers_state_old\m_strc_pagenumbers_state_old{\counterparameter#1\c!state}} +\def\strc_pagenumbers_save_state#1{\edef\m_strc_pagenumbers_state_old{\namedcounterparameter#1\c!state}} -\def\strc_pagenumbers_setup_realpage[#1]{\strc_pagenumbers_save_state\s!realpage\strc_counters_setup[\s!realpage][#1]\the\everysetuprealpagenumber} -\def\strc_pagenumbers_setup_userpage[#1]{\strc_pagenumbers_save_state\s!userpage\strc_counters_setup[\s!userpage][#1]\the\everysetupuserpagenumber} -\def\strc_pagenumbers_setup_subpage [#1]{\strc_pagenumbers_save_state\s!subpage \strc_counters_setup[\s!subpage ][#1]\the\everysetupsubpagenumber } +\def\strc_pagenumbers_setup_realpage[#1]{\strc_pagenumbers_save_state\s!realpage\setupcounter[\s!realpage][#1]\the\everysetuprealpagenumber} +\def\strc_pagenumbers_setup_userpage[#1]{\strc_pagenumbers_save_state\s!userpage\setupcounter[\s!userpage][#1]\the\everysetupuserpagenumber} +\def\strc_pagenumbers_setup_subpage [#1]{\strc_pagenumbers_save_state\s!subpage \setupcounter[\s!subpage ][#1]\the\everysetupsubpagenumber } \unexpanded\def\resetrealpagenumber {} % not permitted \unexpanded\def\resetuserpagenumber {\strc_counters_reset\s!userpage} @@ -108,18 +108,18 @@ \def\strc_pagenumbers_page_state_save % \normalexpanded? {\ctxlua{structures.pages.save({ - prefix = "\counterparameter\s!userpage\c!prefix", - separatorset = "\counterparameter\s!userpage\c!prefixseparatorset", - conversion = "\counterparameter\s!userpage\c!prefixconversion", - conversionset = "\counterparameter\s!userpage\c!prefixconversionset", - set = "\counterparameter\s!userpage\c!prefixset", - segments = "\counterparameter\s!userpage\c!prefixsegments", - connector = \!!bs\counterparameter\s!userpage\c!prefixconnector\!!es, + prefix = "\namedcounterparameter\s!userpage\c!prefix", + separatorset = "\namedcounterparameter\s!userpage\c!prefixseparatorset", + conversion = "\namedcounterparameter\s!userpage\c!prefixconversion", + conversionset = "\namedcounterparameter\s!userpage\c!prefixconversionset", + set = "\namedcounterparameter\s!userpage\c!prefixset", + segments = "\namedcounterparameter\s!userpage\c!prefixsegments", + connector = \!!bs\namedcounterparameter\s!userpage\c!prefixconnector\!!es, },{ - conversion = "\counterparameter\s!userpage\c!numberconversion", - conversionset = "\counterparameter\s!userpage\c!numberconversionset", - starter = \!!bs\counterparameter\s!userpage\c!numberstarter\!!es, - stopper = \!!bs\counterparameter\s!userpage\c!numberstopper\!!es, + conversion = "\namedcounterparameter\s!userpage\c!numberconversion", + conversionset = "\namedcounterparameter\s!userpage\c!numberconversionset", + starter = \!!bs\namedcounterparameter\s!userpage\c!numberstarter\!!es, + stopper = \!!bs\namedcounterparameter\s!userpage\c!numberstopper\!!es, } )}} @@ -129,7 +129,7 @@ \installcorenamespace{pagestatestack} % no level yet -\unexpanded\def\strc_pagenumbers_page_state_push{\setxvalue{\??pagestatestack\c!state}{\counterparameter\s!userpage\c!state}} +\unexpanded\def\strc_pagenumbers_page_state_push{\setxvalue{\??pagestatestack\c!state}{\namedcounterparameter\s!userpage\c!state}} \unexpanded\def\strc_pagenumbers_page_state_pop {\normalexpanded{\setuppagenumber[\c!state=\getvalue{\??pagestatestack\c!state}]}} \setuppagenumber @@ -265,8 +265,8 @@ \unexpanded\def\strc_pagenumbers_synchronize_userpage{\global\c_strc_pagenumbers_state_userpage\plustwo} % start and visible -\unexpanded\def\decrementpagenumber{\csname\??pagenumberdec\counterparameter\s!userpage\c!state\endcsname} -\unexpanded\def\incrementpagenumber{\csname\??pagenumberinc\counterparameter\s!userpage\c!state\endcsname} +\unexpanded\def\decrementpagenumber{\csname\??pagenumberdec\namedcounterparameter\s!userpage\c!state\endcsname} +\unexpanded\def\incrementpagenumber{\csname\??pagenumberinc\namedcounterparameter\s!userpage\c!state\endcsname} \letvalue{\??pagenumberdec\v!start}\strc_pagenumbers_decrement_userpage \letvalue{\??pagenumberdec\v!none }\strc_pagenumbers_decrement_userpage @@ -365,7 +365,7 @@ \setnewconstant\c_strc_pagenumbers_state \plusone % general number: 0=invisible, 1=visible \unexpanded\def\strc_pagenumbers_check_state_change#1#2% - {\edef\m_strc_pagenumbers_state_new{\counterparameter#1\c!state}% + {\edef\m_strc_pagenumbers_state_new{\namedcounterparameter#1\c!state}% \ifx\m_strc_pagenumbers_state_new\m_strc_pagenumbers_state_old \else \doifelse\m_strc_pagenumbers_state_new\v!start {#2\plustwo}% @@ -416,7 +416,7 @@ % just for downward compatbility \appendtoks - \edef\askeduserpagenumber{\counterparameter\s!userpage\c!number}% + \edef\askeduserpagenumber{\namedcounterparameter\s!userpage\c!number}% \ifx\askeduserpagenumber\empty \else \normalexpanded{\setuppagenumber[\c!start=\askeduserpagenumber,\c!number=]}% \userpageno\strc_counters_raw\s!userpage @@ -424,7 +424,7 @@ \to \everysetupuserpagenumber % todo: set state: none, start, stop, reset \appendtoks - \edef\askedsubpagenumber{\counterparameter\s!subpage\c!number}% + \edef\askedsubpagenumber{\namedcounterparameter\s!subpage\c!number}% \ifx\askedsubpagenumber\empty \else \normalexpanded{\setupsubpagenumber[\c!start=\askedsubpagenumber,\c!number=]}% \subpageno\strc_counters_raw\s!subpage\relax diff --git a/tex/context/base/util-sql.lua b/tex/context/base/util-sql.lua index 07841f8fd..02a818c54 100644 --- a/tex/context/base/util-sql.lua +++ b/tex/context/base/util-sql.lua @@ -331,7 +331,6 @@ function sql.usedatabase(presets,datatable) end end - -- local data = utilities.sql.prepare { -- templatefile = "test.sql", -- variables = { }, @@ -399,7 +398,8 @@ if tex and tex.systemmodes then function sql.prepare(specification,tag) -- could go into tuc if needed -- todo: serialize per column - local filename = format("%s-sql-result-%s.tuc",tex.jobname,tag or "last") + local tag = tag or specification.tag or "last" + local filename = format("%s-sql-result-%s.tuc",tex.jobname,tag) if tex.systemmodes["first"] then local data, keys = sql.execute(specification) if not data then |