summaryrefslogtreecommitdiff
path: root/tex/context/base
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-09-21 21:43:12 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-09-21 21:43:12 +0200
commitf7ee609d470a08a16e5cdaad14582fc8ed993c5e (patch)
tree56f85523ff7b19d926d026f470bb2c75d192e23b /tex/context/base
parent772472f057060460c83828cf7fd1631298165e37 (diff)
downloadcontext-f7ee609d470a08a16e5cdaad14582fc8ed993c5e.tar.gz
2017-09-21 21:10:00
Diffstat (limited to 'tex/context/base')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkii/mult-en.mkii2
-rw-r--r--tex/context/base/mkii/mult-it.mkii2
-rw-r--r--tex/context/base/mkiv/back-exp.lua2
-rw-r--r--tex/context/base/mkiv/back-exp.mkiv3
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context-base.lmx13
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/core-ini.mkiv4
-rw-r--r--tex/context/base/mkiv/data-tex.lua27
-rw-r--r--tex/context/base/mkiv/file-job.mkvi10
-rw-r--r--tex/context/base/mkiv/font-hsh.lua8
-rw-r--r--tex/context/base/mkiv/font-mis.lua43
-rw-r--r--tex/context/base/mkiv/lpdf-epd.lua4
-rw-r--r--tex/context/base/mkiv/mult-mes.lua8
-rw-r--r--tex/context/base/mkiv/mult-sys.mkiv1
-rw-r--r--tex/context/base/mkiv/page-cst.mkiv2
-rw-r--r--tex/context/base/mkiv/page-ini.mkiv61
-rw-r--r--tex/context/base/mkiv/page-mix.mkiv12
-rw-r--r--tex/context/base/mkiv/page-mul.mkiv6
-rw-r--r--tex/context/base/mkiv/page-one.mkiv2
-rw-r--r--tex/context/base/mkiv/page-otr.mkvi20
-rw-r--r--tex/context/base/mkiv/page-pst.mkiv8
-rw-r--r--tex/context/base/mkiv/page-set.mkiv6
-rw-r--r--tex/context/base/mkiv/publ-dat.lua8
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin25846 -> 25846 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin426573 -> 426590 bytes
-rw-r--r--tex/context/base/mkiv/strc-flt.mkvi26
-rw-r--r--tex/context/base/mkiv/util-jsn.lua7
30 files changed, 237 insertions, 56 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index f31bce976..27f417f29 100644
--- a/tex/context/base/mkii/cont-new.mkii
+++ b/tex/context/base/mkii/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2017.09.15 20:03}
+\newcontextversion{2017.09.21 21:05}
%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/mkii/context.mkii b/tex/context/base/mkii/context.mkii
index 93dd75394..66e27204f 100644
--- a/tex/context/base/mkii/context.mkii
+++ b/tex/context/base/mkii/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2017.09.15 20:03}
+\edef\contextversion{2017.09.21 21:05}
%D For those who want to use this:
diff --git a/tex/context/base/mkii/mult-en.mkii b/tex/context/base/mkii/mult-en.mkii
index e1f59ed93..8a0ab18a5 100644
--- a/tex/context/base/mkii/mult-en.mkii
+++ b/tex/context/base/mkii/mult-en.mkii
@@ -753,6 +753,7 @@
\setinterfaceconstant{direction}{direction}
\setinterfaceconstant{directory}{directory}
\setinterfaceconstant{display}{display}
+\setinterfaceconstant{displaythreshold}{displaythreshold}
\setinterfaceconstant{distance}{distance}
\setinterfaceconstant{domain}{domain}
\setinterfaceconstant{dot}{dot}
@@ -862,6 +863,7 @@
\setinterfaceconstant{index}{index}
\setinterfaceconstant{indicator}{indicator}
\setinterfaceconstant{initialsep}{initialsep}
+\setinterfaceconstant{inlinethreshold}{inlinethreshold}
\setinterfaceconstant{inner}{inner}
\setinterfaceconstant{innermargin}{innermargin}
\setinterfaceconstant{inputfile}{inputfile}
diff --git a/tex/context/base/mkii/mult-it.mkii b/tex/context/base/mkii/mult-it.mkii
index a79b0b9e8..c0eb9332b 100644
--- a/tex/context/base/mkii/mult-it.mkii
+++ b/tex/context/base/mkii/mult-it.mkii
@@ -753,6 +753,7 @@
\setinterfaceconstant{direction}{direzione}
\setinterfaceconstant{directory}{directory}
\setinterfaceconstant{display}{display}
+\setinterfaceconstant{displaythreshold}{displaythreshold}
\setinterfaceconstant{distance}{distanza}
\setinterfaceconstant{domain}{domain}
\setinterfaceconstant{dot}{punto}
@@ -862,6 +863,7 @@
\setinterfaceconstant{index}{index}
\setinterfaceconstant{indicator}{indicatore}
\setinterfaceconstant{initialsep}{initialsep}
+\setinterfaceconstant{inlinethreshold}{inlinethreshold}
\setinterfaceconstant{inner}{interno}
\setinterfaceconstant{innermargin}{margineinterno}
\setinterfaceconstant{inputfile}{inputfile}
diff --git a/tex/context/base/mkiv/back-exp.lua b/tex/context/base/mkiv/back-exp.lua
index 3ad9418ec..5e78c38b7 100644
--- a/tex/context/base/mkiv/back-exp.lua
+++ b/tex/context/base/mkiv/back-exp.lua
@@ -3519,7 +3519,7 @@ local htmltemplate = [[
local function validpath(what,pathname)
if lfs.isdir(pathname) then
- report_export("using exiting %s path %a",what,pathname)
+ report_export("using existing %s path %a",what,pathname)
return pathname
end
lfs.mkdir(pathname)
diff --git a/tex/context/base/mkiv/back-exp.mkiv b/tex/context/base/mkiv/back-exp.mkiv
index 6e24ed641..4cab46bdd 100644
--- a/tex/context/base/mkiv/back-exp.mkiv
+++ b/tex/context/base/mkiv/back-exp.mkiv
@@ -270,6 +270,9 @@
\clf_initializeexport
\setsystemmode\v!export
\exportingtrue
+ \writestatus\m!backend\empty % so messages will stand out a bit
+ \the\everyinitializeexport
+ \writestatus\m!backend\empty % so messages will stand out a bit
\glet\doinitializeexport\relax
\fi}
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index c3305ba66..249a503d7 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2017.09.15 20:03}
+\newcontextversion{2017.09.21 21:05}
%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/mkiv/context-base.lmx b/tex/context/base/mkiv/context-base.lmx
index 482d43e88..af8c3c127 100644
--- a/tex/context/base/mkiv/context-base.lmx
+++ b/tex/context/base/mkiv/context-base.lmx
@@ -25,6 +25,9 @@
<style type="text/css">
<?lua inject(variables.cssdata) ?>
</style>
+ <?lua if variables.javascriptfiles then for k, v in ipairs(variables.javascriptfiles) do ?>
+ <script src="<?lua inject(v) ?>"></script>
+ <?lua end end ?>
<?lua if variables.styles then for k, v in ipairs(variables.styles) do ?>
<link rel="StyleSheet" href="<?lua inject(v) ?>" type="text/css" />
<?lua end end ?>
@@ -36,10 +39,14 @@
</script>
<![endif]-->
<?lua end ?>
+ <body>
<?lua if variables.action then ?>
- <form action="<?lua inject(variables.action) ?>" enctype="multi-part/form-data" method="post">
+ <?lua if variables.formmethod == "get" then ?>
+ <form action="<?lua inject(variables.action) ?>" method="get">
+ <?lua else ?>
+ <form action="<?lua inject(variables.action) ?>" enctype="multi-part/form-data" method="post">
+ <?lua end ?>
<?lua end ?>
- <body>
<div id="top"><?lua if variables.title then ?>
<div id="top-one">
<div id="top-two"><?lua
@@ -81,8 +88,8 @@
<?lua inject(variables.maintext) ?>
</div>
</div>
- </body>
<?lua if variables.action then ?>
</form>
<?lua end ?>
+ </body>
</html>
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index 4033f2c7d..50aa3a843 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -41,7 +41,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2017.09.15 20:03}
+\edef\contextversion{2017.09.21 21:05}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/core-ini.mkiv b/tex/context/base/mkiv/core-ini.mkiv
index 35790f131..cb8881c22 100644
--- a/tex/context/base/mkiv/core-ini.mkiv
+++ b/tex/context/base/mkiv/core-ini.mkiv
@@ -87,6 +87,10 @@
\newtoks \everyinsidefloat
+%D Exporting:
+
+\newtoks\everyinitializeexport
+
%D Sectioning:
%newtoks \everyheadstart
diff --git a/tex/context/base/mkiv/data-tex.lua b/tex/context/base/mkiv/data-tex.lua
index b6b97a0a9..2d2c9b24d 100644
--- a/tex/context/base/mkiv/data-tex.lua
+++ b/tex/context/base/mkiv/data-tex.lua
@@ -57,6 +57,33 @@ resolvers.inputstack = resolvers.inputstack or { }
local inputstack = resolvers.inputstack
+----------------------------------------
+
+local lpegmatch = lpeg.match
+local newline = lpeg.patterns.newline
+local tsplitat = lpeg.tsplitat
+
+local linesplitters = {
+ tsplitat(newline), -- default since we started
+ tsplitat(lpeg.S(" ")^0 * newline),
+ tsplitat(lpeg.S(" \t")^0 * newline),
+ tsplitat(lpeg.S(" \f\t")^0 * newline), -- saves a bit of space at the cost of runtime
+ -- tsplitat(lpeg.S(" \v\f\t")^0 * newline),
+ -- tsplitat(lpeg.R("\0\31")^0 * newline),
+}
+
+local linesplitter = linesplitters[1]
+
+directives.register("system.linesplitmethod",function(v)
+ linesplitter = linesplitters[tonumber(v) or 1] or linesplitters[1]
+end)
+
+local function splitlines(str)
+ return lpegmatch(linesplitter,str)
+end
+
+-----------------------------------------
+
function helpers.textopener(tag,filename,filehandle,coding)
local lines
local t_filehandle = type(filehandle)
diff --git a/tex/context/base/mkiv/file-job.mkvi b/tex/context/base/mkiv/file-job.mkvi
index 75362d5a9..49598a494 100644
--- a/tex/context/base/mkiv/file-job.mkvi
+++ b/tex/context/base/mkiv/file-job.mkvi
@@ -345,4 +345,14 @@
%S The document: namespace will be used elsewhere too.
+% Bonus:
+
+\installcorenamespace{samplefile}
+
+\unexpanded\def\samplefile#1%
+ {\ifcsname\??samplefile#1\endcsname \else
+ \setxvalue{\??samplefile#1}{\cldloadfile{#1}}%
+ \fi
+ \lastnamedcs}
+
\protect \endinput
diff --git a/tex/context/base/mkiv/font-hsh.lua b/tex/context/base/mkiv/font-hsh.lua
index 95914b50c..60a27c043 100644
--- a/tex/context/base/mkiv/font-hsh.lua
+++ b/tex/context/base/mkiv/font-hsh.lua
@@ -61,8 +61,8 @@ hashes.originals = originals
hashes.modes = modes
hashes.variants = variants
-local nodepool = nodes.pool
-local dummyglyph = nodepool.register(nodepool.glyph())
+local nodepool = nodes and nodes.pool
+local dummyglyph = nodepool and nodepool.register(nodepool.glyph())
local nulldata = allocate {
name = "nullfont",
@@ -239,7 +239,7 @@ setmetatableindex(quads, function(t,k)
local quad
if parameters then
quad = parameters.quad
- else
+ elseif dummyglyph then
dummyglyph.font = k
dummyglyph.char = 0x2014 -- emdash
quad = dummyglyph.width -- dirty trick
@@ -260,7 +260,7 @@ setmetatableindex(xheights, function(t,k)
local xheight
if parameters then
xheight = parameters.xheight
- else
+ elseif dummyglyph then
dummyglyph.font = k
dummyglyph.char = 0x78 -- x
xheight = dummyglyph.height -- dirty trick
diff --git a/tex/context/base/mkiv/font-mis.lua b/tex/context/base/mkiv/font-mis.lua
index 6d2b99871..e1f158c83 100644
--- a/tex/context/base/mkiv/font-mis.lua
+++ b/tex/context/base/mkiv/font-mis.lua
@@ -27,24 +27,31 @@ if readers then
function fonts.helpers.getfeatures(name,save)
local filename = resolvers.findfile(name) or ""
if filename ~= "" then
- local name = file.removesuffix(file.basename(filename))
- local cleanname = containers.cleanname(name)
- local data = containers.read(otf.cache,cleanname)
- if data then
- readers.unpack(data)
- else
- data = readers.loadfont(filename) -- we can do a more minimal load
- -- if data and save then
- -- -- keep this in sync with font-otl
- -- readers.compact(data)
- -- readers.rehash(data,"unicodes")
- -- readers.addunicodetable(data)
- -- readers.extend(data)
- -- readers.pack(data)
- -- -- till here
- -- containers.write(otf.cache,cleanname,data)
- -- end
- end
+-- local name = file.removesuffix(file.basename(filename))
+-- local cleanname = containers.cleanname(name)
+-- local data = containers.read(otf.cache,cleanname)
+-- if data then
+-- readers.unpack(data)
+-- else
+-- data = readers.loadfont(filename) -- we can do a more minimal load
+-- -- if data and save then
+-- -- -- keep this in sync with font-otl
+-- -- readers.compact(data)
+-- -- readers.rehash(data,"unicodes")
+-- -- readers.addunicodetable(data)
+-- -- readers.extend(data)
+-- -- readers.pack(data)
+-- -- -- till here
+-- -- containers.write(otf.cache,cleanname,data)
+-- -- end
+-- end
+-- if not data then
+-- data = readers.loadfont(filename) -- we can do a more minimal load
+-- end
+-- if data then
+-- readers.unpack(data)
+-- end
+local data = otf.load(filename)
return data and data.resources and data.resources.features
end
end
diff --git a/tex/context/base/mkiv/lpdf-epd.lua b/tex/context/base/mkiv/lpdf-epd.lua
index 0f62d6189..06afaa087 100644
--- a/tex/context/base/mkiv/lpdf-epd.lua
+++ b/tex/context/base/mkiv/lpdf-epd.lua
@@ -57,6 +57,8 @@ local dictGetLength, dictGetVal, dictGetValNF, dictGetKey
local arrayGetLength, arrayGetNF, arrayGet
local streamReset, streamGetDict, streamGetChar
+-- getCatalog getNumPages getPageRef fetch getXRef getDocInfo
+
do
local object = epdf.Object()
--
@@ -538,6 +540,8 @@ function lpdf_epdf.load(filename)
--
local Catalog = some_dictionary(__xref__:getCatalog():getDict(),document)
local Info = some_dictionary(__xref__:getDocInfo():getDict(),document)
+-- local Catalog = some_dictionary(getDict(__xref__:getCatalog()),document)
+-- local Info = some_dictionary(getDict(__xref__:getDocInfo()),document)
--
document.Catalog = Catalog
document.Info = Info
diff --git a/tex/context/base/mkiv/mult-mes.lua b/tex/context/base/mkiv/mult-mes.lua
index 979831726..ffb9b32da 100644
--- a/tex/context/base/mkiv/mult-mes.lua
+++ b/tex/context/base/mkiv/mult-mes.lua
@@ -490,6 +490,14 @@ return {
no = "there is nothing to split",
ro = "there is nothing to split",
},
+ ["floatblocks:14"] = {
+ en = "float locations will be forced to %a due to exporting",
+ nl = "blok plaatsing is altijd %a vanwege export",
+ },
+ ["floatblocks:15"] = {
+ en = "location %a changed to %a due to exporting",
+ nl = "plaatsing %a vervangen door %a vanwege export",
+ },
["floatblocks:1"] = {
en = "%a is empty",
},
diff --git a/tex/context/base/mkiv/mult-sys.mkiv b/tex/context/base/mkiv/mult-sys.mkiv
index 038d5e5af..2fffe3084 100644
--- a/tex/context/base/mkiv/mult-sys.mkiv
+++ b/tex/context/base/mkiv/mult-sys.mkiv
@@ -479,6 +479,7 @@
\definemessageconstant {metapost}
\definemessageconstant {chemicals}
\definemessageconstant {publications}
+\definemessageconstant {backend}
%D When we use numbers and dimensions the same applies as with the keywords like
%D \type {width} and \type {plus} mentioned earlier.
diff --git a/tex/context/base/mkiv/page-cst.mkiv b/tex/context/base/mkiv/page-cst.mkiv
index ed4512561..1dc324d8c 100644
--- a/tex/context/base/mkiv/page-cst.mkiv
+++ b/tex/context/base/mkiv/page-cst.mkiv
@@ -326,7 +326,7 @@
\fi}}%
\clf_finishcolumnsetflush{\currentpagegrid}%
\egroup
- \page_otr_construct_and_shipout\box\b_page_grid_collected
+ \page_otr_construct_and_shipout\box\b_page_grid_collected\zerocount % three arguments
\clf_flushcolumnsetareas{\currentpagegrid}\relax
\page_grid_command_flush_saved_floats}
diff --git a/tex/context/base/mkiv/page-ini.mkiv b/tex/context/base/mkiv/page-ini.mkiv
index 7ffd00c65..3e145690f 100644
--- a/tex/context/base/mkiv/page-ini.mkiv
+++ b/tex/context/base/mkiv/page-ini.mkiv
@@ -36,7 +36,7 @@
\newconditional\c_otr_shipout_enabled \settrue\c_otr_shipout_enabled
-\unexpanded\def\page_otr_shipout
+\unexpanded\def\page_otr_shipout % not used at all
{\ifconditional\c_otr_shipout_enabled
\expandafter\page_otr_shipout_yes
\else
@@ -90,13 +90,57 @@
\fi}
\def\page_otr_flush_pending_content
- {\vskip\zeropoint\relax % brrr .. get rid of this
+ {\vskip\zeropoint\relax
\ifvoid\normalpagebox \else
\unvbox\normalpagebox
\penalty\outputpenalty
\fi}
-\def\page_otr_construct_and_shipout#1#2%
+\newconstant\c_page_postponed_mode % \c_page_postponed_mode\plusone
+\newbox \b_page_otr_saved
+
+\installoutputroutine\savepagecontent
+ {\global\setbox\b_page_otr_saved\box\normalpagebox}
+
+\unexpanded\def\flushpagecontent
+ {\ifvoid\b_page_otr_saved\else\unvbox\b_page_otr_saved\fi}
+
+% Test case: assumes one group level for output routine, todo:
+% a toks.
+%
+% \starttext
+%
+% \startbuffer[makeup]
+% \startpagemakeup[pagestate=start,page=no]
+% \color[red]{
+% \vfill
+% \dorecurse{3}{
+% \samplefile{klein}
+% \vfill
+% }
+% }
+% \stoppagemakeup
+% \stopbuffer
+%
+% \startcolor[green]
+% \dorecurse{10}{
+% \dontleavehmode{\bf 1:#1:} \samplefile{sapolsky}\par
+% }
+% \stopcolor
+%
+% \startpostponing % [+3]
+% \getbuffer[makeup]
+% \stoppostponing
+%
+% \startcolor[blue]
+% \dorecurse{25}{
+% \dontleavehmode{\bf 2:#1:} \samplefile{sapolsky}\par
+% }
+% \stopcolor
+%
+% \stoptext
+
+\def\page_otr_construct_and_shipout#1#2#3%
{\forgetall
\page_boxes_shipout{\page_boxes_constructed_page#1#2}% \hbox removed
\page_otr_flush_pending_content
@@ -112,7 +156,16 @@
\page_otr_check_for_pending_inserts
\page_floats_flush_page_floats % before postponed blocks
\page_spread_flush % defined later
- \page_postponed_blocks_flush}
+ \ifnum#3=\plusone
+ % this is tricky! we need to make sure we are in the output group
+ \ifnum\c_page_postponed_mode=\plusone
+ \aftergroup\page_postponed_blocks_flush
+ \else
+ \page_postponed_blocks_flush
+ \fi
+ \else
+ \page_postponed_blocks_flush
+ \fi}
% Can't we get rid of this hackery? It's used in some widgets
% stuff so probably not.
diff --git a/tex/context/base/mkiv/page-mix.mkiv b/tex/context/base/mkiv/page-mix.mkiv
index 8b58a4c3d..73ed9466c 100644
--- a/tex/context/base/mkiv/page-mix.mkiv
+++ b/tex/context/base/mkiv/page-mix.mkiv
@@ -239,7 +239,7 @@
\def\page_mix_routine_error
{\showmessage\m!columns3\empty
- \page_otr_construct_and_shipout\unvbox\normalpagebox}
+ \page_otr_construct_and_shipout\unvbox\normalpagebox\zerocount} % three arguments
%D Some settings (and actions) depend on the current output routine and setting the
%D hsize and vsize is among them. The calculation of the hsize is done elsewhere.
@@ -737,7 +737,7 @@
\setbox\b_page_mix_collected\vpack{\unvbox\normalpagebox}% brrr we need to make a tight box (combine this in lua)
\page_mix_routine_construct\v!no
\page_mix_routine_package
- \page_otr_construct_and_shipout\box\b_page_mix_collected
+ \page_otr_construct_and_shipout\box\b_page_mix_collected\zerocount % three arguments
\clf_mixflushrest
\clf_mixcleanup
\egroup}
@@ -775,7 +775,7 @@
% 1 = we have stuff left, so flush and rebalance
%writestatus\m!columns{flush continue}%
\page_mix_routine_package
- \page_otr_construct_and_shipout\box\b_page_mix_collected
+ \page_otr_construct_and_shipout\box\b_page_mix_collected\zerocount % three arguments
\setbox\b_page_mix_collected\vpack{\clf_mixflushrest}% we could avoid this
\clf_mixcleanup
\ifdim\ht\b_page_mix_collected=\zeropoint
@@ -938,10 +938,10 @@
\unexpanded\def\page_mix_place_float_force
{\page_one_place_float_force}
-\unexpanded\def\page_mix_command_side_float_output % hm
- {\page_otr_construct_and_shipout\unvbox\normalpagebox}
+\unexpanded\def\page_mix_command_side_float_output
+ {\page_otr_construct_and_shipout\unvbox\normalpagebox\zerocount} % three arguments
-\unexpanded\def\page_mix_command_synchronize_side_floats % hm
+\unexpanded\def\page_mix_command_synchronize_side_floats
{\page_sides_forget_floats}
\unexpanded\def\page_mix_command_flush_side_floats
diff --git a/tex/context/base/mkiv/page-mul.mkiv b/tex/context/base/mkiv/page-mul.mkiv
index 14b9eb992..5b4f064d0 100644
--- a/tex/context/base/mkiv/page-mul.mkiv
+++ b/tex/context/base/mkiv/page-mul.mkiv
@@ -86,7 +86,7 @@
{\page_one_place_float_force}
\unexpanded\def\page_mul_command_side_float_output
- {\page_otr_construct_and_shipout\unvbox\normalpagebox}
+ {\page_otr_construct_and_shipout\unvbox\normalpagebox\zerocount} % three arguments
\unexpanded\def\page_mul_command_flush_side_floats
{\page_sides_forget_floats}
@@ -341,7 +341,7 @@
\def\page_mul_routine_error
{\showmessage\m!columns3\empty
- \page_otr_construct_and_shipout\unvbox\normalpagebox}
+ \page_otr_construct_and_shipout\unvbox\normalpagebox\zerocount} % three arguments
%D When we leave the multi||column mode, we have to process the not yet shipped out
%D part of the columns. When we don't balance, we simply force a continuous output,
@@ -858,7 +858,7 @@
{\ht\currentcolumnbox\d_page_mul_balance_target}% redundant
\fi
\setbox\b_page_mul_preceding\vbox{\page_mul_flush_packaged_columns_continued}%
- \page_otr_construct_and_shipout\box\b_page_mul_preceding
+ \page_otr_construct_and_shipout\box\b_page_mul_preceding\zerocount % three arguments
\page_otr_command_set_hsize
\page_otr_command_set_vsize
\page_mul_flush_floats
diff --git a/tex/context/base/mkiv/page-one.mkiv b/tex/context/base/mkiv/page-one.mkiv
index d113d3d54..f3d7aa3e4 100644
--- a/tex/context/base/mkiv/page-one.mkiv
+++ b/tex/context/base/mkiv/page-one.mkiv
@@ -192,7 +192,7 @@
\egroup}
\unexpanded\def\page_one_command_side_float_output
- {\page_otr_construct_and_shipout\unvbox\normalpagebox}
+ {\page_otr_construct_and_shipout\unvbox\normalpagebox\plusone} % three arguments, we need to be in the output group
\unexpanded\def\page_one_command_routine
{\page_sides_output_routine}
diff --git a/tex/context/base/mkiv/page-otr.mkvi b/tex/context/base/mkiv/page-otr.mkvi
index ec38a06c1..22d622db8 100644
--- a/tex/context/base/mkiv/page-otr.mkvi
+++ b/tex/context/base/mkiv/page-otr.mkvi
@@ -166,6 +166,26 @@
#content\relax
\the\everyafteroutput}}
+% Just as fuzzy (and in 'one' we are okay with \aftergroup anyway):
+%
+% \ifdefined\everybeforeoutputgroup \else \newtoks\everybeforeoutputgroup \fi
+% \ifdefined\everyafteroutputgroup \else \newtoks\everyafteroutputgroup \fi
+%
+% \def\page_otf_set_engine_output_routine#content%
+% {\the\everybeforeoutputgroup
+% \global\output
+% {\inotrtrue
+% \the\everybeforeoutput
+% #content\relax
+% \the\everyafteroutput
+% \aftergroup\the\aftergroup\everyafteroutputgroup}}
+%
+% \appendtoks
+% \ifnum\c_page_postponed_mode=\plusone
+% \page_postponed_blocks_flush % and then not in \page_otr_construct_and_shipout
+% \fi
+% \to \everyafteroutputgroup
+
\page_otf_set_engine_output_routine\page_otr_triggered_output_routine
\installoutputroutine\synchronizeoutput
diff --git a/tex/context/base/mkiv/page-pst.mkiv b/tex/context/base/mkiv/page-pst.mkiv
index f12663f66..05b4f4209 100644
--- a/tex/context/base/mkiv/page-pst.mkiv
+++ b/tex/context/base/mkiv/page-pst.mkiv
@@ -69,10 +69,15 @@
% officially we should flush again after a flush as there can be new future pages
% but that will be looked into when we run into it
+\c_page_postponed_mode\plusone
+
\unexpanded\def\page_postponed_blocks_flush_indeed
{\begingroup
\setsystemmode\v!postponing
\settrue\c_page_postponed_busy
+ \ifnum\c_page_postponed_mode=\plusone
+ \savepagecontent
+ \fi
\pagetotal\zeropoint % here? still needed? (was after flush pagefloats)
\the\everytopofpage\relax
%\flushrestfloats
@@ -84,6 +89,9 @@
% page {123}
\relax
\page_otr_command_flush_floats % new but potential dangerous, maybe we need a classification
+ \ifnum\c_page_postponed_mode=\plusone
+ \flushpagecontent
+ \fi
\endgroup} % of blocks: with and without flush
\unexpanded\def\page_postponed_blocks_flush
diff --git a/tex/context/base/mkiv/page-set.mkiv b/tex/context/base/mkiv/page-set.mkiv
index f3fa01696..0d62df75a 100644
--- a/tex/context/base/mkiv/page-set.mkiv
+++ b/tex/context/base/mkiv/page-set.mkiv
@@ -560,14 +560,14 @@
{\ifdim\ht\OTRfinalpagebox=\textheight
\bgroup
\ifcase\OTRSETbalancemethod
- \page_otr_construct_and_shipout\box\OTRfinalpagebox
+ \page_otr_construct_and_shipout\box\OTRfinalpagebox\zerocount % three arguments
\else\ifdim\OTRSETbalht>\zeropoint
% catch a bordercase
\scratchdimen\OTRSETbalht
\advance\scratchdimen\lineheight\relax
\ifdim\scratchdimen>\textheight
% full page
- \page_otr_construct_and_shipout\box\OTRfinalpagebox
+ \page_otr_construct_and_shipout\box\OTRfinalpagebox\zerocount % three arguments
\else
% same page
\global\setbox\OTRfinalpagebox \iftracecolumnset\ruledvbox\else\vbox\fi to \OTRSETbalht
@@ -576,7 +576,7 @@
\snaptogrid\vbox{\vskip\OTRSETbalht}% hack
\fi
\else
- \page_otr_construct_and_shipout\box\OTRfinalpagebox
+ \page_otr_construct_and_shipout\box\OTRfinalpagebox\zerocount % three arguments
\fi \fi
\globallet\OTRSETbalht\zeropoint
\egroup
diff --git a/tex/context/base/mkiv/publ-dat.lua b/tex/context/base/mkiv/publ-dat.lua
index 0bddad216..2cebb4379 100644
--- a/tex/context/base/mkiv/publ-dat.lua
+++ b/tex/context/base/mkiv/publ-dat.lua
@@ -862,7 +862,7 @@ do
publications.loadbibdata(dataset,data,fullname,kind)
end
- function loaders.lua(dataset,filename) -- if filename is a table we load that one
+ function loaders.lua(dataset,filename,loader) -- if filename is a table we load that one
local current, data, fullname
if type(filename) == "table" then
current = datasets[dataset]
@@ -873,7 +873,7 @@ do
return
end
current = datasets[dataset]
- data = table.load(fullname)
+ data = (loader or table.load)(fullname)
end
if data then
local luadata = current.luadata
@@ -888,6 +888,10 @@ do
end
end
+ function loaders.json(dataset,filename)
+ loaders.lua(dataset,filename,utilities.json.load)
+ end
+
function loaders.buffer(dataset,name) -- if filename is a table we load that one
local current = datasets[dataset]
local barename = file.removesuffix(name)
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index e45d0d6c3..962f63e0a 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 59f1db86f..fa7946a53 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-flt.mkvi b/tex/context/base/mkiv/strc-flt.mkvi
index 7ddb168ca..359b32a53 100644
--- a/tex/context/base/mkiv/strc-flt.mkvi
+++ b/tex/context/base/mkiv/strc-flt.mkvi
@@ -538,9 +538,20 @@
\setupfloat[\c!spacebefore=\v!none,\c!spaceafter=\v!none]%
\to \c_floats_every_table_float
+\appendtoks
+ \showmessage\m!floatblocks{14}\v!here
+\to \everyinitializeexport
+
+\def\strc_floats_set_checked_location#location%
+ {\edef\floatlocation{#location}%
+ \ifexporting \ifx\floatlocation\v!here \else
+ \showmessage\m!floatblocks{15}{\floatlocation,\v!here}%
+ \let\floatlocation\v!here
+ \fi \fi}
+
\def\strc_floats_place_indeed[#location][#reference]#caption%
{\strc_floats_reset_variables
- \edef\floatlocation{\ifexporting\v!here\else#location\fi}%
+ \strc_floats_set_checked_location{#location}%
\ifx\floatlocation\empty
\edef\floatlocation{\floatparameter\c!default}% beware of a clash between alignment locations
\fi
@@ -592,7 +603,7 @@
\setexpandedfloatparameter\c!bottomoffset{\floatcaptionparameter\c!bottomoffset}%
\setexpandedfloatparameter\c!freeregion {\floatcaptionparameter\c!freeregion}%
\def\m_strc_floats_saved_userdata{#2}%
- \edef\floatlocation{\ifexporting\v!here\else\floatcaptionparameter\c!location\fi}%
+ \strc_floats_set_checked_location{\floatcaptionparameter\c!location}%
\setfloatcaptionparameter\c!location{\savedfloatlocation}% not expanded
\ifx\floatlocation\empty
\edef\floatlocation{\floatparameter\c!default}%
@@ -1037,10 +1048,13 @@
\unexpanded\def\installfloatmovement#1#2{\setvalue{\??floatmovement#1}{#2}}
+% \def\strc_floats_move_down#setting%
+% {\csname\??floatmovement
+% \ifcsname\??floatmovement#setting\endcsname#setting\fi
+% \endcsname}
+
\def\strc_floats_move_down#setting%
- {\csname\??floatmovement
- \ifcsname\??floatmovement#setting\endcsname#setting\fi
- \endcsname}
+ {\begincsname\??floatmovement#setting\endcsname}
\def\strc_floats_move_down_line#sign%
{\if!!donea \else
@@ -1247,7 +1261,7 @@
\global\floatwidth \wd\floatbox
\global\floatheight \ht\floatbox % forget about the depth
\global\floattextwidth\dimexpr\hsize-\floatwidth-\rootfloatparameter\c!margin\relax
- \edef\floatlocation{\ifexporting\v!here\else\floatlocationmethod\fi}% to be sure .. why
+ \strc_floats_set_checked_location\floatlocationmethod% to be sure .. why
\doifelseinset\v!tall\floatlocationmethod
{\floattextheight\dimexpr\pagegoal-\pagetotal-\bigskipamount\relax % ugly, this bigskip
\ifdim\floattextheight>\textheight
diff --git a/tex/context/base/mkiv/util-jsn.lua b/tex/context/base/mkiv/util-jsn.lua
index e835c07d6..e75b5cf5d 100644
--- a/tex/context/base/mkiv/util-jsn.lua
+++ b/tex/context/base/mkiv/util-jsn.lua
@@ -158,4 +158,11 @@ end
-- inspect(json.tostring(true))
+function json.load(filename)
+ local data = io.loaddata(filename)
+ if data then
+ return lpegmatch(jsonconverter,data)
+ end
+end
+
return json