diff options
28 files changed, 224 insertions, 157 deletions
diff --git a/tex/context/base/buff-ver.lua b/tex/context/base/buff-ver.lua index 6dd9d8ebe..0168c551d 100644 --- a/tex/context/base/buff-ver.lua +++ b/tex/context/base/buff-ver.lua @@ -800,7 +800,6 @@ implement { { { "data" }, { "tab" }, - { "option" }, { "method" }, { "compact" }, { "nature" }, diff --git a/tex/context/base/buff-ver.mkiv b/tex/context/base/buff-ver.mkiv index ace149184..1581973d1 100644 --- a/tex/context/base/buff-ver.mkiv +++ b/tex/context/base/buff-ver.mkiv @@ -107,7 +107,7 @@ {\hskip\doifelseoddpage{\typingparameter\c!oddmargin}{\typingparameter\c!evenmargin}\relax} \def\buff_verbatim_initialize_typing_one - {\switchtobodyfont[\typingparameter\c!bodyfont]% can be low level call + {\usebodyfontparameter\typingparameter \scratchskip\typingparameter\c!oddmargin\relax \ifzeropt\scratchskip \else \let\buff_verbatim_set_line_margin\buff_verbatim_set_line_margin_indeed @@ -125,8 +125,7 @@ \else\ifx\p_buff_option\empty \usetypingstyleandcolor\c!style\c!color \fi\fi - % will become: \usealignparameter\typingparameter - \doifsomething{\typingparameter\c!align}{\setupalign[\typingparameter\c!align]}} % use fast one + \usealignparameter\typingparameter} \def\buff_verbatim_initialize_typing_two {\spaceskip.5\emwidth\relax @@ -344,7 +343,7 @@ \clf_type data {\detokenize{#1}}% tab {\typeparameter\c!tab}% - option {\p_buff_option}% + method {\p_buff_option}% compact {\typeparameter\c!compact}% % none | all | last (all needed in tabulate etc for manuals) escape {\typeparameter\c!escape}% % new but rather useless imo (escaping in general is not used much) % nature {inline}% is default @@ -359,7 +358,7 @@ \clf_type data {\detokenize{#1}}% tab {\typeparameter\c!tab}% - option {\p_buff_option}% % extra visualizer (maybe: nested,\typeparameter\c!option) + method {\p_buff_option}% % extra visualizer (maybe: nested,\typeparameter\c!option) escape {\typeparameter\c!escape}% % new but rather useless imo (escaping in general is not used much) % nature {inline}% is default method {nested}% diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 828782e01..c84ac47c9 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{2015.04.14 19:03} +\newcontextversion{2015.04.15 01:44} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex e81738ba5..876060740 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 676871e7c..c74f81ba7 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2015.04.14 19:03} +\edef\contextversion{2015.04.15 01:44} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/font-ini.mkvi b/tex/context/base/font-ini.mkvi index c780ee997..c04952a9e 100644 --- a/tex/context/base/font-ini.mkvi +++ b/tex/context/base/font-ini.mkvi @@ -2173,6 +2173,13 @@ \unexpanded\def\switchtobodyfont[#specification]% could become an ifx {\doifsomething{#specification}{\font_basics_switchtobodyfont{#specification}}} + +\unexpanded\def\usebodyfontparameter#1% + {\edef\m_font_bodyfont_asked{#1\c!bodyfont}% + \ifx\m_font_bodyfont_asked\empty\else + \font_basics_switchtobodyfont\m_font_bodyfont_asked + \fi} + \def\font_helpers_switch_bodyfont_step {\font_basics_switch_points\m_font_step \font_basics_switch_style \fontstyle} diff --git a/tex/context/base/m-chart.mkvi b/tex/context/base/m-chart.mkvi index 877a0fa37..a0c8b2244 100644 --- a/tex/context/base/m-chart.mkvi +++ b/tex/context/base/m-chart.mkvi @@ -192,7 +192,7 @@ \insidefloattrue \dontcomplain \setupFLOWchart[#settings]% - \setupbodyfont[\FLOWchartparameter\c!bodyfont]% + \usebodyfontparameter\FLOWchartparameter \ctxcommand{flow_make_chart { chart = { name = "#name", diff --git a/tex/context/base/pack-box.mkiv b/tex/context/base/pack-box.mkiv index 3fb56d799..6e3bab6f4 100644 --- a/tex/context/base/pack-box.mkiv +++ b/tex/context/base/pack-box.mkiv @@ -680,7 +680,7 @@ \dowithnextboxcontent {\forgetall \hsize\directdummyparameter\c!width - \normalexpanded{\setupalign[\directdummyparameter\c!align]}% + \usealignparameter\directdummyparameter \dousestyleparameter{\directdummyparameter\c!style}} {\setlayer[#1][#2]{\strut\dousecolorparameter{\directdummyparameter\c!color}\flushnextbox}% maybe expand the color \egroup}% diff --git a/tex/context/base/pack-com.mkiv b/tex/context/base/pack-com.mkiv index 7f3fcb538..b734d6028 100644 --- a/tex/context/base/pack-com.mkiv +++ b/tex/context/base/pack-com.mkiv @@ -221,7 +221,6 @@ \edef\p_height {\combinationparameter\c!height}% \edef\p_width {\combinationparameter\c!width}% \edef\p_location{\combinationparameter\c!location}% - \edef\p_align {\combinationparameter\c!align}% \edef\p_distance{\combinationparameter\c!distance}% % \pack_combinations_location_reset @@ -295,7 +294,7 @@ \def\pack_combinations_alternative_label_indeed {\dowithnextboxcs\pack_combinations_pickup_caption\vtop\bgroup \hsize\wd\b_pack_combinations_content - \ifx\p_align\empty\else\setupalign[\p_align]\fi + \usealignparameter\combinationparameter \usecombinationstyleandcolor\c!style\c!color \begstrut \normalexpanded{\strc_labels_command{\v!combination\ifx\currentcombination\empty\else:\currentcombination\fi}}% @@ -329,7 +328,7 @@ \else % todo: \p_pack_combinations_alternative\v!none: no style, strut etc \hsize\wd\b_pack_combinations_content - \ifx\p_align\empty\else\setupalign[\p_align]\fi + \usealignparameter\combinationparameter \usecombinationstyleandcolor\c!style\c!color \bgroup \aftergroup\endstrut @@ -783,7 +782,7 @@ \fi} \def\pack_pairedboxes_between - {\switchtobodyfont[\pairedboxparameter\c!bodyfont]% split under same regime + {\usebodyfontparameter\pairedboxparameter \setbox\b_pack_pairedboxes_first\box\nextbox \ifconditional\c_pack_pairedboxes_horizontal \pack_pairedboxes_between_horizontal diff --git a/tex/context/base/pack-lyr.mkiv b/tex/context/base/pack-lyr.mkiv index a274a8d23..a847dec67 100644 --- a/tex/context/base/pack-lyr.mkiv +++ b/tex/context/base/pack-lyr.mkiv @@ -674,7 +674,7 @@ % we have conflicting demands: some mechanisms want ll anchoring .. I need to figure this out % an dmaybe we will have 'origin=bottom' or so \setbox\nextbox - \ifx\p_pack_layers_option\v!test \ruledvbox \else \vbox \fi \ifx\p_pack_layers_method\v!overlay to \overlayheight \fi \layoutcomponentboxattribute + \ifx\p_pack_layers_option\v!test \ruledvbox \else \vbox \fi \ifx\p_pack_layers_method\v!overlay to \d_overlay_height \fi \layoutcomponentboxattribute {\pack_layers_top_fill \hbox \ifx\p_pack_layers_method\v!overlay to \d_overlay_width \fi {\box\nextbox @@ -723,12 +723,20 @@ \unexpanded\def\composedlayer#1{\flushlayer[#1]} +% \unexpanded\def\tightlayer[#1]% +% {\hbox +% {\def\currentlayer{#1}% todo: left/right +% \setbox\nextbox\emptybox +% \hsize\layerparameter\c!width +% \vsize\layerparameter\c!height +% \composedlayer{#1}}} + \unexpanded\def\tightlayer[#1]% {\hbox {\def\currentlayer{#1}% todo: left/right \setbox\nextbox\emptybox - \hsize\layerparameter\c!width - \vsize\layerparameter\c!height + \d_overlay_width \layerparameter\c!width + \d_overlay_height\layerparameter\c!height \composedlayer{#1}}} \let\placelayer\flushlayer diff --git a/tex/context/base/pack-mrl.mkiv b/tex/context/base/pack-mrl.mkiv index 071059565..a97c9e6f8 100644 --- a/tex/context/base/pack-mrl.mkiv +++ b/tex/context/base/pack-mrl.mkiv @@ -631,7 +631,7 @@ \def\pack_textrule_nop_indeed{\csname\??textrulealternatives\v!middle\endcsname}% \csname\??textrulealternatives\v!top\endcsname{#1}% \bgroup - \doifsomething{\directtextrulesparameter\c!bodyfont}{\switchtobodyfont[\directtextrulesparameter\c!bodyfont]}} + \usebodyfontparameter\directtextrulesparameter} \unexpanded\def\stoptextrule {\par diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv index 9a8c2784e..141d741cf 100644 --- a/tex/context/base/pack-rul.mkiv +++ b/tex/context/base/pack-rul.mkiv @@ -440,11 +440,21 @@ \newdimen\d_overlay_offset \newdimen\d_overlay_linewidth -\def\overlaywidth {\the\d_overlay_width \space} % We preset the variables -\def\overlayheight {\the\d_overlay_height \space} % to some reasonable default -\def\overlaydepth {\the\d_overlay_depth \space} % values. -\def\overlayoffset {\the\d_overlay_offset \space} % of the frame can be (are) -\def\overlaylinewidth {\the\d_overlay_linewidth\space} % set somewhere else. +% expandable ... in a future version the space will go (in my one can use Overlay*) + +\def\overlaywidth {\the\d_overlay_width \space} % We preset the variables +\def\overlayheight {\the\d_overlay_height \space} % to some reasonable default +\def\overlaydepth {\the\d_overlay_depth \space} % values. +\def\overlayoffset {\the\d_overlay_offset \space} % of the frame can be (are) +\def\overlaylinewidth {\the\d_overlay_linewidth\space} % set somewhere else. + +% public but kind of protected + +\def\usedoverlaywidth {\dimexpr\d_overlay_width \relax} +\def\usedoverlayheight {\dimexpr\d_overlay_height \relax} +\def\usedoverlaydepth {\dimexpr\d_overlay_depth \relax} +\def\usedoverlayoffset {\dimexpr\d_overlay_offset \relax} +\def\usedoverlaylinewidth{\dimexpr\d_overlay_linewidth\relax} %D The next register is used to initialize overlays. @@ -2662,7 +2672,7 @@ \startboxedcontent \hsize\localhsize % \insidefloattrue % ? better - \normalexpanded{\switchtobodyfont[\framedtextparameter\c!bodyfont]}% + \usebodyfontparameter\framedtextparameter \letframedtextparameter\c!strut\v!no \inheritedframedtextframed\bgroup \let\\=\endgraf @@ -2778,7 +2788,7 @@ \dosingleempty\pack_framed_text_start_direct} \def\pack_framed_text_start_direct[#1]% - {\normalexpanded{\switchtobodyfont[\framedtextparameter\c!bodyfont]}% + {\usebodyfontparameter\framedtextparameter \letframedtextparameter\c!strut\v!no \iffirstargument \setupcurrentframedtext[#1]% diff --git a/tex/context/base/page-mbk.mkvi b/tex/context/base/page-mbk.mkvi index 9e3e57193..8038771d9 100644 --- a/tex/context/base/page-mbk.mkvi +++ b/tex/context/base/page-mbk.mkvi @@ -98,7 +98,7 @@ \unvbox\b_page_margin_blocks \marginblockparameter\c!inbetween \fi - \setupalign[\marginblockparameter\c!align]% + \usealignparameter\marginblockparameter \usemarginblockstyleandcolor\c!style\c!color \begstrut \ignorespaces} diff --git a/tex/context/base/spac-ali.mkiv b/tex/context/base/spac-ali.mkiv index 90f980341..fbcce89c4 100644 --- a/tex/context/base/spac-ali.mkiv +++ b/tex/context/base/spac-ali.mkiv @@ -562,6 +562,12 @@ \spac_align_use_indeed \fi} +\unexpanded\def\dousealignparameter#1% faster local variant + {\edef\m_spac_align_asked{#1}% + \ifx\m_spac_align_asked\empty\else + \spac_align_use_indeed + \fi} + \def\spac_align_use_indeed {\expandafter\let\expandafter\raggedcommand\csname\??alignmentnormalcache\m_spac_align_asked\endcsname \ifx\raggedcommand\relax diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex fe46665b6..35c093351 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 eb37397a8..c9dd4bb96 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-ini.lua b/tex/context/base/strc-ini.lua index b21e31ace..f736427bb 100644 --- a/tex/context/base/strc-ini.lua +++ b/tex/context/base/strc-ini.lua @@ -73,7 +73,7 @@ structures.itemgroups = structures.itemgroups or { } structures.specials = structures.specials or { } structures.counters = structures.counters or { } structures.tags = structures.tags or { } -structures.formulas = structures.formulas or { } +structures.formulas = structures.formulas or { } -- not used but reserved structures.sets = structures.sets or { } structures.marks = structures.marks or { } structures.floats = structures.floats or { } diff --git a/tex/context/base/strc-lst.lua b/tex/context/base/strc-lst.lua index 4ed542eb6..4c9a7217e 100644 --- a/tex/context/base/strc-lst.lua +++ b/tex/context/base/strc-lst.lua @@ -40,6 +40,7 @@ local sections = structures.sections local helpers = structures.helpers local documents = structures.documents local tags = structures.tags +local counters = structures.counters local references = structures.references local collected = allocate() @@ -207,7 +208,7 @@ function lists.addto(t) -- maybe more more here (saves parsing at the tex end) if numberdata then local numbers = numberdata.numbers if type(numbers) == "string" then - numberdata.numbers = structures.counters.compact(numbers,nil,true) + numberdata.numbers = counters.compact(numbers,nil,true) end end local group = numberdata and numberdata.group @@ -1021,7 +1022,7 @@ implement { } }, { "numberdata", { - { "numbers" }, -- = structures.counters.compact("\currentcounter",nil,true), + { "numbers" }, { "groupsuffix" }, { "group" }, { "counter" }, diff --git a/tex/context/base/strc-mat.lua b/tex/context/base/strc-mat.lua index 98b1e996c..87f35ed1d 100644 --- a/tex/context/base/strc-mat.lua +++ b/tex/context/base/strc-mat.lua @@ -6,28 +6,35 @@ if not modules then modules = { } end modules ['strc-mat'] = { license = "see context related readme files" } +----- copytable = table.copy + local structures = structures -local lists = structures.lists -local sections = structures.sections -local floats = structures.floats -local helpers = structures.helpers -local formulas = structures.formulas +local lists = structures.lists +local sections = structures.sections +local floats = structures.floats +local helpers = structures.helpers +local formulas = structures.formulas -- not used but reserved -lists.enhancers = lists.enhancers or { } +----- context = context +----- simplify = helpers.simplify -- maybe we want to do clever things with formulas, the store might go away -local formuladata = { } - -function formulas.store(data) - formuladata[#formuladata+1] = data - context(#formuladata) -end - -function formulas.current() - return formuladata[#formuladata] -end +-- local formuladata = { } +-- +-- function formulas.store(data) +-- formuladata[#formuladata+1] = data +-- context(#formuladata) +-- end +-- +-- function formulas.current() +-- return formuladata[#formuladata] +-- end + +-- function formulas.simplify(entry) +-- return simplify(copytable(entry or formuladata[#formuladata])) +-- end function helpers.formulanumber(data,spec) if data then @@ -38,10 +45,9 @@ function helpers.formulanumber(data,spec) end end -function formulas.simplify(entry) - return helpers.simplify(table.copy(entry or formuladata[#formuladata])) -end - function lists.formulanumber(name,n,spec) - helpers.formulanumber(lists.result[n]) + local result = lists.result + if result then + helpers.formulanumber(result[n]) + end end diff --git a/tex/context/base/strc-not.mkvi b/tex/context/base/strc-not.mkvi index 1113cfa76..25a1072a3 100644 --- a/tex/context/base/strc-not.mkvi +++ b/tex/context/base/strc-not.mkvi @@ -1299,7 +1299,7 @@ \noteparameter\c!before \fi % \bgroup - % \setupalign[\noteparameter\c!align]% + % \usealignparameter\noteparameter \placenoterule % alleen in ..mode % \par % \egroup @@ -1727,8 +1727,8 @@ \def\strc_notes_set_bodyfont {\let\strc_notes_set_bodyfont\relax \restoreglobalbodyfont - \switchtobodyfont[\noteparameter\c!bodyfont]% - \setupalign[\noteparameter\c!align]} + \usebodyfontparameter\noteparameter + \usealignparameter\noteparameter} %D The footnote mechanism defaults to a traditional one %D column way of showing them. By default we precede them by diff --git a/tex/context/base/strc-ref.lua b/tex/context/base/strc-ref.lua index 5174b289d..b6f2e9a37 100644 --- a/tex/context/base/strc-ref.lua +++ b/tex/context/base/strc-ref.lua @@ -1976,17 +1976,17 @@ function references.setandgetattribute(data) -- maybe do internal automatically if ndat then local numbers = ndat.numbers if type(numbers) == "string" then - ndat.numbers = structures.counters.compact(numbers,nil,true) + ndat.numbers = counters.compact(numbers,nil,true) end - data.numberdata = structures.helpers.simplify(ndat) + data.numberdata = helpers.simplify(ndat) end local pdat = data.prefixdata if pdat then - data.prefixdata = structures.helpers.simplify(pdat) + data.prefixdata = helpers.simplify(pdat) end local udat = data.userdata if type(udat) == "string" then - data.userdata = structures.helpers.touserdata(udat) + data.userdata = helpers.touserdata(udat) end if not rdat.block then rdat.block = structures.sections.currentblock() @@ -2075,17 +2075,27 @@ end references.currentmetadata = currentmetadata local function getcurrentprefixspec(default) + local data = currentreference and currentreference.i + local metadata = data and data.metadata return - currentmetadata("kind") or "?", - currentmetadata("name") or "?", - default or "?" + metatadata and metadata.kind or "?", + metatadata and metadata.name or "?", + default or "?" end references.getcurrentprefixspec = getcurrentprefixspec +-- implement { +-- name = "getcurrentprefixspec", +-- actions = { getcurrentprefixspec, context }, -- returns 3 arguments +-- arguments = "string", +-- } + implement { name = "getcurrentprefixspec", - actions = { getcurrentprefixspec, context }, -- returns 3 arguments + actions = function(tag) + context("{%s}{%s}{%s}",getcurrentprefixspec(tag)) + end, arguments = "string", } @@ -2101,7 +2111,7 @@ filters.text = textfilters filters.full = fullfilters filters.section = sectionfilters -local function filterreference(name,...) -- number page title ... +local function filterreference(name,prefixspec,numberspec) -- number page title ... local data = currentreference and currentreference.i -- maybe we should take realpage from here if data then if name == "realpage" then @@ -2116,7 +2126,7 @@ local function filterreference(name,...) -- number page title ... if trace_referencing then report_references("name %a, kind %a, using dedicated filter",name,kind) end - filter(data,name,...) + filter(data,name,prefixspec,numberspec) elseif trace_referencing then report_references("name %a, kind %a, using generic filter",name,kind) end diff --git a/tex/context/base/strc-ref.mkvi b/tex/context/base/strc-ref.mkvi index 7bf198998..f5d0d1d78 100644 --- a/tex/context/base/strc-ref.mkvi +++ b/tex/context/base/strc-ref.mkvi @@ -1953,7 +1953,7 @@ %D %D Only when \type {text} is not empty, a space is inserted. -\def\dotextprefix#text% +\unexpanded\def\dotextprefix#text% {\begingroup \setbox\scratchbox\hbox{#text}% to be solved some day \ifdim\wd\scratchbox>\zeropoint @@ -2089,7 +2089,7 @@ \installcorenamespace{referencingprefix} \def\getreferencestructureprefix#kind#name#category% name will change - {{ + {{% prefix {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefix}% separatorset {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixseparatorset}% conversion {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixconversion}% @@ -2099,8 +2099,8 @@ set {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixset}% segments {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixsegments}% connector {\referencestructureprefixparameter{#kind}{#name}{#category}\c!prefixconnector}% - } - { + }% + {% separatorset {\referencestructureprefixparameter{#kind}{#name}{#category}\c!numberseparatorset}% conversion {\referencestructureprefixparameter{#kind}{#name}{#category}\c!numberconversion}% conversionset {\referencestructureprefixparameter{#kind}{#name}{#category}\c!numberconversionset}% @@ -2128,11 +2128,11 @@ \csname \??referencingprefix:#category#parameter\endcsname \fi\fi\fi} -\def\currentreferencedefault - {\clf_filterdefaultreference +\def\currentreferencedefault % for some reason we need to explicitly expand + {\normalexpanded{\noexpand\clf_filterdefaultreference {\s!default}% - \getreferencestructureprefix\clf_getcurrentprefixspec{\s!default}% returns #kind#name#category - \relax} + \noexpand\getreferencestructureprefix\clf_getcurrentprefixspec{\s!default}% returns #kind#name#category + \relax}} %D Not all support is visible by looking at the \TEX\ code; here is one of those:^ %D diff --git a/tex/context/base/strc-syn.lua b/tex/context/base/strc-syn.lua index 1864dc84a..22a4ff9fd 100644 --- a/tex/context/base/strc-syn.lua +++ b/tex/context/base/strc-syn.lua @@ -7,14 +7,12 @@ if not modules then modules = { } end modules ['strc-syn'] = { } local next, type = next, type -local format = string.format -local allocate = utilities.storage.allocate - --- interface to tex end local context = context local implement = interfaces.implement +local allocate = utilities.storage.allocate + local sorters = sorters local structures = structures @@ -46,73 +44,73 @@ job.register('structures.synonyms.collected', tobesaved, initializer, finalizer) -- todo: allocate becomes metatable -local function allocate(class) - local d = tobesaved[class] - if not d then - d = { - metadata = { - language = 'en', - sorted = false, - class = class - }, - entries = { - }, - hash = { - } +table.setmetatableindex(tobesaved,function(t,k) + local v = { + metadata = { + language = 'en', + sorted = false, + class = v + }, + entries = { + }, + hash = { } - tobesaved[class] = d - end - return d -end + } + t[k] = v + return v +end) function synonyms.define(class,kind) - local data = allocate(class) + local data = tobesaved[class] data.metadata.kind = kind end function synonyms.register(class,kind,spec) - local data = allocate(class) + local data = tobesaved[class] + local hash = data.hash + local tag = spec.definition.tag or "" data.metadata.kind = kind -- runtime, not saved in format (yet) - if not data.hash[spec.definition.tag or ""] then - data.entries[#data.entries+1] = spec - data.hash[spec.definition.tag or ""] = spec + if not hash[tag] then + local entries = data.entries + entries[#entries+1] = spec + hash[tag] = spec end end function synonyms.registerused(class,tag) - local data = allocate(class) - local dht = data.hash[tag] - if dht then - dht.definition.used = true + local data = tobesaved[class] + local okay = data.hash[tag] + if okay then + okay.definition.used = true end end function synonyms.synonym(class,tag) - local data = allocate(class).hash - local d = data[tag] - if d then - local de = d.definition - de.used = true - context(de.synonym) + local data = tobesaved[class] + local okay = data.hash[tag] + if okay then + local definition = okay.definition + definition.used = true + context(definition.synonym) end end function synonyms.meaning(class,tag) - local data = allocate(class).hash - local d = data[tag] - if d then - local de = d.definition - de.used = true - context(de.meaning) + local data = tobesaved[class] + local okay = data.hash[tag] + if okay then + local definition = okay.definition + definition.used = true + context(definition.meaning) end end synonyms.compare = sorters.comparers.basic -- (a,b) function synonyms.filter(data,options) - local result = { } + local result = { } local entries = data.entries - local all = options and options.criterium == interfaces.variables.all + local all = options and options.criterium == interfaces.variables.all for i=1,#entries do local entry = entries[i] if all or entry.definition.used then @@ -122,16 +120,35 @@ function synonyms.filter(data,options) data.result = result end +function synonyms.filter(data,options) + local result = { } + local entries = data.entries + local all = options and options.criterium == interfaces.variables.all + if all then + for i=1,#entries do + result[i] = entries[i] + end + else + for i=1,#entries do + local entry = entries[i] + if entry.definition.used then + result[#result+1] = entry + end + end + end + data.result = result +end + function synonyms.prepare(data) local result = data.result if result then for i=1, #result do - local r = result[i] - local rd = r.definition - if rd then - local rt = rd.tag - local sortkey = rt and rt ~= "" and rt or rd.synonym - r.split = splitter(strip(sortkey)) + local entry = result[i] + local definition = entry.definition + if definition then + local tag = definition.tag + local key = tag ~= "" and tag or definition.synonym + entry.split = splitter(strip(key)) end end end @@ -139,16 +156,19 @@ end function synonyms.sort(data,options) sorters.sort(data.result,synonyms.compare) + data.metadata.sorted = true end function synonyms.finalize(data,options) -- mostly the same as registers so we will generalize it: sorters.split - local result = data.result - data.metadata.nofsorted = #result - local split, nofsplit, lasttag, done, nofdone = { }, 0, nil, nil, 0 - local firstofsplit = sorters.firstofsplit + local result = data.result + local split = { } + local nofsplit = 0 + local lasttag = nil + local lasttag = nil + local nofdone = 0 for k=1,#result do - local v = result[k] - local entry, tag = firstofsplit(v) + local entry = result[k] + local first, tag = firstofsplit(entry) if tag ~= lasttag then -- if trace_registers then -- report_registers("splitting at %a",tag) @@ -160,7 +180,7 @@ function synonyms.finalize(data,options) -- mostly the same as registers so we w split[nofsplit] = { tag = tag, data = done } end nofdone = nofdone + 1 - done[nofdone] = v + done[nofdone] = entry end data.result = split end @@ -171,23 +191,22 @@ end local ctx_synonymentry = context.synonymentry function synonyms.flush(data,options) - local kind = data.metadata.kind -- hack, will be done better local result = data.result for i=1,#result do local sublist = result[i] - local letter = sublist.tag - local data = sublist.data + local letter = sublist.tag + local data = sublist.data for d=1,#data do local entry = data[d].definition ctx_synonymentry(d,entry.tag,entry.synonym,entry.meaning or "") end end - data.result = nil + data.result = nil data.metadata.sorted = false end function synonyms.analyzed(class,options) - local data = synonyms.collected[class] + local data = collected[class] if data and data.entries then options = options or { } sorters.setlanguage(options.language,options.method) @@ -202,7 +221,7 @@ end function synonyms.process(class,options) if synonyms.analyzed(class,options) then - synonyms.flush(synonyms.collected[class],options) + synonyms.flush(collected[class],options) end end diff --git a/tex/context/base/strc-syn.mkiv b/tex/context/base/strc-syn.mkiv index bd5cd4ca8..22198aa7d 100644 --- a/tex/context/base/strc-syn.mkiv +++ b/tex/context/base/strc-syn.mkiv @@ -22,7 +22,7 @@ % split but common in lua -\def\preprocessexpansion#1#2#3#4% +\def\preprocessexpansion#1#2#3#4% do this at the lua end if still needed {\ifx#1\s!xml \xmlstartraw \xdef#2{#4}% @@ -251,19 +251,21 @@ \def\strc_synonyms_place_list[#1][#2]% {\begingroup \edef\currentsimplelist{#1}% - \strc_constructions_initialize{#1}% - \setupcurrentsimplelist[#2]% - \let\synonymentry\strc_synonym_normal - \startpacked - \clf_processsynonyms - {#1}% - {% - criterium {\simplelistparameter\c!criterium}% - language {\simplelistparameter\s!language}% - method {\simplelistparameter\c!method}% - }% - \relax - \stoppacked + \doifelsecommandhandler\??simplelist\currentsimplelist + {\strc_constructions_initialize{#1}% + \setupcurrentsimplelist[#2]% + \let\synonymentry\strc_synonym_normal + \startpacked + \clf_processsynonyms + {#1}% + {% + criterium {\simplelistparameter\c!criterium}% + language {\simplelistparameter\s!language}% + method {\simplelistparameter\c!method}% + }% + \relax + \stoppacked}% + {}% todo: message that invalid \endgroup} \def\completelistofsynonyms @@ -272,10 +274,12 @@ \def\strc_synonyms_complete_list[#1][#2]% {\begingroup \edef\currentsimplelist{#1}% - \normalexpanded{\startnamedsection[\v!chapter][\c!title={\headtext{\simplelistparameter\s!multi}},\c!reference=#1]}% - \strc_synonyms_place_list[#1][#2]% - \page - \stopnamedsection + \doifelsecommandhandler\??simplelist\currentsimplelist + {\normalexpanded{\startnamedsection[\v!chapter][\c!title={\headtext{\simplelistparameter\s!multi}},\c!reference=#1]}% + \strc_synonyms_place_list[#1][#2]% + \page + \stopnamedsection}% + {}% todo: message that invalid \endgroup} \unexpanded\def\strc_synonym_normal#1#2#3#4% diff --git a/tex/context/base/strc-tag.lua b/tex/context/base/strc-tag.lua index eda53c8be..637d74e8c 100644 --- a/tex/context/base/strc-tag.lua +++ b/tex/context/base/strc-tag.lua @@ -13,7 +13,7 @@ if not modules then modules = { } end modules ['strc-tag'] = { local type, next = type, next local insert, remove, unpack, concat = table.insert, table.remove, table.unpack, table.concat -local gsub, find, topattern, format = string.gsub, string.find, string.topattern, string.format +local find, topattern, format = string.find, string.topattern, string.format local lpegmatch, P, S, C, Cc = lpeg.match, lpeg.P, lpeg.S, lpeg.C, lpeg.Cc local texattribute = tex.attribute local allocate = utilities.storage.allocate diff --git a/tex/context/base/tabl-tab.mkiv b/tex/context/base/tabl-tab.mkiv index 16a16601c..5add1c684 100644 --- a/tex/context/base/tabl-tab.mkiv +++ b/tex/context/base/tabl-tab.mkiv @@ -2203,7 +2203,7 @@ \def\dolocaltablesetup {\directtablesparameter\c!commands\relax - \doifsomething{\directtablesparameter\c!bodyfont}{\switchtobodyfont[\directtablesparameter\c!bodyfont]}% + \usebodyfontparameter\directtablesparameter \tablelinethicknessunit\dimexpr\directtablesparameter\c!rulethickness/\tablelinethicknessfactor\relax \edef\p_tabl_table_height{\directtablesparameter\c!height}% \edef\p_tabl_table_depth{\directtablesparameter\c!depth}% diff --git a/tex/context/base/tabl-xtb.mkvi b/tex/context/base/tabl-xtb.mkvi index 530232b1e..b5ab0a5dc 100644 --- a/tex/context/base/tabl-xtb.mkvi +++ b/tex/context/base/tabl-xtb.mkvi @@ -268,8 +268,7 @@ {\begingroup % * \forgetall % moved here \dontcomplain % for the moment here till we figure out where we get the overflow - \doifsomething{\xtableparameter\c!bodyfont} - {\setupbodyfont[\xtableparameter\c!bodyfont]}% + \usebodyfontparameter\xtableparameter \setbox\scratchbox\vbox {\doifsomething{\xtableparameter\c!spaceinbetween}{\blank[\xtableparameter\c!spaceinbetween]}}% \clf_x_table_create diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index bbc2b53e4..7ab0c9be3 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 04/14/15 19:03:21 +-- merge date : 04/15/15 01:44:50 do -- begin closure to overcome local limits and interference |