diff options
author | Hans Hagen <pragma@wxs.nl> | 2013-08-15 13:53:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2013-08-15 13:53:00 +0200 |
commit | 9a5a942e9d22bd98007f378d7f9b54080ac353ce (patch) | |
tree | 16e261dad9a257d5fa56208182683832888ac252 /tex | |
parent | c4f0289101d4a69b1985b008e21370b148daf5a2 (diff) | |
download | context-9a5a942e9d22bd98007f378d7f9b54080ac353ce.tar.gz |
beta 2013.08.15 13:53
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4110 -> 4106 bytes | |||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/font-col.lua | 1 | ||||
-rw-r--r-- | tex/context/base/m-chart.lua | 6 | ||||
-rw-r--r-- | tex/context/base/math-noa.lua | 15 | ||||
-rw-r--r-- | tex/context/base/node-ini.lua | 22 | ||||
-rw-r--r-- | tex/context/base/node-met.lua | 64 | ||||
-rw-r--r-- | tex/context/base/node-ser.lua | 68 | ||||
-rw-r--r-- | tex/context/base/node-tsk.lua | 8 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24705 -> 24719 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.log | 2 | ||||
-rw-r--r-- | tex/context/base/task-ini.lua | 3 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 2 |
14 files changed, 160 insertions, 35 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 05cf26443..5fb029493 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{2013.08.14 15:25} +\newcontextversion{2013.08.15 13:53} %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 14018b171..c845bb444 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 c4690e79f..4acc44762 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2013.08.14 15:25} +\edef\contextversion{2013.08.15 13:53} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/font-col.lua b/tex/context/base/font-col.lua index e18dfaf91..b15997cba 100644 --- a/tex/context/base/font-col.lua +++ b/tex/context/base/font-col.lua @@ -173,6 +173,7 @@ function collections.clonevector(name) end else for unicode = start, stop do + local unic = unicode + offset - start if force or (not vector[unic] and not oldchars[unic]) then if remap then vector[unic] = { cloneid, remap[unicode] } diff --git a/tex/context/base/m-chart.lua b/tex/context/base/m-chart.lua index c4da2eb63..2b9869379 100644 --- a/tex/context/base/m-chart.lua +++ b/tex/context/base/m-chart.lua @@ -19,7 +19,7 @@ local P, S, C, Cc, lpegmatch = lpeg.P, lpeg.S, lpeg.C, lpeg.Cc, lpeg.match local report_chart = logs.reporter("chart") -local points = number.points +local points = number.points -- we can use %p instead local variables = interfaces.variables @@ -499,7 +499,7 @@ local function process_cells(chart,xoffset,yoffset) local linesettings = settings.line context("flow_shape_line_color := \\MPcolor{%s} ;", linesettings.color) context("flow_shape_fill_color := \\MPcolor{%s} ;", linesettings.backgroundcolor) - context("flow_shape_line_width := %s ; ", points(linesettingsrulethickness)) + context("flow_shape_line_width := %s ; ", points(linesettings.rulethickness)) elseif focus[cell.focus] or focus[cell.name] then local focussettings = settings.focus context("flow_shape_line_color := \\MPcolor{%s} ;", focussettings.framecolor) @@ -580,7 +580,7 @@ local function process_connections(chart,xoffset,yoffset) context("flow_touchshape := %s ;", linesettings.offset == v_none and "true" or "false") context("flow_dsp_x := %s ; flow_dsp_y := %s ;",connection.dx or 0, connection.dy or 0) context("flow_connection_line_color := \\MPcolor{%s} ;",linesettings.color) - context("flow_connection_line_width := 2pt ;",points(linesettings.rulethickness)) + context("flow_connection_line_width := %s ;",points(linesettings.rulethickness)) context("flow_connect_%s_%s (%s) (%s,%s,%s) (%s,%s,%s) ;",where_cell,where_other,j,cellx,celly,what_cell,otherx,othery,what_other) context("flow_dsp_x := 0 ; flow_dsp_y := 0 ;") end diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua index 22b92c38a..99a1594af 100644 --- a/tex/context/base/math-noa.lua +++ b/tex/context/base/math-noa.lua @@ -1037,14 +1037,15 @@ function handlers.classes(head,style,penalties) return true end -trackers.register("math.classes",function(v) - if v then - tasks.enableaction("math", "noads.handlers.classes") - else - tasks.disableaction("math", "noads.handlers.classes") - end -end) +trackers.register("math.classes",function(v) tasks.setaction("math","noads.handlers.classes",v) end) + +-- just for me + +function handlers.showtree(head,style,penalties) + inspect(nodes.totree(head)) +end +trackers.register("math.showtree",function(v) tasks.setaction("math","noads.handlers.showtree",v) end) -- the normal builder diff --git a/tex/context/base/node-ini.lua b/tex/context/base/node-ini.lua index ae50215cb..652b46caf 100644 --- a/tex/context/base/node-ini.lua +++ b/tex/context/base/node-ini.lua @@ -92,7 +92,7 @@ local penaltycodes = allocate { -- unfortunately not used table.setmetatableindex(penaltycodes,function(t,k) return "userpenalty" end) -- not used anyway -local noadcodes = allocate { +local noadcodes = allocate { -- simple nodes [ 0] = "ord", [ 1] = "opdisplaylimits", [ 2] = "oplimits", @@ -159,6 +159,20 @@ local disccodes = allocate { [5] = "second", -- hard second item } +local accentcodes = allocate { + [0] = "bothflexible", + [1] = "fixedtop", + [2] = "fixedbottom", + [3] = "fixedboth", +} + +local fencecodes = allocate { + [0] = "unset", + [1] = "left", + [2] = "middle", + [3] = "right", +} + local function simplified(t) local r = { } for k, v in next, t do @@ -182,6 +196,8 @@ mathcodes = allocate(swapped(mathcodes,mathcodes)) fillcodes = allocate(swapped(fillcodes,fillcodes)) margincodes = allocate(swapped(margincodes,margincodes)) disccodes = allocate(swapped(disccodes,disccodes)) +accentcodes = allocate(swapped(accentcodes,accentcodes)) +fencecodes = allocate(swapped(fencecodes,fencecodes)) nodes.skipcodes = skipcodes nodes.gluecodes = skipcodes -- more official nodes.noadcodes = noadcodes @@ -195,6 +211,8 @@ nodes.mathcodes = mathcodes nodes.fillcodes = fillcodes nodes.margincodes = margincodes nodes.disccodes = disccodes nodes.discretionarycodes = disccodes +nodes.accentcodes = accentcodes +nodes.fencecodes = fencecodes listcodes.row = listcodes.alignment listcodes.column = listcodes.alignment @@ -216,6 +234,8 @@ nodes.codes = allocate { -- mostly for listing margin = margincodes, disc = disccodes, whatsit = whatcodes, + accent = accentcodes, + fence = fencecodes, } local report_codes = logs.reporter("nodes","codes") diff --git a/tex/context/base/node-met.lua b/tex/context/base/node-met.lua index f08f2b3dd..d6b3df213 100644 --- a/tex/context/base/node-met.lua +++ b/tex/context/base/node-met.lua @@ -90,6 +90,7 @@ nodes.traverse = node.traverse nodes.traverse_id = node.traverse_id nodes.slide = node.slide nodes.vpack = node.vpack +nodes.fields = node.fields nodes.first_glyph = node.first_glyph nodes.first_character = node.first_character @@ -118,11 +119,10 @@ if not gonuts or not node.getfield then node.setfield = metatable.__newindex end -if not gonuts then - nodes.tonode = function(n) return n end - nodes.todirect = function(n) return n end - nodes.tonut = function(n) return n end -end +-- if gonuts then + nodes.tonode = function(n) return n end + nodes.tonut = function(n) return n end +-- end local getfield = node.getfield local setfield = node.setfield @@ -613,3 +613,57 @@ if not gonuts then end end + +-- also handy + +local tonode = nodes.tonode +local whatsit_code = nodecodes.whatsit +local getfields = node.fields +local sort = table.sort +local whatsitkeys = { } +local keys = { whatsit = whatsitkeys } +local messyhack = table.tohash { -- temporary solution + nodecodes.attributelist, + nodecodes.attribute, + nodecodes.gluespec, + nodecodes.action, +} + +table.setmetatableindex(keys,function(t,k) + local v = getfields(k) + if messyhack[k] then + for i=1,#v do + if v[i] == "subtype" then + remove(v,i) + break + end + end + end + if v[ 0] then v[#v+1] = "next" v[ 0] = nil end + if v[-1] then v[#v+1] = "prev" v[-1] = nil end + sort(v) + t[k] = v + return v +end) + +table.setmetatableindex(whatsitkeys,function(t,k) + local v = getfields(whatsit_code,k) + if v[ 0] then v[#v+1] = "next" v[ 0] = nil end + if v[-1] then v[#v+1] = "prev" v[-1] = nil end + sort(v) + t[k] = v + return v +end) + +local function nodefields(n) + n = tonode(n) + local id = n.id + if id == whatsit_code then + return whatsitkeys[n.subtype] + else + return keys[id] + end +end + +nodes.keys = keys -- [id][subtype] +nodes.fields = nodefields -- (n) diff --git a/tex/context/base/node-ser.lua b/tex/context/base/node-ser.lua index ab59616bc..e69b4fc28 100644 --- a/tex/context/base/node-ser.lua +++ b/tex/context/base/node-ser.lua @@ -23,12 +23,15 @@ local is_node = nodes.is_node local nodecodes = nodes.nodecodes local noadcodes = nodes.noadcodes -local nodefields = nodes.fields +local getfields = nodes.fields + +local tonode = nodes.tonode local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist local expand = allocate ( tohash { + -- text: "list", -- list_ptr & ins_ptr & adjust_ptr "pre", -- "post", -- @@ -44,6 +47,23 @@ local expand = allocate ( tohash { "action", -- action_ptr "value", -- user_defined nodes with subtype 'a' en 'n' "head", + -- math: + "nucleus", + "sup", + "sub", + "list", + "num", + "denom", + "left", + "right", + "display", + "text", + "script", + "scriptscript", + "delim", + "degree", + "accent", + "bot_accent", } ) -- page_insert: "height", "last_ins_ptr", "best_ins_ptr" @@ -74,8 +94,9 @@ nodes.ignorablefields = ignore -- not ok yet: -local function astable(n,sparse) -- not yet ok - local f, t = nodefields(n), { } +local function astable(n,sparse) -- not yet ok, might get obsolete anyway + n = tonode(n) + local f, t = getfields(n), { } for i=1,#f do local v = f[i] local d = n[v] @@ -103,10 +124,9 @@ setinspector(function(v) if is_node(v) then printtable(astable(v),tostring(v)) r -- under construction: -local function totable(n,flat,verbose,noattributes) - -- todo: no local function +local function totable(n,flat,verbose,noattributes) -- nicest: n,true,true,true local function to_table(n,flat,verbose,noattributes) -- no need to pass - local f = nodefields(n) + local f = getfields(n) local tt = { } for k=1,#f do local v = f[k] @@ -120,7 +140,7 @@ local function totable(n,flat,verbose,noattributes) if type(nv) == "number" or type(nv) == "string" then tt[v] = nv else - tt[v] = totable(nv,flat,verbose) + tt[v] = totable(nv,flat,verbose,noattributes) end elseif type(nv) == "table" then tt[v] = nv -- totable(nv,flat,verbose) -- data @@ -130,7 +150,18 @@ local function totable(n,flat,verbose,noattributes) end end if verbose then - tt.type = nodecodes[tt.id] + local subtype = tt.subtype + local id = tt.id + local nodename = nodecodes[id] + tt.id = nodename + local subtypes = nodes.codes[nodename] + if subtypes then + tt.subtype = subtypes[subtype] + elseif subtype == 0 then + tt.subtype = nil + else + -- we need a table + end end return tt end @@ -139,14 +170,18 @@ local function totable(n,flat,verbose,noattributes) local t, tn = { }, 0 while n do tn = tn + 1 - t[tn] = to_table(n,flat,verbose,noattributes) + local nt = to_table(n,flat,verbose,noattributes) + t[tn] = nt + nt.next = nil + nt.prev = nil n = n.next end return t else - local t = to_table(n) - if n.next then - t.next = totable(n.next,flat,verbose,noattributes) + local t = to_table(n,flat,verbose,noattributes) + local n = n.next + if n then + t.next = totable(n,flat,verbose,noattributes) end return t end @@ -155,7 +190,8 @@ local function totable(n,flat,verbose,noattributes) end end -nodes.totable = totable +nodes.totable = function(n,...) return totable(tonode(n),...) end +nodes.totree = function(n) return totable(tonode(n),true,true,true) end -- no attributes, todo: attributes in k,v list local function key(k) return ((type(k) == "number") and "["..k.."]") or k @@ -188,7 +224,7 @@ local function serialize(root,name,handle,depth,m,noattributes) if root then local fld if root.id then - fld = nodefields(root) -- we can cache these (todo) + fld = getfields(root) -- we can cache these (todo) else fld = sortedkeys(root) end @@ -243,7 +279,7 @@ function nodes.serialize(root,name,noattributes) n = n + 1 t[n] = s end - serialize(root,name,flush,nil,0,noattributes) + serialize(tonode(root),name,flush,nil,0,noattributes) return concat(t,"\n") end @@ -260,6 +296,7 @@ function nodes.visualizebox(...) -- to be checked .. will move to module anyway end function nodes.list(head,n) -- name might change to nodes.type -- to be checked .. will move to module anyway + head = tonode(head) if not n then context.starttyping(true) end @@ -277,6 +314,7 @@ function nodes.list(head,n) -- name might change to nodes.type -- to be checked end function nodes.print(head,n) + head = tonode(head) while head do local id = head.id logs.writer(string.formatters["%w%S"],n or 0,head) diff --git a/tex/context/base/node-tsk.lua b/tex/context/base/node-tsk.lua index 43c477f48..dfa570b24 100644 --- a/tex/context/base/node-tsk.lua +++ b/tex/context/base/node-tsk.lua @@ -117,6 +117,14 @@ function tasks.disableaction(name,action) end end +function tasks.setaction(name,action,value) + if value then + tasks.enableaction(name,action) + else + tasks.disableaction(name,action) + end +end + function tasks.enablegroup(name,group) local data = validgroup(name,"enable group") if data then diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 52f60f3c3..bc6dfe1a9 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.log b/tex/context/base/status-lua.log index 12431a4bd..f0ed24bc8 100644 --- a/tex/context/base/status-lua.log +++ b/tex/context/base/status-lua.log @@ -1,6 +1,6 @@ (cont-yes.mkiv -ConTeXt ver: 2013.08.14 15:25 MKIV beta fmt: 2013.8.14 int: english/english +ConTeXt ver: 2013.08.15 13:53 MKIV beta fmt: 2013.8.15 int: english/english system > 'cont-new.mkiv' loaded (cont-new.mkiv) diff --git a/tex/context/base/task-ini.lua b/tex/context/base/task-ini.lua index 154e7cc6d..6bbc62773 100644 --- a/tex/context/base/task-ini.lua +++ b/tex/context/base/task-ini.lua @@ -71,6 +71,8 @@ appendaction("shipouts", "finishers", "attributes.viewerlayers.handler") --maybe integrate relocate and families +appendaction("math", "normalizers", "noads.handlers.showtree", nil, "nohead") + appendaction("math", "normalizers", "noads.handlers.unscript", nil, "nohead") -- always on (maybe disabled) appendaction("math", "normalizers", "noads.handlers.variants", nil, "nohead") -- always on appendaction("math", "normalizers", "noads.handlers.relocate", nil, "nohead") -- always on @@ -157,6 +159,7 @@ disableaction("finalizers", "builders.paragraphs.solutions.splitters.optimize") disableaction("finalizers", "nodes.handlers.graphicvadjust") -- sort of obsolete disableaction("finalizers", "builders.paragraphs.tag") +disableaction("math", "noads.handlers.showtree") disableaction("math", "noads.handlers.tags") disableaction("math", "noads.handlers.italics") disableaction("math", "noads.handlers.classes") diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 94706d3e9..fbe7fc16f 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 : 08/14/13 15:25:17 +-- merge date : 08/15/13 13:53:53 do -- begin closure to overcome local limits and interference |