summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv')
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkxl4
-rw-r--r--tex/context/base/mkiv/core-def.mkiv7
-rw-r--r--tex/context/base/mkiv/lang-ini.mkiv10
-rw-r--r--tex/context/base/mkiv/lang-ini.mkxl10
-rw-r--r--tex/context/base/mkiv/mult-def.lua8
-rw-r--r--tex/context/base/mkiv/node-mig.lmt134
-rw-r--r--tex/context/base/mkiv/node-mig.lua227
-rw-r--r--tex/context/base/mkiv/node-mig.mkiv23
-rw-r--r--tex/context/base/mkiv/node-mig.mkxl44
-rw-r--r--tex/context/base/mkiv/node-nut.lua1
-rw-r--r--tex/context/base/mkiv/page-ins.lua8
-rw-r--r--tex/context/base/mkiv/page-ins.mkiv43
-rw-r--r--tex/context/base/mkiv/spac-par.lmt15
-rw-r--r--tex/context/base/mkiv/spac-par.mkiv3
-rw-r--r--tex/context/base/mkiv/spac-par.mkxl82
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin27839 -> 27857 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin254844 -> 254909 bytes
-rw-r--r--tex/context/base/mkiv/strc-not.mkvi12
-rw-r--r--tex/context/base/mkiv/task-ini.lua6
-rw-r--r--tex/context/base/mkiv/typo-del.mkiv4
-rw-r--r--tex/context/base/mkiv/typo-drp.mkiv8
23 files changed, 455 insertions, 198 deletions
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 0df4eaf93..9408f9e1a 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2020.07.24 15:15}
+\newcontextversion{2020.07.27 16:21}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index 128b75ec1..95d207612 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -45,7 +45,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2020.07.24 15:15}
+\edef\contextversion{2020.07.27 16:21}
%D Kind of special:
diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl
index ab4499856..b684d2ad6 100644
--- a/tex/context/base/mkiv/context.mkxl
+++ b/tex/context/base/mkiv/context.mkxl
@@ -29,7 +29,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2020.07.24 15:15}
+\edef\contextversion{2020.07.27 16:21}
%D Kind of special:
@@ -158,7 +158,7 @@
\loadmarkfile{cldf-bas} % basics / depends on nodes
\loadmkivfile{node-fin}
-\loadmarkfile{node-mig}
+\loadmkxlfile{node-mig}
%loadmarkfile{node-pag}
\loadmkxlfile{driv-ini} % LMTX
diff --git a/tex/context/base/mkiv/core-def.mkiv b/tex/context/base/mkiv/core-def.mkiv
index d10527d7b..bb209a8ff 100644
--- a/tex/context/base/mkiv/core-def.mkiv
+++ b/tex/context/base/mkiv/core-def.mkiv
@@ -49,6 +49,13 @@
\typo_firstline_handle
\to \everypar
+\ifcase\contextlmtxmode \else
+ \appendtoks
+ \spac_paragraph_wrap
+ \spac_paragraph_freeze
+ \to \everypar
+\fi
+
\appendtoks
\flushnotes
\to \everydisplay
diff --git a/tex/context/base/mkiv/lang-ini.mkiv b/tex/context/base/mkiv/lang-ini.mkiv
index f9d7e0f51..946fe6845 100644
--- a/tex/context/base/mkiv/lang-ini.mkiv
+++ b/tex/context/base/mkiv/lang-ini.mkiv
@@ -311,7 +311,7 @@
\c!time={h,:,m},
\c!date={\v!year,\ ,\v!month,\ ,\v!day},
\c!text=Ag,
- \s!font=] % \v!auto : experimental !
+ \c!font=] % \v!auto : experimental !
% to be tested:
%
@@ -486,12 +486,12 @@
\unexpanded\def\setuplanguages
{\setuplanguage[\s!default]}
-% \setuplanguages[\s!font=\v!auto]
-% \setuplanguage[\s!default][\s!font=\v!auto]
-% \setuplanguage[nl][\s!font=\v!auto]
+% \setuplanguages[\c!font=\v!auto]
+% \setuplanguage[\s!default][\c!font=\v!auto]
+% \setuplanguage[nl][\c!font=\v!auto]
\appendtoks
- \edef\p_language_font{\languageparameter\s!font}%
+ \edef\p_language_font{\languageparameter\c!font}%
\ifx\p_language_font\empty\else
\ifx\p_language_font\v!auto
\doaddfeature\currentlanguage
diff --git a/tex/context/base/mkiv/lang-ini.mkxl b/tex/context/base/mkiv/lang-ini.mkxl
index f86628069..490d35997 100644
--- a/tex/context/base/mkiv/lang-ini.mkxl
+++ b/tex/context/base/mkiv/lang-ini.mkxl
@@ -311,7 +311,7 @@
\c!time={h,:,m},
\c!date={\v!year,\ ,\v!month,\ ,\v!day},
\c!text=Ag,
- \s!font=] % \v!auto : experimental !
+ \c!font=] % \v!auto : experimental !
% to be tested:
%
@@ -486,12 +486,12 @@
\unexpanded\def\setuplanguages
{\setuplanguage[\s!default]}
-% \setuplanguages[\s!font=\v!auto]
-% \setuplanguage[\s!default][\s!font=\v!auto]
-% \setuplanguage[nl][\s!font=\v!auto]
+% \setuplanguages[\c!font=\v!auto]
+% \setuplanguage[\s!default][\c!font=\v!auto]
+% \setuplanguage[nl][\c!font=\v!auto]
\appendtoks
- \edef\p_language_font{\languageparameter\s!font}%
+ \edef\p_language_font{\languageparameter\c!font}%
\ifempty\p_language_font
\orelse\ifx\p_language_font\v!auto
\doaddfeature\currentlanguage
diff --git a/tex/context/base/mkiv/mult-def.lua b/tex/context/base/mkiv/mult-def.lua
index 678f17552..3e1f7bb8c 100644
--- a/tex/context/base/mkiv/mult-def.lua
+++ b/tex/context/base/mkiv/mult-def.lua
@@ -8821,6 +8821,10 @@ return {
["pe"]="تمرکزبیرون",
["ro"]="focusout",
},
+ ["font"]={
+ ["en"]="font",
+ ["nl"]="font",
+ },
["footer"]={
["cs"]="upati",
["de"]="fusszeile",
@@ -15577,6 +15581,10 @@ return {
["fr"]="pagesuccesseur",
["nl"]="opvolgendepagina",
},
+ ["font"]={
+ ["en"]="font",
+ ["nl"]="font",
+ },
["footer"]={
["cs"]="upati",
["de"]="fusszeile",
diff --git a/tex/context/base/mkiv/node-mig.lmt b/tex/context/base/mkiv/node-mig.lmt
new file mode 100644
index 000000000..c19913509
--- /dev/null
+++ b/tex/context/base/mkiv/node-mig.lmt
@@ -0,0 +1,134 @@
+if not modules then modules = { } end modules ['node-mig'] = {
+ version = 1.001,
+ comment = "companion to node-mig.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- todo: insert_after
+
+local format = string.format
+
+local trace_migrations = false trackers.register("nodes.migrations", function(v) trace_migrations = v end)
+
+local report_nodes = logs.reporter("nodes","migrations")
+
+local attributes = attributes
+local nodes = nodes
+
+local nuts = nodes.nuts
+local tonut = nuts.tonut
+
+local getnext = nuts.getnext
+local getid = nuts.getid
+local getlist = nuts.getlist
+local getpost = nuts.getpost
+local getprop = nuts.getprop
+
+local setprop = nuts.setprop
+local setlink = nuts.setlink
+local setlist = nuts.setlist
+local setpost = nuts.setpost
+
+local count = nuts.count
+local migrate = nuts.migrate
+
+local nodecodes = nodes.nodecodes
+local hlist_code = nodecodes.hlist
+local vlist_code = nodecodes.vlist
+local insert_code = nodecodes.ins
+local mark_code = nodecodes.mark
+
+local a_migrated = attributes.private("migrated")
+
+local migrate_inserts = false
+local migrate_marks = false
+local t_inserts = 0
+local t_marks = 0
+local t_sweeps = 0
+
+local trialtypesetting = context.trialtypesetting
+
+function nodes.handlers.migrate(head,where)
+ if head and not trialtypesetting() and where == "alignment" then
+ if trace_migrations then
+ report_nodes("migration sweep %a",where)
+ end
+ local current = head
+ while current do
+ local id = getid(current)
+ if (id == vlist_code or id == hlist_code or id == insert_code) and not getprop(current,"migrated") then
+ setprop(current,"migrated",true)
+ local list = getlist(current)
+ if list then
+ t_sweeps = t_sweeps + 1
+ local h, first, last = migrate(list,migrate_inserts,migrate_marks)
+ if first then
+ if trace_migrations then
+ local ni = count(insert_code,first)
+ local nm = count(mark_code,first)
+ t_inserts = t_inserts + ni
+ t_marks = t_marks + nm
+ report_nodes("sweep %a, container %a, %s inserts and %s marks migrated outwards during %a",
+ t_sweeps,nodecodes[id],ni,nm,where)
+
+ end
+ local p, t = getpost(current)
+ if p then
+ setlink(t,first)
+ else
+ setpost(current,first)
+ end
+ end
+ end
+ end
+ current = getnext(current)
+ end
+ end
+ return head
+end
+
+statistics.register("node migrations", function()
+ if trace_migrations and t_sweeps > 0 then
+ return format("%s sweeps, %s inserts moved, %s marks moved",t_sweeps,t_inserts,t_marks)
+ end
+end)
+
+-- Since we started with mkiv we had it as experiment but it is about time
+-- to have a more formal interface .. it's still optional due to possible
+-- side effects.
+
+local enableaction = nodes.tasks.enableaction
+local disableaction = nodes.tasks.disableaction
+local texsetcount = tex.setcount
+
+local migrations = { }
+nodes.migrations = migrations
+local enabled = false
+
+local function check()
+ if migrate_marks or migrate_inserts then
+ if not enabled then
+ enableaction("mvlbuilders", "nodes.handlers.migrate")
+ enabled = true
+ texsetcount("automigrationmode",3)
+ end
+ else
+ if enabled then
+ disableaction("mvlbuilders", "nodes.handlers.migrate")
+ enabled = false
+ texsetcount("automigrationmode",0)
+ end
+ end
+end
+
+function migrations.setmarks(v)
+ migrate_marks = v
+ check()
+end
+
+function migrations.setinserts(v)
+ migrate_inserts = v
+ check()
+end
diff --git a/tex/context/base/mkiv/node-mig.lua b/tex/context/base/mkiv/node-mig.lua
index 6c10625eb..13414c560 100644
--- a/tex/context/base/mkiv/node-mig.lua
+++ b/tex/context/base/mkiv/node-mig.lua
@@ -14,157 +14,174 @@ local trace_migrations = false trackers.register("nodes.migrations", function(v)
local report_nodes = logs.reporter("nodes","migrations")
-local attributes = attributes
-local nodes = nodes
-local enableaction = nodes.tasks.enableaction
+local attributes = attributes
+local nodes = nodes
-local nuts = nodes.nuts
-local tonut = nuts.tonut
+local nuts = nodes.nuts
+local tonut = nuts.tonut
-local getnext = nuts.getnext
-local getid = nuts.getid
-local getlist = nuts.getlist
------ getattr = nuts.getattr
-local getprop = nuts.getprop
+local getnext = nuts.getnext
+local getid = nuts.getid
+local getlist = nuts.getlist
+local getprop = nuts.getprop
------ setattr = nuts.setattr
-local setprop = nuts.setprop
-local setlink = nuts.setlink
-local setlist = nuts.setlist
-local setprev = nuts.setprev
-local setnext = nuts.setnext
-local setboth = nuts.setboth
+local setprop = nuts.setprop
+local setlink = nuts.setlink
+local setlist = nuts.setlist
+local setprev = nuts.setprev
+local setnext = nuts.setnext
+local setboth = nuts.setboth
-local remove_node = nuts.remove
+local remove_node = nuts.remove
+local count = nuts.count
-local nodecodes = nodes.nodecodes
-local hlist_code = nodecodes.hlist
-local vlist_code = nodecodes.vlist
-local insert_code = nodecodes.ins
-local mark_code = nodecodes.mark
+local nodecodes = nodes.nodecodes
+local hlist_code = nodecodes.hlist
+local vlist_code = nodecodes.vlist
+local insert_code = nodecodes.ins
+local mark_code = nodecodes.mark
-local a_migrated = attributes.private("migrated")
+local a_migrated = attributes.private("migrated")
+local trialtypesetting = context.trialtypesetting
-local migrate_inserts, migrate_marks, inserts_too
+local migrate_inserts = false
+local migrate_marks = false
-local t_inserts, t_marks, t_sweeps = 0, 0, 0
+local t_inserts = 0
+local t_marks = 0
+local t_sweeps = 0
-local function locate(head,first,last,ni,nm)
+local function locate(head,first,last)
local current = head
while current do
local id = getid(current)
if id == vlist_code or id == hlist_code then
local list = getlist(current)
if list then
- list, first, last, ni, nm = locate(list,first,last,ni,nm)
- setlist(current,list)
+ local l
+ l, first, last = locate(list,first,last)
+ if l ~= list then
+ setlist(current,l)
+ end
end
current = getnext(current)
- elseif migrate_inserts and id == insert_code then
- local insert
- head, current, insert = remove_node(head,current)
- if first then
- setnext(insert)
- setlink(last,insert)
- else
- setboth(insert)
- first = insert
+ elseif id == insert_code then
+ if migrate_inserts then
+ local insert
+ head, current, insert = remove_node(head,current)
+ if first then
+ setnext(insert)
+ setlink(last,insert)
+ else
+ setboth(insert)
+ first = insert
+ end
+ last = insert
end
- last = insert
- ni = ni + 1
- elseif migrate_marks and id == mark_code then
- local mark
- head, current, mark = remove_node(head,current)
- if first then
- setnext(mark)
- setlink(last,mark)
- else
- setboth(mark)
- first = mark
+ elseif id == mark_code then
+ if migrate_marks then
+ local mark
+ head, current, mark = remove_node(head,current)
+ if first then
+ setnext(mark)
+ setlink(last,mark)
+ else
+ setboth(mark)
+ first = mark
+ end
+ last = mark
end
- last = mark
- nm = nm + 1
else
current = getnext(current)
end
end
- return head, first, last, ni, nm
+ return head, first, last
end
function nodes.handlers.migrate(head,where)
- if head then
+ if head and not trialtypesetting() then
if trace_migrations then
report_nodes("migration sweep %a",where)
end
local current = head
while current do
local id = getid(current)
- -- inserts_too is a temp hack, we should only do them when it concerns
- -- newly placed (flushed) inserts
-
- -- todo: getprop / setprop
-
- -- if id == vlist_code or id == hlist_code or (inserts_too and id == insert_code) and not getattr(current,a_migrated) then
- if id == vlist_code or id == hlist_code or (inserts_too and id == insert_code) and not getprop(current,"migrated") then
- -- setattr(current,a_migrated,1)
+ if (id == vlist_code or id == hlist_code or id == insert_code) and not getprop(current,"migrated") then
setprop(current,"migrated",true)
- t_sweeps = t_sweeps + 1
local h = getlist(current)
- local first, last, ni, nm
- while h do
- local id = getid(h)
- if id == vlist_code or id == hlist_code then
- h, first, last, ni, nm = locate(h,first,last,0,0)
+ if h then
+ t_sweeps = t_sweeps + 1
+ local first, last
+ while h do
+ local id = getid(h)
+ if id == vlist_code or id == hlist_code then
+ h, first, last = locate(h,first,last)
+ end
+ h = getnext(h)
end
- h = getnext(h)
- end
- if first then
- t_inserts = t_inserts + ni
- t_marks = t_marks + nm
- if trace_migrations and (ni > 0 or nm > 0) then
- report_nodes("sweep %a, container %a, %s inserts and %s marks migrated outwards during %a",
- t_sweeps,nodecodes[id],ni,nm,where)
- end
- -- inserts after head, use insert_after
- local n = getnext(current)
- if n then
- setlink(last,n)
+ if first then
+ if trace_migrations then
+ local ni = count(insert_code,first)
+ local nm = count(mark_code,first)
+ t_inserts = t_inserts + ni
+ t_marks = t_marks + nm
+ report_nodes("sweep %a, container %a, %s inserts and %s marks migrated outwards during %a",
+ t_sweeps,nodecodes[id],ni,nm,where)
+ end
+ local n = getnext(current)
+ if n then
+ setlink(last,n)
+ end
+ setlink(current,first)
+ current = last
end
- setlink(current,first)
- current = last
end
end
current = getnext(current)
end
- return head
end
+ return head
end
--- for the moment this way, this will disappear
-
-experiments.register("marks.migrate", function(v)
- if v then
- enableaction("mvlbuilders", "nodes.handlers.migrate")
+statistics.register("node migrations", function()
+ if trace_migrations and t_sweeps > 0 then
+ return format("%s sweeps, %s inserts moved, %s marks moved",t_sweeps,t_inserts,t_marks)
end
- migrate_marks = v
end)
-experiments.register("inserts.migrate", function(v)
- if v then
- enableaction("mvlbuilders", "nodes.handlers.migrate")
- end
- migrate_inserts = v
-end)
+-- Since we started with mkiv we had it as experiment but it is about time
+-- to have a more formal interface .. it's still optional due to possible
+-- side effects.
-experiments.register("inserts.migrate.nested", function(v)
- if v then
- enableaction("mvlbuilders", "nodes.handlers.migrate")
+local enableaction = nodes.tasks.enableaction
+local disableaction = nodes.tasks.disableaction
+
+local migrations = { }
+nodes.migrations = migrations
+local enabled = false
+
+local function check()
+ if migrate_marks or migrate_inserts then
+ if not enabled then
+ enableaction("mvlbuilders", "nodes.handlers.migrate")
+ enableaction("processors", "nodes.handlers.migrate")
+ enabled = true
+ end
+ else
+ if enabled then
+ disableaction("mvlbuilders", "nodes.handlers.migrate")
+ disableaction("processors", "nodes.handlers.migrate")
+ enabled = false
+ end
end
- inserts_too = v
-end)
+end
-statistics.register("node migrations", function()
- if trace_migrations and t_sweeps > 0 then
- return format("%s sweeps, %s inserts moved, %s marks moved",t_sweeps,t_inserts,t_marks)
- end
-end)
+function migrations.setmarks(v)
+ migrate_marks = v
+ check()
+end
+
+function migrations.setinserts(v)
+ migrate_inserts = v
+ check()
+end
diff --git a/tex/context/base/mkiv/node-mig.mkiv b/tex/context/base/mkiv/node-mig.mkiv
index 010d009b3..0e76e4794 100644
--- a/tex/context/base/mkiv/node-mig.mkiv
+++ b/tex/context/base/mkiv/node-mig.mkiv
@@ -13,9 +13,9 @@
\writestatus{loading}{ConTeXt Node Support / Migrations}
-%D This is very experimental and although it is used in a
-%D real project it mostly serves a testbed for Taco and me so
-%D as prelude to extending the inserts mechanism.
+%D This is very experimental and although it is used in a real project it mostly
+%D serves a testbed for Taco and me so as prelude to extending the inserts
+%D mechanism.
%D
%D \starttyping
%D \automigrateinserts
@@ -42,20 +42,7 @@
\registerctxluafile{node-mig}{}
-\newtoks\everyautomigratefootnotes
-\newtoks\everyautomigratemarks
-
-\def\automigrateinserts{\the\everyautomigratefootnotes} % soon default but does not work (yet) for notes in captions (themselves inserts)
-\def\automigratemarks {\the\everyautomigratemarks}
-
-\appendtoks
- \let\postponenotes\relax
- \enableexperiments[inserts.migrate,inserts.migrate.nested]%
-\to \everyautomigratefootnotes
-
-\appendtoks
- \writestatus\m!system{migration of marks is normally not needed}%
- \enableexperiments[marks.migrate]%
-\to \everyautomigratemarks
+\protected\def\automigrateinserts{\setupinsertion[\c!anchoring=\v!auto]}
+ \let\automigratemarks \relax
\protect
diff --git a/tex/context/base/mkiv/node-mig.mkxl b/tex/context/base/mkiv/node-mig.mkxl
new file mode 100644
index 000000000..f15f87f23
--- /dev/null
+++ b/tex/context/base/mkiv/node-mig.mkxl
@@ -0,0 +1,44 @@
+%D \module
+%D [ file=node-mig,
+%D version=2010.01.19,
+%D title=\CONTEXT\ Node Macros,
+%D subtitle=Inserts,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Node Support / Migrations}
+
+%D \starttyping
+%D \automigrateinserts
+%D
+%D \hbox{\vbox{x\footnote{1}x\footnote{2}x\footnote{3}x}}
+%D \vbox{x\footnote{4}x}
+%D \hbox{\vbox{x\footnote{5}x}}
+%D
+%D \hbox{x}
+%D \hbox{x\footnote{6}x}
+%D \hbox{x}
+%D
+%D \starttabulate
+%D \NC test \NC test \footnote{test} \input tufte \NC \NR
+%D \NC test \NC test \footnote{test} \input tufte \NC \NR
+%D \NC test \NC test \footnote{test} \input tufte \NC \NR
+%D \NC test \NC test \footnote{test} \input tufte \NC \NR
+%D \NC test \NC test \footnote{test} \input tufte \NC \NR
+%D \NC test \NC test \footnote{test} \input tufte \NC \NR
+%D \stoptabulate
+%D \stoptyping
+
+\unprotect
+
+\registerctxluafile{node-mig}{autosuffix}
+
+\let\automigrateinserts\relax
+\let\automigratemarks \relax
+
+\protect
diff --git a/tex/context/base/mkiv/node-nut.lua b/tex/context/base/mkiv/node-nut.lua
index e9bb71b80..5eed1b2b1 100644
--- a/tex/context/base/mkiv/node-nut.lua
+++ b/tex/context/base/mkiv/node-nut.lua
@@ -205,6 +205,7 @@ nuts.write = direct.write
nuts.mlist_to_hlist = direct.mlist_to_hlist
nuts.has_dimensions = direct.has_dimensions
nuts.start_of_par = direct.start_of_par
+nuts.migrate = direct.migrate
if not nuts.mlist_to_hlist then
diff --git a/tex/context/base/mkiv/page-ins.lua b/tex/context/base/mkiv/page-ins.lua
index 0323952d0..8a68e16dd 100644
--- a/tex/context/base/mkiv/page-ins.lua
+++ b/tex/context/base/mkiv/page-ins.lua
@@ -19,6 +19,7 @@ inserts.data = inserts.data or allocate { } -- bytecode storage pool
local variables = interfaces.variables
local v_page = variables.page
+local v_auto = variables.auto
local context = context
local implement = interfaces.implement
@@ -111,3 +112,10 @@ implement {
arguments = "string"
}
+implement {
+ name = "setinsertmigration",
+ arguments = "string",
+ actions = function(state)
+ nodes.migrations.setinserts(state == v_auto)
+ end
+}
diff --git a/tex/context/base/mkiv/page-ins.mkiv b/tex/context/base/mkiv/page-ins.mkiv
index 3b473343a..bac31476c 100644
--- a/tex/context/base/mkiv/page-ins.mkiv
+++ b/tex/context/base/mkiv/page-ins.mkiv
@@ -38,6 +38,31 @@
%c!factor=\plusthousand,
\c!location=\v!page]
+\newconstant\insertionmigrationmode
+
+\def\page_inserts_check_anchoring
+ {\edef\p_anchoring{\namedinsertionparameter\empty\c!anchoring}%
+ \insertionmigrationmode\ifx\p_anchoring\v!auto\plusone\else\zerocount\fi
+ \clf_setinsertmigration{\p_anchoring}}
+
+\appendtoks
+ \ifx\currentinsertionparent\empty
+ \page_inserts_check_anchoring
+ \fi
+\to \everysetupinsertion
+
+\ifcase\contextlmtxmode
+ \setupinsertion
+ [\c!anchoring=\v!none]
+\else
+ \setupinsertion
+ [\c!anchoring=\v!auto]
+\fi
+
+\appendtoks
+ \page_inserts_check_anchoring
+\to \everystarttext % or \everyjob
+
\newcount\currentinsertionnumber % This is a count and not a macro !
\newtoks\t_page_inserts_list
@@ -63,7 +88,9 @@
% \floatingpenalty\zerocount
\appendtoks
- \page_inserts_synchronize_registers
+ \ifx\currentinsertionparent\empty \else
+ \page_inserts_synchronize_registers
+ \fi
\to \everysetupinsertion
\unexpanded\def\page_inserts_process#1% beware, this adapts currentinsertion !
@@ -131,12 +158,14 @@
\to \everydefineinsertion
\appendtoks
- \clf_setupinsertion
- {\currentinsertion}
- {%
- location {\insertionparameter\c!location}%
- }%
- \relax
+ \ifx\currentinsertionparent\empty \else
+ \clf_setupinsertion
+ {\currentinsertion}
+ {%
+ location {\insertionparameter\c!location}%
+ }%
+ \relax
+ \fi
\to \everysetupinsertion
\unexpanded\def\page_inserts_set_location#1#2% fast one
diff --git a/tex/context/base/mkiv/spac-par.lmt b/tex/context/base/mkiv/spac-par.lmt
index ed5b735ec..595eabe62 100644
--- a/tex/context/base/mkiv/spac-par.lmt
+++ b/tex/context/base/mkiv/spac-par.lmt
@@ -11,6 +11,7 @@ local implement = interfaces.implement
local collected = utilities.storage.allocate()
local tobesaved = utilities.storage.allocate()
+local wrappers = { }
local jobparwrappers = {
collected = collected,
@@ -24,18 +25,26 @@ local function initializer()
collected = jobparwrappers.collected
end
-job.register('job.parwrappers.collected', tobesaved, initializer)
+local function finalizer()
+ -- nothing yet
+end
+
+job.register('job.parwrappers.collected', tobesaved, initializer, finalizer)
implement {
name = "newparwrapper",
arguments = "string",
actions = function(id)
local t = tobesaved[id]
+ local n
if t then
- t[#t+1] = 0
+ n = #t + 1
+ t[n] = 0
else
+ n = 1
tobesaved[id] = { 0 }
end
+ wrappers[id] = n
end
}
@@ -65,6 +74,6 @@ implement {
public = true,
actions = function(id)
local t = collected and collected[id]
- context(t and t[#t] or 0)
+ context(t and t[wrappers[id]] or 0)
end
}
diff --git a/tex/context/base/mkiv/spac-par.mkiv b/tex/context/base/mkiv/spac-par.mkiv
index f1745e4f8..aeb7a6da3 100644
--- a/tex/context/base/mkiv/spac-par.mkiv
+++ b/tex/context/base/mkiv/spac-par.mkiv
@@ -60,6 +60,9 @@
\let\registerparwrapper\gobbletwoarguments
\let\forgetparwrapper \relax
+\let\spac_paragraph_wrap \relax
+\let\spac_paragraph_freeze\relax
+
%D Beware, changing this will break some code (like pos/backgrounds) but it has been
%D changed anyway so let's see where things go wrong.
diff --git a/tex/context/base/mkiv/spac-par.mkxl b/tex/context/base/mkiv/spac-par.mkxl
index b136b5bce..d8abdcfdb 100644
--- a/tex/context/base/mkiv/spac-par.mkxl
+++ b/tex/context/base/mkiv/spac-par.mkxl
@@ -29,58 +29,53 @@
\installcorenamespace {bparwrap}
\installcorenamespace {eparwrap}
+\installcorenamespace {parwrapbefore}
+\installcorenamespace {parwrapafter}
\let\spac_paragraph_wrap\relax
+\newcount\c_spac_paragraph_group_level
+
\protected\def\spac_paragraph_update
- {\ifcsname\??bparwrap\the\currentgrouplevel\endcsname
+ {\c_spac_paragraph_group_level\currentgrouplevel\relax
+ \ifcsname\??bparwrap\the\c_spac_paragraph_group_level\endcsname
\the\lastnamedcs
- \wrapuppar{\the\csname\??eparwrap\the\currentgrouplevel\endcsname}%
+ \wrapuppar{\the\csname\??eparwrap\the\c_spac_paragraph_group_level\endcsname}%
\fi}
+\protected\def\registerparwrapper {\spac_register_par_wrapper\toksapp\tokspre}
+\protected\def\registerparwrapperreverse{\spac_register_par_wrapper\tokspre\toksapp}
\protected\def\spac_paragraph_install
{\expandafter\newtoks\csname\??bparwrap\the\currentgrouplevel\endcsname
\expandafter\newtoks\csname\??eparwrap\the\currentgrouplevel\endcsname}
-% \protected\def\registerparwrapper#1#2%
-% {\ifcsname\??bparwrap\the\currentgrouplevel\endcsname \else
-% \spac_paragraph_install
-% \fi
-% \toksapp\csname\??bparwrap\the\currentgrouplevel\endcsname{#1}%
-% \tokspre\csname\??eparwrap\the\currentgrouplevel\endcsname{#2}%
-% \let\spac_paragraph_wrap\spac_paragraph_update}
-
-% \protected\def\registerparwrapperreverse#1#2%
-% {\ifcsname\??bparwrap\the\currentgrouplevel\endcsname \else
-% \spac_paragraph_install
-% \fi
-% \tokspre\csname\??bparwrap\the\currentgrouplevel\endcsname{#1}%
-% \toksapp\csname\??eparwrap\the\currentgrouplevel\endcsname{#2}%
-% \let\spac_paragraph_wrap\spac_paragraph_update}
-
-\protected\def\registerparwrapper#1#2#3%
- {\ifcsname\??bparwrap\the\currentgrouplevel\endcsname \else
- \spac_paragraph_install
- \fi
- \clf_newparwrapper{#1}%
- \toksapp\csname\??bparwrap\the\currentgrouplevel\endcsname{\clf_setparwrapper{#1}#2}%
- \tokspre\csname\??eparwrap\the\currentgrouplevel\endcsname{#3}%
- \let\spac_paragraph_wrap\spac_paragraph_update}
+\def\spac_paragraph_install_pair#1#2#3%
+ {\expandafter\newtoks \csname\??parwrapbefore#3\endcsname
+ \expandafter\newtoks \csname\??parwrapafter #3\endcsname
+ #1\csname\??bparwrap\the\currentgrouplevel\endcsname\expandafter{\expandafter\the\csname\??parwrapbefore#3\endcsname}%
+ #2\csname\??eparwrap\the\currentgrouplevel\endcsname\expandafter{\expandafter\the\csname\??parwrapafter #3\endcsname}}
-\protected\def\registerparwrapperreverse#1#2#3%
+\protected\def\spac_register_par_wrapper#1#2#3#4#5%
{\ifcsname\??bparwrap\the\currentgrouplevel\endcsname \else
\spac_paragraph_install
\fi
- \clf_newparwrapper{#1}%
- \tokspre\csname\??bparwrap\the\currentgrouplevel\endcsname{\clf_setparwrapper{#1}#2}%
- \toksapp\csname\??eparwrap\the\currentgrouplevel\endcsname{#3}%
+ \ifcsname\??parwrapbefore#3\endcsname \else
+ \spac_paragraph_install_pair#1#2{#3}%
+ \fi
+ #1\csname\??parwrapbefore#3\endcsname{\clf_setparwrapper{#3}#4}%
+ #2\csname\??parwrapafter #3\endcsname{#5}%
+ \clf_newparwrapper{#3}%
\let\spac_paragraph_wrap\spac_paragraph_update}
\protected\def\forgetparwrapper
{\csname\??bparwrap\the\currentgrouplevel\endcsname\emptytoks
\csname\??eparwrap\the\currentgrouplevel\endcsname\emptytoks}
+\protected\def\unregisterparwrapper#1%
+ {\csname\??parwrapbefore#1\endcsname\emptytoks
+ \csname\??parwrapafter #1\endcsname\emptytoks}
+
% \getparwrapper % defined in lua
% \lastparwrapper % defined in lua
@@ -91,17 +86,22 @@
{\smallinfofont\lastparwrapper{#1}}%
\endgroup}
-\appendtoks \updateparwrapperindeed \to\everypar
-\appendtoks\let\updateparwrapperindeed\relax\to\everyforgetall
-
-\installtexexperiment
- {paragraphs.freeze}
- {\setparagraphfreezing
- \appendtoksonce\spac_paragraph_wrap \to \everypar
- \appendtoksonce\spac_paragraph_freeze\to \everypar}
- {\forgetparagraphfreezing
- \removetoks \spac_paragraph_wrap \from\everypar
- \removetoks \spac_paragraph_freeze\from\everypar}
+%appendtoks\updateparwrapperindeed\to\everypar
+%appendtoks\spac_paragraph_wrap \to\everypar
+%appendtoks\spac_paragraph_freeze \to\everypar
+
+\setparagraphfreezing
+
+\appendtoks\let\spac_paragraph_wrap\relax\to\everyforgetall
+
+% \installtexexperiment
+% {paragraphs.freeze}
+% {\setparagraphfreezing
+% \appendtoksonce\spac_paragraph_wrap \to \everypar
+% \appendtoksonce\spac_paragraph_freeze\to \everypar}
+% {\forgetparagraphfreezing
+% \removetoks \spac_paragraph_wrap \from\everypar
+% \removetoks \spac_paragraph_freeze\from\everypar}
%D In due time, the code below will be upgraded using the above mechanisms.
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index b6a9c8d6c..43e99e1d7 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index 3f5dea552..bbba0e977 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/strc-not.mkvi b/tex/context/base/mkiv/strc-not.mkvi
index b83add08f..bc2fc53eb 100644
--- a/tex/context/base/mkiv/strc-not.mkvi
+++ b/tex/context/base/mkiv/strc-not.mkvi
@@ -1563,14 +1563,18 @@
% we need a proper state: normal, postponing, flushing
\unexpanded\def\postponenotes
- {\ifconditional\postponingnotes\else
- \global\settrue\postponingnotes
- \glet\flushnotes\doflushnotes
- \clf_postponenotes
+ {\ifcase\insertionmigrationmode
+ \ifconditional\postponingnotes\else
+ \global\settrue\postponingnotes
+ \glet\flushnotes\doflushnotes
+ \clf_postponenotes
+ \fi
\fi}
\let\flushnotes\relax
+% also \ifcase\insertionmigrationmode here, needs testing:
+
\unexpanded\def\startpostponingnotes % experimental, page-mix
{\ifconditional\postponingnotes\else
\global\settrue\postponingnotes
diff --git a/tex/context/base/mkiv/task-ini.lua b/tex/context/base/mkiv/task-ini.lua
index 366c7009e..033672f45 100644
--- a/tex/context/base/mkiv/task-ini.lua
+++ b/tex/context/base/mkiv/task-ini.lua
@@ -66,6 +66,12 @@ appendaction("processors", "lists", "typesetters.digits.handler",
appendaction("processors", "lists", "typesetters.italics.handler", nil, "nut", "disabled" )
appendaction("processors", "lists", "languages.visualizediscretionaries", nil, "nut", "disabled" )
+if CONTEXTLMTXMODE == 0 then
+
+appendaction("processors", "lists", "nodes.handlers.migrate", nil, "nut", "disabled" )
+
+end
+
appendaction("processors", "after", "typesetters.marksuspects", nil, "nut", "disabled" )
appendaction("shipouts", "normalizers", "nodes.handlers.cleanuppage", nil, "nut", "production")
diff --git a/tex/context/base/mkiv/typo-del.mkiv b/tex/context/base/mkiv/typo-del.mkiv
index afa7e0ffe..2ccac0e73 100644
--- a/tex/context/base/mkiv/typo-del.mkiv
+++ b/tex/context/base/mkiv/typo-del.mkiv
@@ -420,7 +420,7 @@
\typo_delimited_push{#1}{#2}%
\dostarttaggedchained\t!delimitedblock\currentdelimitedtext\??delimitedtext
\edef\p_delimited_method{\delimitedtextparameter\c!method}%
- \ifx\p_delimited_method\s!font
+ \ifx\p_delimited_method\v!font
\expandafter\typo_delimited_start_font
\else
\expandafter\typo_delimited_start_other
@@ -579,7 +579,7 @@
{\dontleavehmode % following ones can be omited
\typo_delimited_push{#1}{#2}%
\edef\p_delimited_method{\delimitedtextparameter\c!method}%
- \ifx\p_delimited_method\s!font
+ \ifx\p_delimited_method\v!font
\expandafter\typo_delimited_fontdriven
\else
\expandafter\typo_delimited_other
diff --git a/tex/context/base/mkiv/typo-drp.mkiv b/tex/context/base/mkiv/typo-drp.mkiv
index 6ed7e8bfe..e774b6796 100644
--- a/tex/context/base/mkiv/typo-drp.mkiv
+++ b/tex/context/base/mkiv/typo-drp.mkiv
@@ -59,9 +59,9 @@
\c!n=3,
\c!m=1,
\c!method=\v!none,
- % \s!font=Bold sa 4,
- % \s!font=Bold ht \measure{initial:n},
- \s!font=Bold cp \measure{initial:n},
+ % \c!font=Bold sa 4,
+ % \c!font=Bold ht \measure{initial:n},
+ \c!font=Bold cp \measure{initial:n},
\c!distance=.125\emwidth,
\c!hoffset=\zeropoint,
\c!voffset=\v!line, % \dimexp\lineheight*\initialparameter\c!n-\lineheight\relax]
@@ -90,7 +90,7 @@
\setupcurrentinitial[#2]%
\resetfontfeature % might be needed in more places
\doifelsenothing{\initialparameter\c!style}
- {\definedfont[\initialparameter\s!font]}
+ {\definedfont[\initialparameter\c!font]}
{\useinitialstyleparameter\c!style}%
\useinitialcolorparameter\c!color
\edef\p_voffset{\initialparameter\c!voffset}%