diff options
author | Hans Hagen <pragma@wxs.nl> | 2009-09-25 09:42:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2009-09-25 09:42:00 +0200 |
commit | 43986f8edd2afd919afbb9988cb6778fc3c02077 (patch) | |
tree | d3dea48ceb4a87c321b828be8aaf8df1e21bd653 /tex | |
parent | debb4feb8ae38805ed81932e37c58285cb6dcc1c (diff) | |
download | context-43986f8edd2afd919afbb9988cb6778fc3c02077.tar.gz |
beta 2009.09.25 09:42
Diffstat (limited to 'tex')
43 files changed, 569 insertions, 269 deletions
diff --git a/tex/context/base/buff-ini.mkii b/tex/context/base/buff-ini.mkii index 0f0655ea1..fc147d090 100644 --- a/tex/context/base/buff-ini.mkii +++ b/tex/context/base/buff-ini.mkii @@ -188,15 +188,15 @@ \letvalue{\??bu#1\c!number }\nofdefinedbuffers \letvalue{\??bu#1\c!paragraph}\v!no \setevalue{\e!start#1}{\noexpand\dostartbuffer[#1][def-\nofdefinedbuffers][\e!start#1][\e!stop#1]}% - \setevalue{\e!get #1}{\noexpand\dogetbuffer [#1][def-\nofdefinedbuffers]}% - \setevalue{\e!type #1}{\noexpand\dotypebuffer [#1][def-\nofdefinedbuffers]}% + \unexpanded\setevalue{\e!get #1}{\noexpand\dogetbuffer [#1][def-\nofdefinedbuffers]}% + \unexpanded\setevalue{\e!type #1}{\noexpand\dotypebuffer [#1][def-\nofdefinedbuffers]}% \getparameters[\??bu#1][#2]% \fi} \def\definebuffer {\dodoubleempty\dodefinebuffer} -\def\getbuffer +\unexpanded\def\getbuffer {\dodoubleempty\dogetbuffer} \def\dogetbuffer[#1][#2]% @@ -213,7 +213,7 @@ \dobuffer{16}{#2}\dogetbufferasis \getvalue{\??bu#1\c!after}} -\def\typebuffer +\unexpanded\def\typebuffer {\dodoubleempty\dotypebuffer} \def\dogetfilebuffer{\typefile{\TEXbufferfile{\currentbuffer}}} diff --git a/tex/context/base/buff-ini.mkiv b/tex/context/base/buff-ini.mkiv index 0c258a81d..1cdeaa844 100644 --- a/tex/context/base/buff-ini.mkiv +++ b/tex/context/base/buff-ini.mkiv @@ -162,8 +162,8 @@ \letvalue{\??bu#1\c!number }\nofdefinedbuffers \letvalue{\??bu#1\c!paragraph}\v!no \setevalue{\e!start#1}{\noexpand\dostartbuffer[#1][def-\nofdefinedbuffers][\e!start#1][\e!stop#1]}% - \setevalue{\e!get #1}{\noexpand\dogetbuffer [#1][def-\nofdefinedbuffers]}% - \setevalue{\e!type #1}{\noexpand\dotypebuffer [#1][def-\nofdefinedbuffers]}% + \unexpanded\setevalue{\e!get #1}{\noexpand\dogetbuffer [#1][def-\nofdefinedbuffers]}% + \unexpanded\setevalue{\e!type #1}{\noexpand\dotypebuffer [#1][def-\nofdefinedbuffers]}% \getparameters[\??bu#1][#2]% \fi} diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 5f255585e..02117c4b8 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2009.09.23 10:07} +\newcontextversion{2009.09.25 09:42} %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.mkiv b/tex/context/base/context.mkiv index 387c8aa90..378a00873 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -315,12 +315,7 @@ \loadmarkfile{bibl-bib} \loadmarkfile{bibl-tra} -\loadcorefile{xtag-ini} % might go away -\loadcorefile{xtag-ext} % might go away -\loadcorefile{xtag-exp} % will go away -\loadcorefile{xtag-pre} % has old encoding code -\loadcorefile{xtag-xsd} % will go away (stub anyway) -\loadcorefile{xtag-rng} % will go away (stub anyway) +\loadmarkfile{x-xtag} % at some point this will nto be preloaded \loadcorefile{meta-xml} diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index 9ba4f8287..3bba2b9d0 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2009.09.23 10:07} +\edef\contextversion{2009.09.25 09:42} %D For those who want to use this: diff --git a/tex/context/base/lxml-ini.lua b/tex/context/base/lxml-ini.lua index 8db90c960..d837dfd6d 100644 --- a/tex/context/base/lxml-ini.lua +++ b/tex/context/base/lxml-ini.lua @@ -58,7 +58,7 @@ end local traverse, lpath = xml.traverse, xml.lpath -local xmlfilter, xmlfirst, xmllast, xmlall = xml.filter, xml.first, xml.last, xml.all +local xmlfilter, xmlfirst, xmllast, xmlall, xmlcount = xml.filter, xml.first, xml.last, xml.all, xml.count local xmlcollect, xmlcontent, xmlcollect_texts, xmlcollect_tags, xmlcollect_elements = xml.collect, xml.content, xml.collect_texts, xml.collect_tags, xml.collect_elements local xmlattribute, xmlindex, xmlchainattribute = xml.filters.attribute, xml.filters.index, xml.filters.chainattribute @@ -460,9 +460,9 @@ function lxml.include(id,pattern,attribute,recurse) xml.include(get_id(id),pattern,attribute,recurse,function(filename) if filename then filename = commands.preparedfile(filename) -if file.dirname(filename) == "" then - filename = file.join(file.dirname(paths[currentdocument]),filename) -end + if file.dirname(filename) == "" then + filename = file.join(file.dirname(paths[currentdocument]),filename) + end if trace_loading then commands.writestatus("lxml","including file: %s",filename) end @@ -515,6 +515,7 @@ function lxml.strip(id,pattern,nolines) end function lxml.text(id,pattern) + -- we can avoid some steps by passing xmlsprint xmltprint(xmlcollect_texts(get_id(id),pattern) or {}) end @@ -614,7 +615,7 @@ function lxml.chainattribute(id,pattern,a,default) --todo: snelle xmlatt end function lxml.count(id,pattern) - texsprint(xml.count(get_id(id),pattern) or 0) + texsprint(xmlcount(get_id(id),pattern) or 0) end function lxml.nofelements(id) local e = get_id(id) @@ -653,7 +654,7 @@ end --~ end function lxml.concatrange(id,what,start,stop,separator,lastseparator) -- test this on mml - local t = xmlcollect_elements(lxml.id(id),what,true) -- ignorespaces + local t = xmlcollect_elements(get_id(id),what,true) -- ignorespaces local separator = separator or "" local lastseparator = lastseparator or separator or "" start, stop = (start == "" and 1) or tonumber(start) or 1, (stop == "" and #t) or tonumber(stop) or #t @@ -687,7 +688,7 @@ end -- we use a real tex.sprint, else spaces go wrong -- maybe just a .. because this happens often -function xml.command(root, command) +function lxml.serialize(root, command) local tc = type(command) if tc == "string" then -- setup @@ -699,7 +700,8 @@ function xml.command(root, command) --~ lxml.addindex(root) --~ ix = root.ix --~ end - texsprint(ctxcatcodes,format("\\xmlsetup{%s}{%s}",ix,command)) +--~ texsprint(ctxcatcodes,format("\\xmlsetup{%s}{%s}",ix,command)) + texsprint(ctxcatcodes,format("\\xmls{%s}{%s}",ix,command)) elseif tc == "function" then -- function command(root) @@ -713,6 +715,8 @@ function xml.command(root, command) end end +xml.setserializer(lxml.serialize) + function lxml.setaction(id,pattern,action) for rt, dt, dk in xmlelements(get_id(id),pattern) do dt[dk].command = action @@ -1292,19 +1296,21 @@ end local found, isempty = xml.found, xml.isempty -function lxml.doif (id,pattern) commands.doif (found(get_id(id),pattern,false)) end -function lxml.doifnot (id,pattern) commands.doifnot (found(get_id(id),pattern,false)) end -function lxml.doifelse (id,pattern) commands.doifelse(found(get_id(id),pattern,false)) end +local doif, doifnot, doifelse = commands.doif, commands.doifnot, commands.doifelse + +function lxml.doif (id,pattern) doif (found(get_id(id),pattern,false)) end +function lxml.doifnot (id,pattern) doifnot (found(get_id(id),pattern,false)) end +function lxml.doifelse (id,pattern) doifelse(found(get_id(id),pattern,false)) end -- todo: if no second arg or second arg == "" then quick test -function lxml.doiftext (id,pattern) commands.doif (found (get_id(id),pattern,true)) end -function lxml.doifnottext (id,pattern) commands.doifnot (found (get_id(id),pattern,true)) end -function lxml.doifelsetext (id,pattern) commands.doifelse(found (get_id(id),pattern,true)) end +function lxml.doiftext (id,pattern) doif (found (get_id(id),pattern,true)) end +function lxml.doifnottext (id,pattern) doifnot (found (get_id(id),pattern,true)) end +function lxml.doifelsetext (id,pattern) doifelse(found (get_id(id),pattern,true)) end -- special case: "*" and "" -> self else lpath lookup -function lxml.doifelseempty(id,pattern) commands.doifelse(isempty(get_id(id),pattern ~= "" and pattern ~= nil)) end -- not yet done, pattern +function lxml.doifelseempty(id,pattern) doifelse(isempty(get_id(id),pattern ~= "" and pattern ~= nil)) end -- not yet done, pattern -- status info diff --git a/tex/context/base/lxml-ini.mkiv b/tex/context/base/lxml-ini.mkiv index 81a611bf1..02703d2da 100644 --- a/tex/context/base/lxml-ini.mkiv +++ b/tex/context/base/lxml-ini.mkiv @@ -115,6 +115,8 @@ {\def\xmlself{#1}% % by using #1 inside a setup; maybe self becomes obsolete \setupwithargument{#2}{#1}} +\let\xmls\xmlsetup + \newtoks \registeredxmlsetups % todo: 1:xml:whatever alwas before 3:xml:something @@ -157,9 +159,6 @@ \def\xmlstarttiming{\ctxlua{statistics.starttiming(lxml)}} \def\xmlstoptiming {\ctxlua{statistics.stoptiming (lxml)}} -\def\xmlpushdocument#1{\ctxlua{lxml.pushdocument("#1")}} -\def\xmlpopdocument {\ctxlua{lxml.popdocument()}} - \def\doxmlprocess#1#2#3#4#5% {\begingroup \edef\xmldocument{#3}% #2 can be \xmldocument and set as such @@ -416,11 +415,13 @@ %D Experimental: -\def\xmladdindex #1{\ctxlua{lxml.addindex("#1")}} -\def\xmlgetindex #1{\ctxlua{lxml.getindex("\xmldocument","#1")}} -\def\xmlrawindex #1{\ctxlua{lxml.rawindex("#1")}} -\def\xmlwithindex#1#2{\ctxlua{lxml.withindex("\xmldocument","#1","#2")}} -\def\xmlreference#1#2{\string\xmlwithindex{#1}{#2}} +\def\xmlpushdocument#1{\ctxlua{lxml.pushdocument("#1")}} +\def\xmlpopdocument {\ctxlua{lxml.popdocument()}} +\def\xmladdindex #1{\ctxlua{lxml.addindex("#1")}} +\def\xmlgetindex #1{\ctxlua{lxml.getindex("\xmldocument","#1")}} +\def\xmlrawindex #1{\ctxlua{lxml.rawindex("#1")}} +\def\xmlwithindex #1#2{\ctxlua{lxml.withindex("\xmldocument","#1","#2")}} +\def\xmlreference #1#2{\string\xmlwithindex{#1}{#2}} \startxmlsetups xml:flush \xmlflush{#1} diff --git a/tex/context/base/lxml-pth.lua b/tex/context/base/lxml-pth.lua index ab78af1dc..e0520edbd 100644 --- a/tex/context/base/lxml-pth.lua +++ b/tex/context/base/lxml-pth.lua @@ -17,11 +17,7 @@ functions that set the tracers. Here we overload a previously defined function.</p> --ldx]]-- -local trace_lpath = false - -if trackers then - trackers.register("xml.lpath", function(v) trace_lpath = v end) -end +local trace_lpath = false if trackers then trackers.register("xml.lpath", function(v) trace_lpath = v end) end local settrace = xml.settrace -- lxml-tab @@ -797,17 +793,19 @@ local r, d, k = xml.filter(root,"/a/b/c/position(4)" </typing> --ldx]]-- +xml.filters = { } + local traverse, lpath, convert = xml.traverse, xml.lpath, xml.convert -xml.filters = { } +local filters = xml.filters -function xml.filters.default(root,pattern) +function filters.default(root,pattern) local rt, dt, dk traverse(root, lpath(pattern), function(r,d,k) rt,dt,dk = r,d,k return true end) return dt and dt[dk], rt, dt, dk end -function xml.filters.attributes(root,pattern,arguments) +function filters.attributes(root,pattern,arguments) local rt, dt, dk traverse(root, lpath(pattern), function(r,d,k) rt, dt, dk = r, d, k return true end) local ekat = (dt and dt[dk] and dt[dk].at) or (rt and rt.at) @@ -828,7 +826,7 @@ local rt, dt, dk local function action(r,d,k) rt, dt, dk = r, d, k return true end -function xml.filters.chainattribute(root,pattern,arguments) -- todo: optional levels +function filters.chainattribute(root,pattern,arguments) -- todo: optional levels rt, dt, dk = nil, nil, nil traverse(root, lpath(pattern), action) local dtk = dt and dt[dk] @@ -852,13 +850,13 @@ end -- -function xml.filters.reverse(root,pattern) +function filters.reverse(root,pattern) local rt, dt, dk traverse(root, lpath(pattern), function(r,d,k) rt,dt,dk = r,d,k return true end, 'reverse') return dt and dt[dk], rt, dt, dk end -function xml.filters.count(root,pattern,everything) +function filters.count(root,pattern,everything) local n = 0 traverse(root, lpath(pattern), function(r,d,t) if everything or type(d[t]) == "table" then @@ -868,7 +866,19 @@ function xml.filters.count(root,pattern,everything) return n end -function xml.filters.elements(root, pattern) -- == all +--~ local n = 0 +--~ local function doit(r,d,t) +--~ if everything or type(d[t]) == "table" then +--~ n = n + 1 +--~ end +--~ end +--~ function filters.count(root,pattern,everything) +--~ n = 0 +--~ traverse(root, lpath(pattern), doit) +--~ return n +--~ end + +function filters.elements(root, pattern) -- == all local t = { } traverse(root, lpath(pattern), function(r,d,k) local e = d[k] @@ -879,7 +889,7 @@ function xml.filters.elements(root, pattern) -- == all return t end -function xml.filters.texts(root, pattern) +function filters.texts(root, pattern) local t = { } traverse(root, lpath(pattern), function(r,d,k) local e = d[k] @@ -890,19 +900,19 @@ function xml.filters.texts(root, pattern) return t end -function xml.filters.first(root,pattern) +function filters.first(root,pattern) local rt, dt, dk traverse(root, lpath(pattern), function(r,d,k) rt,dt,dk = r,d,k return true end) return dt and dt[dk], rt, dt, dk end -function xml.filters.last(root,pattern) +function filters.last(root,pattern) local rt, dt, dk traverse(root, lpath(pattern), function(r,d,k) rt,dt,dk = r,d,k return true end, 'reverse') return dt and dt[dk], rt, dt, dk end -function xml.filters.index(root,pattern,arguments) +function filters.index(root,pattern,arguments) local rt, dt, dk, reverse, i = nil, nil, nil, false, tonumber(arguments or '1') or 1 if i and i ~= 0 then if i < 0 then @@ -916,16 +926,25 @@ function xml.filters.index(root,pattern,arguments) return nil, nil, nil, nil end -function xml.filters.attribute(root,pattern,arguments) - local rt, dt, dk - traverse(root, lpath(pattern), function(r,d,k) rt, dt, dk = r, d, k return true end) - local ekat = (dt and dt[dk] and dt[dk].at) or (rt and rt.at) - -- return (ekat and (ekat[arguments] or ekat[gsub(arguments,"^([\"\'])(.*)%1$","%2")])) or "" +--~ function filters.attribute(root,pattern,arguments) +--~ local rt, dt, dk +--~ traverse(root, lpath(pattern), function(r,d,k) rt, dt, dk = r, d, k return true end) +--~ local ekat = (dt and dt[dk] and dt[dk].at) or (rt and rt.at) +--~ return (ekat and (ekat[arguments] or (find(arguments,"^[\'\"]") and ekat[sub(arguments,2,-2)]))) or "" +--~ end + +local rt, dt, dk +local function doit(r,d,k) rt, dt, dk = r, d, k return true end +function filters.attribute(root,pattern,arguments) + rt, dt, dk = nil, nil, nil + traverse(root, lpath(pattern), doit) + local dtk = dt and dt[k] + local ekat = (dtk and dtk.at) or (rt and rt.at) return (ekat and (ekat[arguments] or (find(arguments,"^[\'\"]") and ekat[sub(arguments,2,-2)]))) or "" end -function xml.filters.text(root,pattern,arguments) -- ?? why index, tostring slow - local dtk, rt, dt, dk = xml.filters.index(root,pattern,arguments) +function filters.text(root,pattern,arguments) -- ?? why index, tostring slow + local dtk, rt, dt, dk = filters.index(root,pattern,arguments) if dtk then -- n local dtkdt = dtk.dt if not dtkdt then @@ -940,7 +959,7 @@ function xml.filters.text(root,pattern,arguments) -- ?? why index, tostring slow end end -function xml.filters.tag(root,pattern,n) +function filters.tag(root,pattern,n) local tag = "" traverse(root, lpath(pattern), function(r,d,k) tag = xml.functions.tag(d,k,n and tonumber(n)) @@ -949,7 +968,7 @@ function xml.filters.tag(root,pattern,n) return tag end -function xml.filters.name(root,pattern,n) +function filters.name(root,pattern,n) local tag = "" traverse(root, lpath(pattern), function(r,d,k) tag = xml.functions.name(d,k,n and tonumber(n)) @@ -1054,13 +1073,13 @@ function xml.collect_texts(root, pattern, flatten) if tx then t[#t+1] = xml.tostring(tx) or "" else - t[#t+1] = "" + t[#t+1] = "" -- hm end else t[#t+1] = tx or "" end else - t[#t+1] = "" + t[#t+1] = "" -- hm end end) return t @@ -1068,7 +1087,7 @@ end function xml.collect_tags(root, pattern, nonamespace) local t = { } - xml.traverse(root, xml.lpath(pattern), function(r,d,k) + xml.traverse(root, lpath(pattern), function(r,d,k) local dk = d and d[k] if dk and type(dk) == "table" then local ns, tg = e.ns, e.tg @@ -1128,6 +1147,11 @@ function xml.each_element(root, pattern, handle, reverse) return ok end +--~ todo: +--~ +--~ function xml.process_elements(root, pattern, handle) +--~ traverse(root, lpath(pattern), fnc, nil, nil, nil, handle) -> fnc gets r, d, k and handle (...) passed + function xml.process_elements(root, pattern, handle) traverse(root, lpath(pattern), function(r,d,k) local dkdt = d[k].dt diff --git a/tex/context/base/lxml-tab.lua b/tex/context/base/lxml-tab.lua index 407950086..52e04befd 100644 --- a/tex/context/base/lxml-tab.lua +++ b/tex/context/base/lxml-tab.lua @@ -500,6 +500,12 @@ alternative.</p> local fallbackhandle = (tex and tex.sprint) or io.write +local serializer + +function xml.setserializer(f) + serializer = f +end + local function serialize(e, handle, textconverter, attributeconverter, specialconverter, nocommands) if not e then return @@ -519,9 +525,8 @@ local function serialize(e, handle, textconverter, attributeconverter, specialco end end end - local xc = xml.command - if xc then - xc(e,ec) + if serializer then + serializer(e,ec) return end end diff --git a/tex/context/base/m-chart.mkii b/tex/context/base/m-chart.mkii new file mode 100644 index 000000000..2554fa2d4 --- /dev/null +++ b/tex/context/base/m-chart.mkii @@ -0,0 +1,48 @@ +%D \module +%D [ file=m-chart, +%D version=1998.10.10, +%D title=\CONTEXT\ Modules, +%D subtitle=Flow Charts, +%D author={Hans Hagen \& Ton Otten}, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D The \XML\ interface: + +\unprotect + +\startXMLdefinitions flowchart + +\defineXMLargument [flowchartdefinition] + {\defineFLOWchart[\XMLpar{flowchartdefinition}{identifier}{unknown}]} + +\defineXMLpickup [flowcell] + {\startFLOWcell + \defineXMLargument[name]{\unspaceafter\name}% + \defineXMLargument[shape]{\unspaceafter\shape}% + \defineXMLnestedargument[text]{\text}} + {\stopFLOWcell} + +\defineXMLenvironment [location] % global unspace/store + {\bgroup\defineXMLpush[x]\defineXMLpush[y]} + {\XMLunspace{x}\XMLunspace{y}% + \expanded{\egroup\noexpand\location{\XMLpop{x},\XMLpop{y}}}} + +\defineXMLenvironment [connection] + {\bgroup\defineXMLpush[type]\defineXMLpush[name]}% + {\XMLunspace{type}\XMLunspace{name}% + \expanded{\egroup\noexpand\connection[\XMLpop{type}]{\XMLpop{name}}}} + +\defineXMLsingular [flowchart] + {\expanded{\FLOWchart[\XMLpar{flowchart}{identifier}{unknown}]}} + +\defineXMLdirective [flowchart] [shapes] \setupFLOWshapes +\defineXMLdirective [flowchart] [lines] \setupFLOWlines + +\stopXMLdefinitions + +\protect \endinput diff --git a/tex/context/base/m-chart.mkiv b/tex/context/base/m-chart.mkiv new file mode 100644 index 000000000..4c008a5ee --- /dev/null +++ b/tex/context/base/m-chart.mkiv @@ -0,0 +1,20 @@ +%D \module +%D [ file=m-chart, +%D version=1998.10.10, +%D title=\CONTEXT\ Modules, +%D subtitle=Flow Charts, +%D author={Hans Hagen \& Ton Otten}, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D The \XML\ interface: + +\unprotect + +\writestatus\m!systems{The chart mkiv xml interface is not yet defined!} + +\protect \endinput diff --git a/tex/context/base/m-chart.tex b/tex/context/base/m-chart.tex index c8928f2d5..5ccf4c2ad 100644 --- a/tex/context/base/m-chart.tex +++ b/tex/context/base/m-chart.tex @@ -15,8 +15,8 @@ % todo: make mkiv variant % todo: use dimexpr/numspr -% will be redone with layers and dimexpr ro even better, by just using -% textext +% will be redone with layers and dimexpr or even better, by just using +% textext .. a nice example of old code %D This is an experimental module. Pieces of code will be moved %D to other modules. More features are possible but will be @@ -1280,36 +1280,6 @@ % \def\processFLOWbuffer#1{\getvalue{\FLOWbufferprefix#1}} % \def\typeFLOWbuffer #1{[Sorry, no verbatim chart #1 available.]} -%D The XML interface [will be mode protected or separate x-chart file] - -\startXMLdefinitions flowchart - -\defineXMLargument [flowchartdefinition] - {\defineFLOWchart[\XMLpar{flowchartdefinition}{identifier}{unknown}]} - -\defineXMLpickup [flowcell] - {\startFLOWcell - \defineXMLargument[name]{\unspaceafter\name}% - \defineXMLargument[shape]{\unspaceafter\shape}% - \defineXMLnestedargument[text]{\text}} - {\stopFLOWcell} - -\defineXMLenvironment [location] % global unspace/store - {\bgroup\defineXMLpush[x]\defineXMLpush[y]} - {\XMLunspace{x}\XMLunspace{y}% - \expanded{\egroup\noexpand\location{\XMLpop{x},\XMLpop{y}}}} - -\defineXMLenvironment [connection] - {\bgroup\defineXMLpush[type]\defineXMLpush[name]}% - {\XMLunspace{type}\XMLunspace{name}% - \expanded{\egroup\noexpand\connection[\XMLpop{type}]{\XMLpop{name}}}} - -\defineXMLsingular [flowchart] - {\expanded{\FLOWchart[\XMLpar{flowchart}{identifier}{unknown}]}} - -\defineXMLdirective [flowchart] [shapes] \setupFLOWshapes -\defineXMLdirective [flowchart] [lines] \setupFLOWlines - -\stopXMLdefinitions +\loadmarkfile{m-chart} \protect \endinput diff --git a/tex/context/base/m-punk.tex b/tex/context/base/m-punk.mkiv index 3b1baa75b..3b1baa75b 100644 --- a/tex/context/base/m-punk.tex +++ b/tex/context/base/m-punk.mkiv diff --git a/tex/context/base/m-steps.mkii b/tex/context/base/m-steps.mkii new file mode 100644 index 000000000..3e1f86312 --- /dev/null +++ b/tex/context/base/m-steps.mkii @@ -0,0 +1,83 @@ +%D \module +%D [ file=m-steps, +%D version=2001.05.28, +%D title=\CONTEXT\ Modules, +%D subtitle=Step Charts \& Tables, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D The \XML\ interface: + +\unprotect + +\defineXMLdirective [stepchart] [charts] \setupSTEPcharts +\defineXMLdirective [stepchart] [cells] \setupSTEPcells +\defineXMLdirective [stepchart] [texts] \setupSTEPtexts +\defineXMLdirective [stepchart] [lines] \setupSTEPlines + +\defineXMLdirective [steptable] [tables] \setupSTEPtables +\defineXMLdirective [steptable] [cells] \setupSTEPcells +\defineXMLdirective [steptable] [texts] \setupSTEPtexts +\defineXMLdirective [steptable] [lines] \setupSTEPlines + +\defineXMLpickup[stepchart][@@STPC] + {\bgroup + \defineXMLpush[top]% + \defineXMLpush[bot]% + \defineXMLenvironment[lines][@@STEL] + {\expanded{\startlines[\theXMLarguments{@@STEL}]}} + {\stoplines}% + \defineXMLenvironment[cells][@@STEC] + {\XMLerase{top}\XMLerase{bot}} + {\expanded{\cells[\theXMLarguments{@@STEC}]{\XMLpop{top}}{\XMLpop{bot}}}}% + \defineXMLenvironment[texts][@@STET] + {\XMLerase{top}\XMLerase{bot}} + {\expanded{\texts[\theXMLarguments{@@STET}]{\XMLpop{top}}{\XMLpop{bot}}}}% + \defineXMLenvironmentpush[cell][@@STEC] + {\XMLerase{cell}} + {\expanded{\cell [\theXMLarguments{@@STEC}]{\XMLpop{cell}}}}% + \defineXMLenvironmentpush [text] [@@STET] + {\XMLerase{text}} + {\expanded{\text [\theXMLarguments{@@STET}]{\XMLpop{text}}}}% + \expanded{\startSTEPchart[\theXMLarguments{@@STPC}]}} + {\stopSTEPchart + \egroup} + +\defineXMLpickup[steptable][@@STPT] + {\bgroup + \defineXMLenvironment[lines][@@STEL] + {\expanded{\startlines[\theXMLarguments{@@STEL}]}} + {\stoplines}% + \defineXMLargument[cell][@@STEC] + {\expanded{\cell[\theXMLarguments{@@STEC}]}}% + \defineXMLargument[text][@@STET] + {\expanded{\text[\theXMLarguments{@@STET}]}}% + \defineXMLargument[prep] + {\prep}% + \expanded{\startSTEPtable[\theXMLarguments{@@STPT}]}} + {\stopSTEPtable + \egroup} + +\defineXMLpickup[stepaligntable][@@STPT] + {\bgroup + \defineXMLenvironment[lines][@@STEL] + {\expanded{\setupSTEPlines[\theXMLarguments{@@STEL}]}} + {}% + \defineXMLpush[c1]\defineXMLpush[c2]\defineXMLpush[c3]% + \defineXMLenvironment[cells][@@STEC] + {\XMLerase{c1}\XMLerase{c1}\XMLerase{c3}} + {\expanded{\cells[\theXMLarguments{@@STEC}]{\XMLpop{c1}}{\XMLpop{c2}}{\XMLpop{c3}}}}% + \defineXMLargument[text][@@STET] + {\expanded{\text[\theXMLarguments{@@STET}]}}% + \defineXMLargument[prep] + {\prep}% + \expanded{\startSTEPaligntable[\theXMLarguments{@@STPT}]}} + {\stopSTEPaligntable + \egroup} + +\protect \endinput diff --git a/tex/context/base/m-steps.mkiv b/tex/context/base/m-steps.mkiv new file mode 100644 index 000000000..9bb56c532 --- /dev/null +++ b/tex/context/base/m-steps.mkiv @@ -0,0 +1,20 @@ +%D \module +%D [ file=m-steps, +%D version=2001.05.28, +%D title=\CONTEXT\ Modules, +%D subtitle=Step Charts \& Tables, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D The \XML\ interface: + +\unprotect + +\writestatus\m!systems{The steps mkiv xml interface is not yet defined!} + +\protect \endinput diff --git a/tex/context/base/m-steps.tex b/tex/context/base/m-steps.tex index 1e2f5d97d..1f6a37403 100644 --- a/tex/context/base/m-steps.tex +++ b/tex/context/base/m-steps.tex @@ -116,18 +116,6 @@ %D ... -\defineXMLdirective [stepchart] [charts] \setupSTEPcharts -\defineXMLdirective [stepchart] [cells] \setupSTEPcells -\defineXMLdirective [stepchart] [texts] \setupSTEPtexts -\defineXMLdirective [stepchart] [lines] \setupSTEPlines - -\defineXMLdirective [steptable] [tables] \setupSTEPtables -\defineXMLdirective [steptable] [cells] \setupSTEPcells -\defineXMLdirective [steptable] [texts] \setupSTEPtexts -\defineXMLdirective [steptable] [lines] \setupSTEPlines - -%D ... - \presetlocalframed[\@@STPF] \def\@@stepcell#1% @@ -664,31 +652,6 @@ \@@STELalternative, get_step_chart_bot_line(#1,#2), \@@STELrulethickness, \MPcolor{\@@STELcolor} ) )} -%D \XML\ coupling. - -\defineXMLpickup[stepchart][@@STPC] - {\bgroup - \defineXMLpush[top]% - \defineXMLpush[bot]% - \defineXMLenvironment[lines][@@STEL] - {\expanded{\startlines[\theXMLarguments{@@STEL}]}} - {\stoplines}% - \defineXMLenvironment[cells][@@STEC] - {\XMLerase{top}\XMLerase{bot}} - {\expanded{\cells[\theXMLarguments{@@STEC}]{\XMLpop{top}}{\XMLpop{bot}}}}% - \defineXMLenvironment[texts][@@STET] - {\XMLerase{top}\XMLerase{bot}} - {\expanded{\texts[\theXMLarguments{@@STET}]{\XMLpop{top}}{\XMLpop{bot}}}}% - \defineXMLenvironmentpush[cell][@@STEC] - {\XMLerase{cell}} - {\expanded{\cell [\theXMLarguments{@@STEC}]{\XMLpop{cell}}}}% - \defineXMLenvironmentpush [text] [@@STET] - {\XMLerase{text}} - {\expanded{\text [\theXMLarguments{@@STET}]{\XMLpop{text}}}}% - \expanded{\startSTEPchart[\theXMLarguments{@@STPC}]}} - {\stopSTEPchart - \egroup} - %D Step tables are the vertical counterpart of stepcharts. \newcounter\currentsteptable @@ -846,38 +809,6 @@ \@@STELalternative, get_step_table_line(\cellcounter), \@@STELrulethickness, \MPcolor{\@@STELcolor} ) )} -\defineXMLpickup[steptable][@@STPT] - {\bgroup - \defineXMLenvironment[lines][@@STEL] - {\expanded{\startlines[\theXMLarguments{@@STEL}]}} - {\stoplines}% - \defineXMLargument[cell][@@STEC] - {\expanded{\cell[\theXMLarguments{@@STEC}]}}% - \defineXMLargument[text][@@STET] - {\expanded{\text[\theXMLarguments{@@STET}]}}% - \defineXMLargument[prep] - {\prep}% - \expanded{\startSTEPtable[\theXMLarguments{@@STPT}]}} - {\stopSTEPtable - \egroup} - -\defineXMLpickup[stepaligntable][@@STPT] - {\bgroup - \defineXMLenvironment[lines][@@STEL] - {\expanded{\setupSTEPlines[\theXMLarguments{@@STEL}]}} - {}% - \defineXMLpush[c1]\defineXMLpush[c2]\defineXMLpush[c3]% - \defineXMLenvironment[cells][@@STEC] - {\XMLerase{c1}\XMLerase{c1}\XMLerase{c3}} - {\expanded{\cells[\theXMLarguments{@@STEC}]{\XMLpop{c1}}{\XMLpop{c2}}{\XMLpop{c3}}}}% - \defineXMLargument[text][@@STET] - {\expanded{\text[\theXMLarguments{@@STET}]}}% - \defineXMLargument[prep] - {\prep}% - \expanded{\startSTEPaligntable[\theXMLarguments{@@STPT}]}} - {\stopSTEPaligntable - \egroup} - \protect \endinput % A simple paragraph-flow test: diff --git a/tex/context/base/page-ini.mkiv b/tex/context/base/page-ini.mkiv index 96590d9a1..476acfd1e 100644 --- a/tex/context/base/page-ini.mkiv +++ b/tex/context/base/page-ini.mkiv @@ -706,7 +706,8 @@ \v!frame=>\chardef\gridboxlinemode \plusthree, \v!nonumber=>\chardef\gridboxlinenomode\zerocount, \v!right=>\chardef\gridboxlinenomode\plusone, - \v!left=>\chardef\gridboxlinenomode\plustwo]% + \v!left=>\chardef\gridboxlinenomode\plustwo, + \v!outer=>\chardef\gridboxlinenomode\plusthree]% \ifcase\showgridstate \let\addtextgridlayer\gobbleoneargument \else % 1=bottom 2=top @@ -1230,8 +1231,6 @@ \def\dodefinepagebreak[#1][#2]% non recursive, meant for simple mappings {\setvalue{\??pe::#1}{#2}} -% hier nog uti blokkeren - % don't change this / test case: % % \setupbackgrounds[state=repeat] diff --git a/tex/context/base/spac-ver.lua b/tex/context/base/spac-ver.lua index 712307626..a5daa96f1 100644 --- a/tex/context/base/spac-ver.lua +++ b/tex/context/base/spac-ver.lua @@ -75,7 +75,7 @@ vspacing.data.snapmethods = vspacing.data.snapmethods or { } storage.register("vspacing/data/snapmethods", vspacing.data.snapmethods, "vspacing.data.snapmethods") -local snapmethods, snapht, snapdp, snaphtdp = vspacing.data.snapmethods, 0, 0, 0 +local snapmethods = vspacing.data.snapmethods local default = { maxheight = true, @@ -132,6 +132,8 @@ function vspacing.define_snap_method(name,method) tex.write(n) end +local snapht, snapdp, snaphtdp = 0, 0, 0 + function vspacing.freeze_snap_method(ht,dp) snapht, snapdp = ht or texdimen.bodyfontstrutheight, dp or texdimen.bodyfontstrutdepth snaphtdp = snapht + snapdp @@ -241,6 +243,7 @@ vspacing.categories = { [5] = 'disable', [6] = 'nowhite', [7] = 'goback', + [8] = 'together' } local categories = vspacing.categories @@ -291,6 +294,9 @@ do -- todo: interface.variables local k_fixed, k_flexible, k_category, k_penalty, k_order = variables.fixed, variables.flexible, "category", "penalty", "order" + -- This will change: just node.write and we can store the values in skips which + -- then obeys grouping + local function analyse(str,oldcategory,texsprint) for s in gmatch(str,"([^ ,]+)") do local amount, keyword, detail = splitter:match(s) @@ -512,7 +518,7 @@ local skips = { local free_glue_node = free_node local free_glue_spec = free_node -local discard, largest, force, penalty, add, disable, nowhite, goback = 0, 1, 2, 3, 4, 5, 6, 7 +local discard, largest, force, penalty, add, disable, nowhite, goback, together = 0, 1, 2, 3, 4, 5, 6, 7, 8 function vspacing.snap_box(n,how) local sv = snapmethods[how] @@ -520,10 +526,18 @@ function vspacing.snap_box(n,how) local list = texbox[n].list --~ if list and (list.id == hlist or list.id == vlist) then if list then - local h, d, ch, cd, lines = snap_hlist(list,sv,texht[n],texdp[n]) - texht[n], texdp[n] = ch, cd - if trace_vsnapping then - logs.report("snapper", "hlist snapped from (%s,%s) to (%s,%s) using method '%s' (%s) for '%s' (%s lines)",h,d,ch,cd,sv.name,sv.specification,"direct",lines) + local s = has_attribute(list,snap_method) + if s == 0 then + if trace_vsnapping then + logs.report("snapper", "hlist not snapped, already done") + end + else + local h, d, ch, cd, lines = snap_hlist(list,sv,texht[n],texdp[n]) + texht[n], texdp[n] = ch, cd + if trace_vsnapping then + logs.report("snapper", "hlist snapped from (%s,%s) to (%s,%s) using method '%s' (%s) for '%s' (%s lines)",h,d,ch,cd,sv.name,sv.specification,"direct",lines) + end + set_attribute(list,snap_method,0) end end end @@ -552,10 +566,15 @@ local function collapser(head,where,what,trace,snap) -- maybe also pass tail reset_tracing(head) trace_info("start analyzing",where,what) end - local current = head + local current, oldhead = head, head + snapht, snapdp = ht or texdimen.bodyfontstrutheight, dp or texdimen.bodyfontstrutdepth + snaphtdp = snapht + snapdp local glue_order, glue_data, force_glue = 0, nil, false local penalty_order, penalty_data, natural_penalty = 0, nil, nil - local parskip, ignore_parskip, ignore_following, ignore_whitespace = nil, false, false, false + local parskip, ignore_parskip, ignore_following, ignore_whitespace, keep_together = nil, false, false, false, false + -- + -- todo: keep_together: between headers + -- local function flush(why) if penalty_data then local p = make_penalty_node(penalty_data) @@ -584,24 +603,25 @@ local function collapser(head,where,what,trace,snap) -- maybe also pass tail if id == hlist or id == vlist then if snap then local s = has_attribute(current,snap_method) - if s then - unset_attribute(current,snap_method) - if not has_attribute(current,snap_done) then - local sv = snapmethods[s] - if sv then - local h, d, ch, cd, lines = snap_hlist(current,sv) - if trace_vsnapping then - logs.report("snapper", "hlist snapped from (%s,%s) to (%s,%s) using method '%s' (%s) for '%s' (%s lines)",h,d,ch,cd,sv.name,sv.specification,where,lines) - end - elseif trace_vsnapping then - logs.report("snapper", "hlist not snapped due to unknown snap specification") + if not s then + -- if trace_vsnapping then + -- logs.report("snapper", "hlist not snapped") + -- end + elseif s == 0 then + if trace_vsnapping then + logs.report("snapper", "hlist not snapped, already done") + end + else + local sv = snapmethods[s] + if sv then + local h, d, ch, cd, lines = snap_hlist(current,sv) + if trace_vsnapping then + logs.report("snapper", "hlist snapped from (%s,%s) to (%s,%s) using method '%s' (%s) for '%s' (%s lines)",h,d,ch,cd,sv.name,sv.specification,where,lines) end - set_attribute(current,snap_done,s) elseif trace_vsnapping then - logs.report("snapper", "hlist not snapped, already done") + logs.report("snapper", "hlist not snapped due to unknown snap specification") end - elseif trace_vsnapping then - -- logs.report("snapper", "hlist not snapped") + set_attribute(current,snap_method,0) end else -- @@ -636,6 +656,7 @@ local function collapser(head,where,what,trace,snap) -- maybe also pass tail elseif penalty_order == so and sp > penalty_data then penalty_data = sp end + if trace then trace_skip('penalty in skip',sc,so,sp,current) end head, current = remove_node(head, current, true) elseif not sc then -- if not sc then if glue_data then @@ -677,6 +698,10 @@ local function collapser(head,where,what,trace,snap) -- maybe also pass tail ignore_following = true if trace then trace_skip("disable",sc,so,sp,current) end head, current = remove_node(head, current, true) + elseif sc == together then + keep_together = true + if trace then trace_skip("together",sc,so,sp,current) end + head, current = remove_node(head, current, true) elseif sc == nowhite then ignore_whitespace = true head, current = remove_node(head, current, true) @@ -745,9 +770,9 @@ local function collapser(head,where,what,trace,snap) -- maybe also pass tail end elseif subtype == line_skip then if snap then - local sn = has_attribute(current,snap_method) - if sn then - unset_attribute(current,snap_method) + local s = has_attribute(current,snap_method) + if s and s ~= 0 then + set_attribute(current,snap_method,0) local spec = current.spec if spec then spec.width = 0 @@ -766,9 +791,9 @@ local function collapser(head,where,what,trace,snap) -- maybe also pass tail current = current.next elseif subtype == baseline_skip then if snap then - local sn = has_attribute(current,snap_method) - if sn then - unset_attribute(current,snap_method) + local s = has_attribute(current,snap_method) + if s and s ~= 0 then + set_attribute(current,snap_method,0) local spec = current.spec if spec then spec.width = 0 @@ -806,8 +831,8 @@ local function collapser(head,where,what,trace,snap) -- maybe also pass tail elseif subtype == top_skip_code or subtype == split_top_skip_code then if snap then local s = has_attribute(current,snap_method) - if s then - unset_attribute(current,snap_method) + if s and s ~= 0 then + set_attribute(current,snap_method,0) local sv = snapmethods[s] local w, cw = snap_topskip(current,sv) if trace_vsnapping then @@ -886,6 +911,9 @@ current = current.next trace_info("stop flushing",where,what) end show_tracing(head) + if oldhead ~= head then + trace_info("head has been changed from '%s' to '%s'",node.type(oldhead.id),node.type(head.id)) + end end return head, true end diff --git a/tex/context/base/spac-ver.mkiv b/tex/context/base/spac-ver.mkiv index 8849d71c1..15e37d61a 100644 --- a/tex/context/base/spac-ver.mkiv +++ b/tex/context/base/spac-ver.mkiv @@ -1274,13 +1274,24 @@ \resetsnapvalue \dowithnextbox{\dododosnaptogrid{#1}}} +% eventually there will always be a line snap + \def\dododosnaptogrid#1% {\ifvbox\nextbox \ctxlua{nodes.collapse_vbox(\number\nextbox)}% \fi \doifelsenothing{#1}{\setsnapvalue\v!normal}{\autosetsnapvalue{#1}}% \ctxlua{vspacing.snap_box(\number\nextbox,\number\attribute\snapmethodattribute)}% - \box\nextbox +% \ifzeropt\ht\nextbox +% \ifzeropt\dp\nextbox +% \box\nextbox % here, else empty and zero +% \kern-\bodyfontlineheight +% \else +% \box\nextbox +% \fi +% \else + \box\nextbox +% \fi \egroup} % no off @@ -1322,8 +1333,8 @@ \hss}% \flushnextbox}}} -\chardef\gridboxlinenomode\plusone -\chardef\gridboxlinemode \plusone % 0:nothing 1:all 2:lines 3:frame +\chardef\gridboxlinenomode\plusone % 0:nothing 1:all 2:lines 3:frame 4:l/r +\chardef\gridboxlinemode \plusone \def\gridboxvbox {\ifcase\gridboxlinemode\vbox\or\ruledvbox\or\vbox\or\ruledvbox\else\ruledvbox\fi} \def\gridboxwidth{\ifcase\gridboxlinemode0\or.5\or.5\or0\else.5\fi\testrulewidth} @@ -1335,6 +1346,9 @@ \offinterlineskip \hsize#2% \baselinerulefalse + \ifnum\gridboxlinenomode=\plusthree + \chardef\gridboxlinenomode\ifodd\realpageno\plusone\else\plustwo\fi + \fi \gridboxvbox % calculated size {\getrawnoflines{#3}% \getnoflines{#3}% % \ifgridsnapping \else @@ -1588,7 +1602,7 @@ \fi\fi \relax} -\definevspacing[\v!samepage][penalty:10000] +\definevspacing[\v!samepage][penalty:10000] % real strong \definevspacing[\v!max] [category:1] \definevspacing[\v!force] [category:2] \definevspacing[\v!disable] [category:5] @@ -1600,6 +1614,9 @@ \definevspacing[\s!default] [\v!white] % was big for a while +\dorecurse{10} % todo: other values < 4000 + {\expanded{\definevspacing[\v!samepage-\recurselevel][penalty:\the\numexpr4000+250*\recurselevel\relax]}} + \setfalse\vspacingenabled \newtoks\everyenablevspacing diff --git a/tex/context/base/strc-itm.mkiv b/tex/context/base/strc-itm.mkiv index 315fb8236..b76abb9ed 100644 --- a/tex/context/base/strc-itm.mkiv +++ b/tex/context/base/strc-itm.mkiv @@ -230,10 +230,10 @@ \ifx\itemgroupconstantvalue\empty\else \splitstring\itemgroupconstantvalue\at*\to\itemgroupfirst\and\itemgroupsecond \ifx\itemgroupsecond\empty - \ifcsname\??op:::\itemgroupfirst\endcsname\csname\??op:::\itemgroupfirst\endcsname\fi - \else - \ifcsname\??op:::\itemgroupsecond\endcsname\csname\??op:::\itemgroupsecond\endcsname\fi + \let\itemgroupsecond\itemgroupfirst + \let\itemgroupfirst\!!plusone \fi + \ifcsname\??op:::\itemgroupsecond\endcsname\csname\??op:::\itemgroupsecond\endcsname\fi \fi} \newconditional\inlinelistitem \setfalse\inlinelistitem @@ -913,7 +913,7 @@ \else \scratchdimen\zeropoint \fi - \llap{\hbox to \itemgrouplistwidth{\ifconditional\sublistitem\llap{+}\fi\box\itemgroupitembox\hss}}% was: \hfill + \llap{\hbox to \itemgrouplistwidth{\ifconditional\sublistitem\llap{+\enspace}\fi\box\itemgroupitembox\hss}}% was: \hfill \hskip\scratchdimen} \def\optimizelistitemsbreak @@ -982,7 +982,7 @@ % so that content differs per run (esp mp graphics afterwards) \checkforrepeatedlistitem \ifdim\itemgroupaskedwidth<\zeropoint\relax - \llap{\ifconditional\sublistitem\llap{+}\fi\box\itemgroupitembox\hskip\leftmargindistance}% + \llap{\ifconditional\sublistitem\llap{+\enspace}\fi\box\itemgroupitembox\hskip\leftmargindistance}% \else \ifdim\itemgroupaskedwidth=\zeropoint\relax \calculatelistwidth1% @@ -990,14 +990,14 @@ \calculatelistwidth\currentitemlevel \fi \ifconditional\textlistitem - \hbox{\ifconditional\sublistitem+\fi\box\itemgroupitembox\hskip\interwordspace}\nobreak + \hbox{\ifconditional\sublistitem+\enspace\fi\box\itemgroupitembox\hskip\interwordspace}\nobreak \else\ifconditional\inlinelistitem - \hbox to \itemgrouplistwidth{\ifconditional\sublistitem\llap{+}\fi\box\itemgroupitembox\hss}% was: \hfill + \hbox to \itemgrouplistwidth{\ifconditional\sublistitem\llap{+\enspace}\fi\box\itemgroupitembox\hss}% was: \hfill \else\ifconditional\txtlistitem \dodotxtitem \else % todo: align+marge binnen de hbox - \llap{\hbox to \itemgrouplistwidth{\ifconditional\sublistitem\llap{+}\fi + \llap{\hbox to \itemgrouplistwidth{\ifconditional\sublistitem\llap{+\enspace}\fi \symalignleft \box\itemgroupitembox\hfil \hskip\getitemparameter\currentitemlevel\c!distance% T h diff --git a/tex/context/base/strc-not.mkiv b/tex/context/base/strc-not.mkiv index 48c48caa0..4598be00c 100644 --- a/tex/context/base/strc-not.mkiv +++ b/tex/context/base/strc-not.mkiv @@ -993,8 +993,11 @@ \def\doaddtototalnoteheight#1% {\ifdim\ht#1>\zeropoint - \advance\totalnoteheight\ht #1% - \advance\totalnoteheight\skip#1% + \ifcase\count#1\else + % todo: divide by count + \advance\totalnoteheight\ht #1% + \advance\totalnoteheight\skip#1% + \fi \fi} \def\docalculatetotalnoteheight diff --git a/tex/context/base/strc-sec.mkiv b/tex/context/base/strc-sec.mkiv index b7e18746d..aa1d4721f 100644 --- a/tex/context/base/strc-sec.mkiv +++ b/tex/context/base/strc-sec.mkiv @@ -611,40 +611,56 @@ % \chardef\somestructureheadbreakmethod\plusone % 0=nothing, 1=weighted, 2=strict, 3=vspacing \chardef\somestructureheadbreakmethod\plusthree +% \def\dopreventbreakafterstructureheadauto % used after \c!before +% {\ifcase\somestructureheadbreakmethod +% % 0 = nothing +% \or +% % 1 = old weighted version +% \ifnum\currentstructureheadlevel>\precedingstructurelevel +% \dosomebreak{\penalty\numexpr20000+500*\currentstructureheadlevel\relax}% +% \else +% \dosomebreak\allowbreak % brr +% \fi +% \or +% % 2 = strict version +% \dosomebreak{\penalty\maxdimen}% +% \or +% % 3 = vspacing +% \vspacing[\v!samepage]% if preceded by ! then a loop +% \else +% % nothing +% \fi} +% +% \def\dopreventbreakafterstructureheadspec#1% see enumerations etc +% {\ifcase\somestructureheadbreakmethod +% % 0 = nothing +% \or +% % 1 = old weighted version +% \dosomebreak{\penalty\numexpr20000+500*(\currentstructureheadlevel+#1)\relax}% +% \or +% % 2 = strict version +% \dosomebreak{\penalty\maxdimen}% +% \or +% % 3 = vspacing +% \vspacing[\v!samepage]% +% \else +% % nothing +% \fi} +% +% todo: \vspacing[category:8] == keep_together + \def\dopreventbreakafterstructureheadauto % used after \c!before {\ifcase\somestructureheadbreakmethod % 0 = nothing - \or - % 1 = old weighted version - \ifnum\currentstructureheadlevel>\precedingstructurelevel - \dosomebreak{\penalty\numexpr20000+500*\currentstructureheadlevel\relax}% - \else - \dosomebreak\allowbreak % brr - \fi - \or - % 2 = strict version - \dosomebreak{\penalty\maxdimen}% - \or - % 3 = vspacing - \vspacing[\v!samepage]% if preceded by ! then a loop \else - % nothing + \vspacing[\v!samepage-\currentstructureheadlevel]% \fi} \def\dopreventbreakafterstructureheadspec#1% see enumerations etc {\ifcase\somestructureheadbreakmethod % 0 = nothing - \or - % 1 = old weighted version - \dosomebreak{\penalty\numexpr20000+500*(\currentstructureheadlevel+#1)\relax}% - \or - % 2 = strict version - \dosomebreak{\penalty\maxdimen}% - \or - % 3 = vspacing - \vspacing[\v!samepage]% \else - % nothing + \vspacing[\v!samepage-\the\numexpr\currentstructureheadlevel+1\relax]% todo #1 \fi} \def\dohandlepagebreakX{\dopreventbreakafterstructureheadspec} % no \let so we can redefind diff --git a/tex/context/base/x-calcmath.mkiv b/tex/context/base/x-calcmath.mkiv index 29bc1af9a..c726843fa 100644 --- a/tex/context/base/x-calcmath.mkiv +++ b/tex/context/base/x-calcmath.mkiv @@ -1,5 +1,3 @@ -% engine=luatex - %D \module %D [ file=m-calcmath, %D version=2006.04.24, % 1999.11.06, diff --git a/tex/context/base/x-contml.tex b/tex/context/base/x-contml.mkii index ba6762e77..a582d8eb9 100644 --- a/tex/context/base/x-contml.tex +++ b/tex/context/base/x-contml.mkii @@ -1,5 +1,3 @@ -% interface=en - %M \usemodule [contml] \autoXMLnamespace [context] %M \definefilesynonym [context] [x-contml.xsd] diff --git a/tex/context/base/x-corres.tex b/tex/context/base/x-corres.mkii index 09c7263dc..09c7263dc 100644 --- a/tex/context/base/x-corres.tex +++ b/tex/context/base/x-corres.mkii diff --git a/tex/context/base/x-fe.tex b/tex/context/base/x-fe.mkii index 8562b1d52..8562b1d52 100644 --- a/tex/context/base/x-fe.tex +++ b/tex/context/base/x-fe.mkii diff --git a/tex/context/base/x-fo.tex b/tex/context/base/x-fo.mkii index b2b0b59f9..b2b0b59f9 100644 --- a/tex/context/base/x-fo.tex +++ b/tex/context/base/x-fo.mkii diff --git a/tex/context/base/x-foxet.mkii b/tex/context/base/x-foxet.mkii new file mode 100644 index 000000000..0f8e43af9 --- /dev/null +++ b/tex/context/base/x-foxet.mkii @@ -0,0 +1,28 @@ +%D \module +%D [ file=x-foxet, +%D version=2004.03.12, % based on earlier experiments +%D title=\FOXET, +%D subtitle=Formatting Objects, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This module is just a shortcut for: + +% fo = basic formatting objects +% fe = basic formatting extensions +% fx = extra formatting objects +% fu = user formatting objects +% fs = setup + +\usemodule[fo,fe,fx,fu,fs,mathml] + +\usemodule[fp] % passivetex bonus + +% \autoXMLnamespace[mml,mm,mathml] + +\endinput diff --git a/tex/context/base/x-foxet.mkiv b/tex/context/base/x-foxet.mkiv new file mode 100644 index 000000000..b27969721 --- /dev/null +++ b/tex/context/base/x-foxet.mkiv @@ -0,0 +1,29 @@ +%D \module +%D [ file=x-foxet, +%D version=2004.03.12, % based on earlier experiments +%D title=\FOXET, +%D subtitle=Formatting Objects, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D Nota bene: I will reimplement formatting object in proper +%D \MKIV\ code. + +\writestatus{foxet}{the mkiv variant is under construction} + +%D This module is just a shortcut for: + +% fo = basic formatting objects +% fe = basic formatting extensions +% fx = extra formatting objects +% fu = user formatting objects +% fs = setup + +% \usemodule[fo,fe,fx,fu,fs,mathml] + +\endinput diff --git a/tex/context/base/x-foxet.tex b/tex/context/base/x-foxet.tex deleted file mode 100644 index 78cc0efb7..000000000 --- a/tex/context/base/x-foxet.tex +++ /dev/null @@ -1,15 +0,0 @@ -%D This is just a shortcut for: - -% fo = basic formatting objects -% fe = basic formatting extensions -% fx = extra formatting objects -% fu = user formatting objects -% fs = setup - -\usemodule[fo,fe,fx,fu,fs,mathml] - -\usemodule[fp] % passivetex bonus - -% \autoXMLnamespace[mml,mm,mathml] - -\endinput diff --git a/tex/context/base/x-pending.mkiv b/tex/context/base/x-pending.mkiv new file mode 100644 index 000000000..114b81890 --- /dev/null +++ b/tex/context/base/x-pending.mkiv @@ -0,0 +1,38 @@ +%D \module +%D [ file=x-pending, +%D version=2008.04.04, +%D title=\CONTEXT\ Style File, +%D subtitle=Track \MKII\ \XML\ usage in \MKIV, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA / Hans Hagen \& Ton Otten}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D Including this module will result in the production of +%D a file \type {jobname-pending-xml.log} which has a +%D \LUA\ table with \XML\ elements that are still catched by +%D \MKII\ code, when enabled. + +\startluacode + local list = { } + function document.check_pending_xml_element(str) + list[str] = (list[str] and (list[str]+1)) or 1 + end + function document.show_pending_xml_elements() + io.savedata("\jobname-pending-xml-mkii.log", table.serialize(list)) + io.savedata("\jobname-pending-xml-mkiv.log", table.serialize(lxml.get_command_status())) + end +\stopluacode + +\defineXMLcommand + [default] + {\ctxlua{document.check_pending_xml_element("\currentXMLelement")}} + +\appendtoks + \ctxlua{document.show_pending_xml_elements()}% +\to \everystoptext + +\endinput diff --git a/tex/context/base/x-set-11.mkiv b/tex/context/base/x-set-11.mkiv index 4e86f668e..087aeb459 100644 --- a/tex/context/base/x-set-11.mkiv +++ b/tex/context/base/x-set-11.mkiv @@ -89,10 +89,37 @@ %D Loading: -\startxmlsetups xml:setups:register +\let\currentSETUPfullname\s!unknown + +\startxmlsetups xml:setups:assemblename + \doifelse {\xmlatt{#1}{environment}} {yes} { + \let\currentSETUPprefix\e!start + } { + \let\currentSETUPprefix\empty + } \edef\currentSETUPname{\xmlatt{#1}{name}} - % \writestatus{setups}{registering \currentSETUPname}% - \expanded{\texcommand[stp:x:\currentSETUPname]{\currentSETUPname}} + \doifelse {\xmlatt{#1}{generated}} {yes} { + \def\currentSETUPgenerated{*} + } { + \let\currentSETUPgenerated\empty + } + \doifelsenothing {\xmlatt{#1}{variant}} { + \let\currentSETUPvariant\empty + } { + \def\currentSETUPvariant{:\xmlatt{#1}{variant}} + } + \edef\currentSETUPfullname { + \currentSETUPprefix + \currentSETUPname + \currentSETUPvariant + \currentSETUPgenerated + } +\stopxmlsetups + +\startxmlsetups xml:setups:register + \xmlsetup{#1}{xml:setups:assemblename} + %expanded{\texcommand[stp:x:\currentSETUPfullname]{\currentSETUPfullname}} + \expanded{\texcommand[stp:x:\currentSETUPfullname]{#1}} \stopxmlsetups \startxmlsetups xml:setups:basics @@ -125,7 +152,8 @@ \def\shortsetup{\shortsetuptrue \doshowsetup} \def\setupsetup{\dodoubleargument\getparameters[\??stp]} -\unexpanded\def\showsetupinlist#1#2#3{\shortsetupfalse\showsetupindeed{#3}\par} +%unexpanded\def\showsetupinlist#1#2#3{\shortsetupfalse\showsetupindeed{#3}\par} +\unexpanded\def\showsetupinlist#1#2#3{\shortsetupfalse\xmlsetup{#3}{xml:setups:typeset}\par} % todo: only references in lists @@ -166,7 +194,6 @@ \startxmlsetups xml:setups:typeset \xmlpushdocument{setups} - \edef\currentSETUPname{\xmlatt{#1}{name}}% \getvalue{\e!start setuptext} \tttf \nohyphens diff --git a/tex/context/base/x-set-12.tex b/tex/context/base/x-set-12.tex index 6d3667771..d79901433 100644 --- a/tex/context/base/x-set-12.tex +++ b/tex/context/base/x-set-12.tex @@ -72,7 +72,7 @@ \definecolor [lightgray] [s=.9] \definecolor [darkgray] [s=.1] -\usetypescript[palatino][\defaultencoding] +\usetypescript[palatino] \setupbodyfont[palatino,9pt] \setupcolors @@ -192,9 +192,9 @@ \startmakeup[\v!standard] \dontcomplain + \setupalign[\v!left] \startcolor[TitleColor] \definedfont[RegularBold at 100pt]\setstrut - \setupalign[\v!left] \strut Con\TeX t \par \definedfont[RegularBold at 50pt]\setstrut \setups[text:commands] diff --git a/tex/context/base/x-xtag.mkiv b/tex/context/base/x-xtag.mkiv new file mode 100644 index 000000000..d7e2f2559 --- /dev/null +++ b/tex/context/base/x-xtag.mkiv @@ -0,0 +1,23 @@ +%D \module +%D [ file=x-xtag, +%D version=2009.09.23, +%D title=\CONTEXT\ Modules, +%D subtitle=\XML\ stream handler, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright=PRAGMA] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\ifdefined\XMLbanner \endinput \fi + +\loadcorefile{xtag-ini} +\loadcorefile{xtag-ext} +\loadcorefile{xtag-exp} +\loadcorefile{xtag-pre} % has old encoding code +\loadcorefile{xtag-xsd} % will go away (stub anyway) +\loadcorefile{xtag-rng} % will go away (stub anyway) + +\endinput diff --git a/tex/context/interface/cont-cs.xml b/tex/context/interface/cont-cs.xml index c22ededd8..53d861c90 100644 --- a/tex/context/interface/cont-cs.xml +++ b/tex/context/interface/cont-cs.xml @@ -4001,6 +4001,7 @@ <cd:constant type="nonumber"/> <cd:constant type="vpravo"/> <cd:constant type="vlevo"/> + <cd:constant type="vnejsi"/> </cd:keywords> <cd:content n="2"/> </cd:arguments> diff --git a/tex/context/interface/cont-de.xml b/tex/context/interface/cont-de.xml index af98387fc..aaea5d00c 100644 --- a/tex/context/interface/cont-de.xml +++ b/tex/context/interface/cont-de.xml @@ -4001,6 +4001,7 @@ <cd:constant type="nonumber"/> <cd:constant type="rechts"/> <cd:constant type="links"/> + <cd:constant type="aussen"/> </cd:keywords> <cd:content n="2"/> </cd:arguments> diff --git a/tex/context/interface/cont-en.xml b/tex/context/interface/cont-en.xml index 01feb5e50..4f0237627 100644 --- a/tex/context/interface/cont-en.xml +++ b/tex/context/interface/cont-en.xml @@ -4001,6 +4001,7 @@ <cd:constant type="nonumber"/> <cd:constant type="right"/> <cd:constant type="left"/> + <cd:constant type="outer"/> </cd:keywords> <cd:content n="2"/> </cd:arguments> diff --git a/tex/context/interface/cont-fr.xml b/tex/context/interface/cont-fr.xml index 22011cd9f..690903ca4 100644 --- a/tex/context/interface/cont-fr.xml +++ b/tex/context/interface/cont-fr.xml @@ -4001,6 +4001,7 @@ <cd:constant type="sansnumero"/> <cd:constant type="droite"/> <cd:constant type="gauche"/> + <cd:constant type="exterieur"/> </cd:keywords> <cd:content n="2"/> </cd:arguments> diff --git a/tex/context/interface/cont-it.xml b/tex/context/interface/cont-it.xml index 14b9cbaa4..e2502d5cd 100644 --- a/tex/context/interface/cont-it.xml +++ b/tex/context/interface/cont-it.xml @@ -4001,6 +4001,7 @@ <cd:constant type="nonumber"/> <cd:constant type="destra"/> <cd:constant type="sinistra"/> + <cd:constant type="esterno"/> </cd:keywords> <cd:content n="2"/> </cd:arguments> diff --git a/tex/context/interface/cont-nl.xml b/tex/context/interface/cont-nl.xml index 401fe14e1..47ce230b5 100644 --- a/tex/context/interface/cont-nl.xml +++ b/tex/context/interface/cont-nl.xml @@ -4001,6 +4001,7 @@ <cd:constant type="geennummer"/> <cd:constant type="rechts"/> <cd:constant type="links"/> + <cd:constant type="buiten"/> </cd:keywords> <cd:content n="2"/> </cd:arguments> diff --git a/tex/context/interface/cont-pe.xml b/tex/context/interface/cont-pe.xml index e0d3f7ce5..bcf164d8d 100644 --- a/tex/context/interface/cont-pe.xml +++ b/tex/context/interface/cont-pe.xml @@ -4001,6 +4001,7 @@ <cd:constant type="بدونشماره"/> <cd:constant type="راست"/> <cd:constant type="چپ"/> + <cd:constant type="خارجی"/> </cd:keywords> <cd:content n="2"/> </cd:arguments> diff --git a/tex/context/interface/cont-ro.xml b/tex/context/interface/cont-ro.xml index ba83586a1..2f6dd9f3e 100644 --- a/tex/context/interface/cont-ro.xml +++ b/tex/context/interface/cont-ro.xml @@ -4001,6 +4001,7 @@ <cd:constant type="nonumber"/> <cd:constant type="dreapta"/> <cd:constant type="stanga"/> + <cd:constant type="extern"/> </cd:keywords> <cd:content n="2"/> </cd:arguments> diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index a07ca9466..e107372e9 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts.lua --- merge date : 09/23/09 10:11:52 +-- merge date : 09/25/09 09:47:31 do -- begin closure to overcome local limits and interference |