summaryrefslogtreecommitdiff
path: root/tex/context/base
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2015-07-28 20:15:04 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2015-07-28 20:15:04 +0200
commit452e3a415eafee214e2e9a939c9c67fbd0f9dce2 (patch)
tree125df8c5081b41570a7c5911d897bac4302f817c /tex/context/base
parentdfd47fa7ce84dc43318a08b075d51c9d990790e1 (diff)
downloadcontext-452e3a415eafee214e2e9a939c9c67fbd0f9dce2.tar.gz
2015-07-28 19:15:00
Diffstat (limited to 'tex/context/base')
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4207 -> 4210 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/math-fen.mkiv10
-rw-r--r--tex/context/base/math-noa.lua142
-rw-r--r--tex/context/base/status-files.pdfbin24393 -> 24403 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin255458 -> 255423 bytes
-rw-r--r--tex/context/base/task-ini.lua3
-rw-r--r--tex/context/base/x-set-11.mkiv10
9 files changed, 110 insertions, 59 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 6dc526737..dc278f6cd 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.07.28 15:15}
+\newcontextversion{2015.07.28 19:12}
%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
index 3cf18d5b9..95d044ee5 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 072164505..1f811fe07 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.07.28 15:15}
+\edef\contextversion{2015.07.28 19:12}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/math-fen.mkiv b/tex/context/base/math-fen.mkiv
index 6c29a8c18..d754bd672 100644
--- a/tex/context/base/math-fen.mkiv
+++ b/tex/context/base/math-fen.mkiv
@@ -538,8 +538,14 @@
\newconditional\c_math_fences_auto
-\unexpanded\def\enableautofences {\settrue \c_math_fences_auto}
-\unexpanded\def\disableautofences{\setfalse\c_math_fences_auto}
+\unexpanded\def\enableautofences
+ {\clf_enableautofences
+ \glet\clf_enableautofences\relax % onlyonce anyway
+ \unexpanded\gdef\enableautofences{\settrue\c_math_fences_auto}%
+ \enableautofences}
+
+\unexpanded\def\disableautofences
+ {\setfalse\c_math_fences_auto}
\unexpanded\def\math_fences_used_left
{\ifconditional\c_math_fences_auto
diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua
index 3b11fff77..b11105cd0 100644
--- a/tex/context/base/math-noa.lua
+++ b/tex/context/base/math-noa.lua
@@ -266,35 +266,71 @@ local function processnested(current,what,n)
local noad = nil
local id = getid(current)
if id == math_noad then
- noad = getfield(current,"nucleus") if noad then return process(noad,what,n,current) end -- list
- noad = getfield(current,"sup") if noad then return process(noad,what,n,current) end -- list
- noad = getfield(current,"sub") if noad then return process(noad,what,n,current) end -- list
+ noad = getfield(current,"nucleus") if noad then process(noad,what,n,current) end -- list
+ noad = getfield(current,"sup") if noad then process(noad,what,n,current) end -- list
+ noad = getfield(current,"sub") if noad then process(noad,what,n,current) end -- list
elseif id == math_box or id == math_sub then
- noad = getfield(current,"list") if noad then return process(noad,what,n,current) end -- list (not getlist !)
+ noad = getfield(current,"list") if noad then process(noad,what,n,current) end -- list (not getlist !)
elseif id == math_fraction then
- noad = getfield(current,"num") if noad then return process(noad,what,n,current) end -- list
- noad = getfield(current,"denom") if noad then return process(noad,what,n,current) end -- list
- noad = getfield(current,"left") if noad then return process(noad,what,n,current) end -- delimiter
- noad = getfield(current,"right") if noad then return process(noad,what,n,current) end -- delimiter
+ noad = getfield(current,"num") if noad then process(noad,what,n,current) end -- list
+ noad = getfield(current,"denom") if noad then process(noad,what,n,current) end -- list
+ noad = getfield(current,"left") if noad then process(noad,what,n,current) end -- delimiter
+ noad = getfield(current,"right") if noad then process(noad,what,n,current) end -- delimiter
elseif id == math_choice then
- noad = getfield(current,"display") if noad then return process(noad,what,n,current) end -- list
- noad = getfield(current,"text") if noad then return process(noad,what,n,current) end -- list
- noad = getfield(current,"script") if noad then return process(noad,what,n,current) end -- list
- noad = getfield(current,"scriptscript") if noad then return process(noad,what,n,current) end -- list
+ noad = getfield(current,"display") if noad then process(noad,what,n,current) end -- list
+ noad = getfield(current,"text") if noad then process(noad,what,n,current) end -- list
+ noad = getfield(current,"script") if noad then process(noad,what,n,current) end -- list
+ noad = getfield(current,"scriptscript") if noad then process(noad,what,n,current) end -- list
elseif id == math_fence then
- noad = getfield(current,"delim") if noad then return process(noad,what,n,current) end -- delimiter
+ noad = getfield(current,"delim") if noad then process(noad,what,n,current) end -- delimiter
elseif id == math_radical then
- noad = getfield(current,"nucleus") if noad then return process(noad,what,n,current) end -- list
- noad = getfield(current,"sup") if noad then return process(noad,what,n,current) end -- list
- noad = getfield(current,"sub") if noad then return process(noad,what,n,current) end -- list
- noad = getfield(current,"left") if noad then return process(noad,what,n,current) end -- delimiter
- noad = getfield(current,"degree") if noad then return process(noad,what,n,current) end -- list
+ noad = getfield(current,"nucleus") if noad then process(noad,what,n,current) end -- list
+ noad = getfield(current,"sup") if noad then process(noad,what,n,current) end -- list
+ noad = getfield(current,"sub") if noad then process(noad,what,n,current) end -- list
+ noad = getfield(current,"left") if noad then process(noad,what,n,current) end -- delimiter
+ noad = getfield(current,"degree") if noad then process(noad,what,n,current) end -- list
elseif id == math_accent then
- noad = getfield(current,"nucleus") if noad then return process(noad,what,n,current) end -- list
- noad = getfield(current,"sup") if noad then return process(noad,what,n,current) end -- list
- noad = getfield(current,"sub") if noad then return process(noad,what,n,current) end -- list
- noad = getfield(current,"accent") if noad then return process(noad,what,n,current) end -- list
- noad = getfield(current,"bot_accent") if noad then return process(noad,what,n,current) end -- list
+ noad = getfield(current,"nucleus") if noad then process(noad,what,n,current) end -- list
+ noad = getfield(current,"sup") if noad then process(noad,what,n,current) end -- list
+ noad = getfield(current,"sub") if noad then process(noad,what,n,current) end -- list
+ noad = getfield(current,"accent") if noad then process(noad,what,n,current) end -- list
+ noad = getfield(current,"bot_accent") if noad then process(noad,what,n,current) end -- list
+ end
+end
+
+local function processstep(current,process,n,id)
+ local noad = nil
+ local id = id or getid(current)
+ if id == math_noad then
+ noad = getfield(current,"nucleus") if noad then process(noad,n,current) end -- list
+ noad = getfield(current,"sup") if noad then process(noad,n,current) end -- list
+ noad = getfield(current,"sub") if noad then process(noad,n,current) end -- list
+ elseif id == math_box or id == math_sub then
+ noad = getfield(current,"list") if noad then process(noad,n,current) end -- list (not getlist !)
+ elseif id == math_fraction then
+ noad = getfield(current,"num") if noad then process(noad,n,current) end -- list
+ noad = getfield(current,"denom") if noad then process(noad,n,current) end -- list
+ noad = getfield(current,"left") if noad then process(noad,n,current) end -- delimiter
+ noad = getfield(current,"right") if noad then process(noad,n,current) end -- delimiter
+ elseif id == math_choice then
+ noad = getfield(current,"display") if noad then process(noad,n,current) end -- list
+ noad = getfield(current,"text") if noad then process(noad,n,current) end -- list
+ noad = getfield(current,"script") if noad then process(noad,n,current) end -- list
+ noad = getfield(current,"scriptscript") if noad then process(noad,n,current) end -- list
+ elseif id == math_fence then
+ noad = getfield(current,"delim") if noad then process(noad,n,current) end -- delimiter
+ elseif id == math_radical then
+ noad = getfield(current,"nucleus") if noad then process(noad,n,current) end -- list
+ noad = getfield(current,"sup") if noad then process(noad,n,current) end -- list
+ noad = getfield(current,"sub") if noad then process(noad,n,current) end -- list
+ noad = getfield(current,"left") if noad then process(noad,n,current) end -- delimiter
+ noad = getfield(current,"degree") if noad then process(noad,n,current) end -- list
+ elseif id == math_accent then
+ noad = getfield(current,"nucleus") if noad then process(noad,n,current) end -- list
+ noad = getfield(current,"sup") if noad then process(noad,n,current) end -- list
+ noad = getfield(current,"sub") if noad then process(noad,n,current) end -- list
+ noad = getfield(current,"accent") if noad then process(noad,n,current) end -- list
+ noad = getfield(current,"bot_accent") if noad then process(noad,n,current) end -- list
end
end
@@ -705,20 +741,24 @@ local function makelist(noad,f_o,o_next,c_prev,f_c,middle)
end
local function convert_both(open,close,middle)
- local f_o = makefence(left_fence_code,open)
- local f_c = makefence(right_fence_code,close)
local o_next = getnext(open)
-- local o_prev = getprev(open)
local c_next = getnext(close)
local c_prev = getprev(close)
- makelist(open,f_o,o_next,c_prev,f_c,middle)
- setfield(close,"nucleus",nil)
- free_node(close)
- if c_next then
- setfield(c_next,"prev",open)
+ if o_next == close then
+ return close
+ else
+ local f_o = makefence(left_fence_code,open)
+ local f_c = makefence(right_fence_code,close)
+ makelist(open,f_o,o_next,c_prev,f_c,middle)
+ setfield(close,"nucleus",nil)
+ free_node(close)
+ if c_next then
+ setfield(c_next,"prev",open)
+ end
+ setfield(open,"next",c_next)
+ return open
end
- setfield(open,"next",c_next)
- return open
end
local function convert_open(open,last,middle)
@@ -746,14 +786,12 @@ end
local stacks = table.setmetatableindex("table")
-autofences[math_noad] = function(pointer,what,n,parent)
- -- can we do a fast check?
+local function processfences(pointer,n,parent)
local current = pointer
local last = pointer
local start = pointer
local done = false
local initial = pointer
- local noad = nil
local stack = nil
local middle = nil -- todo: use properties
while current do
@@ -798,14 +836,11 @@ autofences[math_noad] = function(pointer,what,n,parent)
end
done = true
else
- -- make a helper for this
- noad = getfield(current,"nucleus") if noad then process(noad,what,n,current) end -- list
- noad = getfield(current,"sup") if noad then process(noad,what,n,current) end -- list
- noad = getfield(current,"sub") if noad then process(noad,what,n,current) end -- list
+ processstep(current,processfences,n+1,id)
end
else
-- next at current level
- process(current,autofences,n-1)
+ processstep(current,processfences,n,id)
end
last = current
current = getnext(current)
@@ -825,24 +860,29 @@ autofences[math_noad] = function(pointer,what,n,parent)
last = convert_open(open,last,middle)
end
end
- if not parent then
- return true, current, initial
- end
end
end
-- we can have a first changed node .. an option is to have a leading dummy node in math
-- lists like the par node as it can save a lot of mess
+local enabled = false
+
+implement {
+ name = "enableautofences",
+ onlyonce = true,
+ actions = function()
+ tasks.enableaction("math","noads.handlers.autofences")
+ enabled = true
+ end
+}
+
function handlers.autofences(head,style,penalties)
- -- if tex.modes.c_math_fences_auto then
--- inspect(nodes.totree(head))
- local h, d = processnoads(head,autofences,"autofence")
--- inspect(nodes.totree(h))
- return h or head, d
- -- else
- -- return head, false
- -- end
+ if enabled then -- tex.modes.c_math_fences_auto
+ -- inspect(nodes.totree(head))
+ processfences(tonut(head),1)
+ -- inspect(nodes.totree(head))
+ end
end
-- normalize scripts
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index fa2ce1a80..efbebe057 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index a79641b6d..75260f543 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/task-ini.lua b/tex/context/base/task-ini.lua
index d941fa178..fde2f39ad 100644
--- a/tex/context/base/task-ini.lua
+++ b/tex/context/base/task-ini.lua
@@ -98,7 +98,7 @@ appendaction("math", "normalizers", "noads.handlers.families", nil, "no
appendaction("math", "normalizers", "noads.handlers.render", nil, "nohead") -- always on
appendaction("math", "normalizers", "noads.handlers.collapse", nil, "nohead") -- * first -- always on
appendaction("math", "normalizers", "noads.handlers.domains", nil, "nohead") -- * last -- disabled
-appendaction("math", "normalizers", "noads.handlers.autofences") -- head ! -- always on
+appendaction("math", "normalizers", "noads.handlers.autofences",nil, "nohead") -- disabled
appendaction("math", "normalizers", "noads.handlers.resize", nil, "nohead") -- always on
------------("math", "normalizers", "noads.handlers.respace", nil, "nohead") -- always on
appendaction("math", "normalizers", "noads.handlers.alternates",nil, "nohead") -- always on
@@ -195,6 +195,7 @@ disableaction("math", "noads.handlers.tags")
disableaction("math", "noads.handlers.italics")
disableaction("math", "noads.handlers.domains")
disableaction("math", "noads.handlers.classes")
+disableaction("math", "noads.handlers.autofences")
disableaction("math", "typesetters.directions.processmath")
disableaction("mvlbuilders", "typesetters.checkers.handler")
diff --git a/tex/context/base/x-set-11.mkiv b/tex/context/base/x-set-11.mkiv
index 5031eff2d..c82b9735d 100644
--- a/tex/context/base/x-set-11.mkiv
+++ b/tex/context/base/x-set-11.mkiv
@@ -783,9 +783,13 @@
% A prelude to a rewrite and some more:
-\definetype[parametercommand][\v!type]
-\definetype[parameterkey] [\v!type]
-\definetype[parametervalue] [\v!type][\c!space=\v!on]
+% \definetype[parametercommand][\v!type]
+% \definetype[parameterkey] [\v!type]
+% \definetype[parametervalue] [\v!type][\c!space=\v!on]
+
+\definetype[parametercommand]
+\definetype[parameterkey]
+\definetype[parametervalue] [\c!space=\v!on]
\setuptype [parametercommand] [\c!color=darkmagenta]
\setuptype [parametervalue] [\c!color=darkyellow]