summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2020-11-07 19:01:53 +0100
committerContext Git Mirror Bot <phg@phi-gamma.net>2020-11-07 19:01:53 +0100
commit52b5a886e13712946a039ffcd059190f49193539 (patch)
tree765d8f940057a2187538d7055edddfd39462f962
parentb9bbb6e068a26d84a2ad31b5f32c289fe03e4f5c (diff)
downloadcontext-52b5a886e13712946a039ffcd059190f49193539.tar.gz
2020-11-07 18:47:00
-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-cs.mkii3
-rw-r--r--tex/context/base/mkiv/buff-ver.mkxl14
-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.mkxl8
-rw-r--r--tex/context/base/mkiv/core-sys.lmt91
-rw-r--r--tex/context/base/mkiv/core-sys.mkxl446
-rw-r--r--tex/context/base/mkiv/font-shp.lua4
-rw-r--r--tex/context/base/mkiv/math-fen.mkxl98
-rw-r--r--tex/context/base/mkiv/node-ref.lua19
-rw-r--r--tex/context/base/mkiv/pack-bck.mklx245
-rw-r--r--tex/context/base/mkiv/pack-rul.mkxl4
-rw-r--r--tex/context/base/mkiv/page-bck.mkxl2
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin29264 -> 29356 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin256564 -> 256482 bytes
-rw-r--r--tex/context/base/mkiv/strc-itm.mklx2
-rw-r--r--tex/context/base/mkiv/strc-pag.mkxl497
-rw-r--r--tex/context/base/mkiv/strc-sbe.mkxl4
-rw-r--r--tex/context/base/mkiv/symb-ini.mkxl9
-rw-r--r--tex/context/base/mkiv/typo-scr.mkxl4
-rw-r--r--tex/context/interface/mkii/keys-cs.xml3
-rw-r--r--tex/context/modules/mkiv/s-system-macros.mkxl2
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua6
25 files changed, 1384 insertions, 85 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 419fdb272..3089bcf23 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{2020.11.07 12:43}
+\newcontextversion{2020.11.07 18:44}
%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 dc5e73cbc..4eb3ed8ce 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{2020.11.07 12:43}
+\edef\contextversion{2020.11.07 18:44}
%D For those who want to use this:
diff --git a/tex/context/base/mkii/mult-cs.mkii b/tex/context/base/mkii/mult-cs.mkii
index c9db70f68..2f38323ef 100644
--- a/tex/context/base/mkii/mult-cs.mkii
+++ b/tex/context/base/mkii/mult-cs.mkii
@@ -283,6 +283,7 @@
\setinterfacevariable{intermezzo}{intermezzo}
\setinterfacevariable{intext}{dotextu}
\setinterfacevariable{intro}{uvod}
+\setinterfacevariable{invertedshort}{invertedshort}
\setinterfacevariable{italic}{kurziva}
\setinterfacevariable{italicbold}{kurzivnitucne}
\setinterfacevariable{item}{polozka}
@@ -386,6 +387,7 @@
\setinterfacevariable{nonumber}{nonumber}
\setinterfacevariable{norepeat}{norepeat}
\setinterfacevariable{normal}{normalni}
+\setinterfacevariable{normalshort}{normalshort}
\setinterfacevariable{nospacing}{nospacing}
\setinterfacevariable{nostopper}{nostopper}
\setinterfacevariable{not}{ne}
@@ -453,6 +455,7 @@
\setinterfacevariable{rectangular}{pravouhly}
\setinterfacevariable{reference}{odkaz}
\setinterfacevariable{referral}{znacka}
+\setinterfacevariable{region}{region}
\setinterfacevariable{register}{rejstrik}
\setinterfacevariable{regular}{pravidelne}
\setinterfacevariable{relative}{relativni}
diff --git a/tex/context/base/mkiv/buff-ver.mkxl b/tex/context/base/mkiv/buff-ver.mkxl
index 48a496fce..565046db7 100644
--- a/tex/context/base/mkiv/buff-ver.mkxl
+++ b/tex/context/base/mkiv/buff-ver.mkxl
@@ -458,7 +458,7 @@
\futureexpandis[\buff_verbatim_typing_start_yes\buff_verbatim_typing_start_nop}
\def\buff_verbatim_typing_start_nop
- {\typingparameter\c!before
+ {\typingparameter\c!before\relax
\startpacked[\v!blank]%
\buff_verbatim_setup_line_numbering
\buff_verbatim_initialize_typing_one
@@ -466,7 +466,7 @@
\normalexpanded{\buff_verbatim_type_block{\e!start\currenttyping}{\e!stop\currenttyping}}}
\def\buff_verbatim_typing_start_yes[#1]%
- {\typingparameter\c!before
+ {\typingparameter\c!before\relax
\startpacked[\v!blank]%
\ifcondition\validassignment{#1}%
\setupcurrenttyping[#1]%
@@ -519,7 +519,7 @@
\protected\def\buff_verbatim_typing_stop#1% hm, currenttyping
{\stoppacked
- \typingparameter\c!after
+ \typingparameter\c!after\relax
\useindentnextparameter\typingparameter
\endgroup
\dorechecknextindentation}
@@ -620,7 +620,7 @@
\def\buff_verbatim_type_file_indeed#1#2% category name
{\edef\currenttyping{#1}%
- \typingparameter\c!before
+ \typingparameter\c!before\relax
\startpacked[\v!blank]
\buff_verbatim_setup_line_numbering
\buff_verbatim_initialize_typing_one
@@ -641,7 +641,7 @@
\endofverbatimlines
\dostoptagged
\stoppacked
- \typingparameter\c!after}
+ \typingparameter\c!after\relax}
%D Line numbering:
@@ -809,7 +809,7 @@
\protected\def\buff_verbatim_type_buffer_indeed#1#2% category name
{\edef\currenttyping{#1}%
- \typingparameter\c!before
+ \typingparameter\c!before\relax
\startpacked[\v!blank]
\buff_verbatim_setup_line_numbering
\buff_verbatim_initialize_typing_one
@@ -831,7 +831,7 @@
\endofverbatimlines
\dostoptagged
\stoppacked
- \typingparameter\c!after}
+ \typingparameter\c!after\relax}
\permanent\protected\def\typeinlinebuffer
{\dontleavehmode
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 2ba6f7b00..f19302817 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.11.07 12:43}
+\newcontextversion{2020.11.07 18:44}
%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 ddd924002..8e5888eb9 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.11.07 12:43}
+\edef\contextversion{2020.11.07 18:44}
%D Kind of special:
diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl
index 4bf8e7ad7..8562fc981 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.11.07 12:43}
+\edef\contextversion{2020.11.07 18:44}
%overloadmode 1 % check frozen / warning
%overloadmode 2 % check frozen / error
@@ -201,7 +201,7 @@
\loadmklxfile{file-syn}
\loadmklxfile{file-mod}
-\loadmarkfile{core-sys}
+\loadmkxlfile{core-sys}
\loadmkxlfile{core-con}
\loadmarkfile{cont-fil}
@@ -242,7 +242,7 @@
\loadmkxlfile{pack-ori}
\loadmkxlfile{pack-rul}
\loadmkxlfile{pack-mrl}
-\loadmkvifile{pack-bck}
+\loadmklxfile{pack-bck}
\loadmarkfile{pack-fen}
\loadmkxlfile{lxml-ini}
@@ -259,7 +259,7 @@
\loadmkxlfile{strc-sbe}
\loadmkvifile{strc-lst}
\loadmkxlfile{strc-sec}
-\loadmarkfile{strc-pag} % hm, depends on core-num
+\loadmkxlfile{strc-pag} % hm, depends on core-num
\loadmarkfile{strc-ren}
\loadmarkfile{strc-xml}
\loadmarkfile{strc-def} % might happen later
diff --git a/tex/context/base/mkiv/core-sys.lmt b/tex/context/base/mkiv/core-sys.lmt
new file mode 100644
index 000000000..12f001e37
--- /dev/null
+++ b/tex/context/base/mkiv/core-sys.lmt
@@ -0,0 +1,91 @@
+if not modules then modules = { } end modules ['core-sys'] = {
+ version = 1.001,
+ comment = "companion to core-sys.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local lower, format, gsub = string.lower, string.format, string.gsub
+local suffixonly, basename, removesuffix = file.suffix, file.basename, file.removesuffix
+
+local environment = environment
+local context = context
+local implement = interfaces.implement
+
+local report_files = logs.reporter("system","files")
+
+function environment.initializefilenames()
+
+ local arguments = environment.arguments
+
+ local jobname = arguments.jobname or tex.jobname
+ local fulljobname = arguments.fulljobname or jobname
+ local inputfilename = arguments.input or fulljobname
+ local outputfilename = arguments.result or removesuffix(jobname)
+
+ local inputfilename = suffixonly(inputfilename) == "tex" and removesuffix(inputfilename) or inputfilename or ""
+
+ local filename = fulljobname
+ local suffix = suffixonly(filename)
+
+ local filename = ctxrunner.resolve(filename) -- in case we're prepped
+
+ local jobfilename = jobname or inputfilename or tex.jobname or ""
+ local inputfilename = inputfilename or ""
+
+ local jobfilebase = basename(jobfilename)
+ local inputfilebase = basename(inputfilename)
+
+ -- jobfilename = gsub(jobfilename, "^./","")
+ -- inputfilename = gsub(inputfilename,"^./","")
+
+ environment.jobfilefullname = fulljobname
+ environment.jobfilename = jobfilebase
+ environment.jobfilesuffix = lower(suffixonly(jobfilebase))
+
+ environment.inputfilename = inputfilename -- so here we keep e.g. ./ or explicit paths
+ environment.inputfilebarename = removesuffix(inputfilebase)
+ environment.inputfilesuffix = lower(suffixonly(inputfilebase))
+
+ environment.outputfilename = outputfilename or environment.inputfilebarename or ""
+
+ environment.filename = filename
+ environment.suffix = suffix
+
+ -- if tex then
+ -- tex.jobname = jobfilename
+ -- end
+
+ report_files("jobname %a, input %a, result %a",jobfilename,inputfilename,outputfilename)
+
+ function environment.initializefilenames() end
+end
+
+-- we could set a macro (but will that work when we're expanding? needs testing!)
+
+implement { name = "operatingsystem", public = true, actions = function() context(os.platform) end }
+implement { name = "jobfilefullname", public = true, actions = function() context(environment.jobfilefullname) end }
+implement { name = "jobfilename", public = true, actions = function() context(environment.jobfilename) end }
+implement { name = "jobfilesuffix", public = true, actions = function() context(environment.jobfilesuffix) end }
+implement { name = "inputfilebarename", public = true, actions = function() context(environment.inputfilebarename) end }
+implement { name = "inputfilerealsuffix", public = true, actions = function() context(environment.inputfilerealsuffix) end }
+implement { name = "inputfilesuffix", public = true, actions = function() context(environment.inputfilesuffix) end }
+implement { name = "inputfilename", public = true, actions = function() context(environment.inputfilename) end }
+implement { name = "outputfilename", public = true, actions = function() context(environment.outputfilename) end }
+
+statistics.register("result saved in file", function()
+ -- suffix will be fetched from backend
+ local outputfilename = environment.outputfilename or environment.jobname or tex.jobname or "<unset>"
+ return lpdf and format("%s.%s, compresslevel %s, objectcompresslevel %s",outputfilename,"pdf",
+ lpdf.getcompression()
+ ) or "error"
+end)
+
+implement {
+ name = "systemlog",
+ arguments = "3 strings",
+ actions = function(whereto,category,text)
+ logs.system(whereto,"context",tex.jobname,category,text)
+ end,
+}
diff --git a/tex/context/base/mkiv/core-sys.mkxl b/tex/context/base/mkiv/core-sys.mkxl
new file mode 100644
index 000000000..c0280033f
--- /dev/null
+++ b/tex/context/base/mkiv/core-sys.mkxl
@@ -0,0 +1,446 @@
+%D \module
+%D [ file=core-sys, % moved from main-001
+%D version=1997.03.31,
+%D title=\CONTEXT\ Core Macros,
+%D subtitle=System,
+%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.
+
+% we need to mkiv-ize this file !
+
+\writestatus{loading}{ConTeXt Core Macros / System}
+
+\registerctxluafile{core-sys}{autosuffix}
+
+\unprotect
+
+%D Version checking:
+
+\permanent\protected\def\newcontextversion#1%
+ {\doifelse{#1}\contextversion
+ {\let\newcontextversion\gobbleoneargument}
+ {\writeline
+ \writestatus{Fatal Error}{Your format does not match the base files!}%
+ \writeline
+ \writestatus{Format Version}{\contextversion\space\contextmark}%
+ \writestatus{Files Version}{#1}%
+ \batchmode
+ \normalend}}
+
+%D End of lines to the output. \TEX\ will map this onto the platform specific
+%D line ending. I hate this mess.
+
+
+% \operatingsystem % defined at lua end
+
+%D The jobname is what gets loaded by the cont-yes stub file. This name also
+%D determines the name of tuc etc files.
+
+% \jobfilefullname % defined at lua end
+% \jobfilename % defined at lua end
+% \jobfilesuffix % defined at lua end
+
+%D However, that one can itself load another file.
+
+% \inputfilebarename % defined at lua end
+% \inputfilerealsuffix % defined at lua end
+% \inputfilesuffix % defined at lua end
+% \inputfilename % defined at lua end
+
+%D The output name is only used for some checking.
+
+% \outputfilename % defined at lua end
+
+\installcorenamespace{system}
+
+\installdirectcommandhandler \??system {system}
+
+\appendtoks
+% \edef\outputfilename {\directsystemparameter\c!file }%
+% \edef\inputfilename {\directsystemparameter\c!inputfile }%
+\to \everysetupsystem
+
+\appendtoks
+ \ifcase\directsystemparameter\c!n\relax
+ % % 0 : unknown
+ \or
+ \setsystemmode\v!first % 1 : first run
+ \or
+ % % 2 : successive run
+ \or
+ \setsystemmode\v!first % 3 : first and only run
+ \or
+ \setsystemmode\v!last % 4 : (extra) last run
+ \fi
+\to \everysetupsystem
+
+\newconditional\prerollrun % when true it means that we have a forced number of runs
+
+% Some mechanisms (see x-res-01) use either \jobfilename or
+% \jobfilename.somesuffix, in which case we need to use the full name if given or a
+% default (like \jobfilename.xml); this comes down to replacing the default tex
+% suffix.
+
+\permanent\def\jobfullname{\jobfilename.\jobfilesuffix}
+
+\permanent\protected\def\setjobfullname#1% #1 = default if not given
+ {\doifelsenothing\jobfilename
+ {\let\jobfullname\empty}
+ {\doif\jobfilesuffix\c!tex{\edef\jobfullname{\jobfilename.#1}}}}
+
+%D There are a couple of system states avaiable:
+%D
+%D \starttabulate [|T|T|]
+%D \NC \type{\jobname} \NC \jobname \NC \NR
+%D \NC \type{\jobfilename} \NC \jobfilename \NC \NR
+%D \NC \type{\jobfilesuffix} \NC \jobfilesuffix \NC \NR
+%D \NC \type{\inputfilename} \NC \inputfilename \NC \NR
+%D \NC \type{\inputfilebarename} \NC \inputfilebarename \NC \NR
+%D \NC \type{\inputfilesuffix} \NC \inputfilesuffix \NC \NR
+%D \NC \type{\outputfilename} \NC \outputfilename \NC \NR
+%D \NC \type{\operatingsystem} \NC \operatingsystem \NC \NR
+%D \stoptabulate
+
+\appendtoks
+ \edef\outputresolution{\directsystemparameter\c!resolution}%
+\to \everysetupsystem
+
+%D The system modes set by the setup command can be used in situations like:
+%D
+%D \starttyping
+%D \startmode[*first]
+%D \executesystemcommand{cleanupxml text.xml clean-text.xml}
+%D \stopmode
+%D
+%D \starttext
+%D \typefile{clean-text.xml}
+%D \stoptext
+%D \stoptyping
+
+\permanent\protected\def\setuprandomize[#1]%
+ {\doifsomething{#1}
+ {\begingroup
+ % tex's time is in minutes
+ \scratchcounter\normaltime
+ \processaction
+ [#1]
+ [ \v!small=>\divide\scratchcounter 15, % 900,
+ \v!medium=>\divide\scratchcounter 30, % 1800,
+ \v!big=>\divide\scratchcounter 60, % 3600,
+ \v!normal=>\getnewrandomseed\scratchcounter,
+ \s!default=>\getnewrandomseed\scratchcounter,
+ \s!unknown=>\scratchcounter#1]%
+ \expanded{\setrandomseed{\the\scratchcounter}}%
+ % \writestatus\m!system{randomseed: \the\scratchcounter}%
+ \endgroup}}
+
+\setupsystem
+ [\c!directory=,
+ \c!n=0, % 0:unknown 1: one run 2: first 3: successive 4: final run
+ \c!resolution=600,% in dpi, no unit in mkiv
+ % \c!random=, % obsolete here
+ % \c!file=\jobname,
+ % \c!inputfile=\outputfilename,
+ \c!type=unix, % windows is normally less sensitive to handle
+ \c!bodyfont=\normalizedlocalbodyfontsize] % of iets anders
+
+%D Remark: windows programs normally handle \type {cr|lf|crlf} but unix is more
+%D picky, so we default to the \type {cr}. I never understood why \type {crlf} was
+%D not used in all systems, since it makes most sense. But anyway, in \MKIV\ we
+%D avoid most of the complications anyway as we deal with much at the \LUA\ end.
+
+\permanent\tolerant\protected\def\start[#1]%
+ {\bgroup
+ \ifparameters
+ \expandafter\syst_start_nop
+ \else
+ \edef\m_syst_start_stop{#1}%
+ \expandafter\syst_start_yes
+ \fi}
+
+\def\syst_start_yes
+ {\ifempty\m_syst_start_stop
+ \let\syst_stop_indeed\donothing
+ \orelse\ifcsname\e!start\m_syst_start_stop\endcsname
+ \expandafter\let\expandafter\syst_stop_indeed\csname\e!stop\m_syst_start_stop\endcsname
+ \csname\e!start\m_syst_start_stop\expandafter\expandafter\expandafter\endcsname
+ \else
+ \let\syst_stop_indeed\donothing
+ \fi}
+
+\def\syst_start_nop
+ {\let\syst_stop_indeed\donothing}
+
+\permanent\protected\def\stop
+ {\syst_stop_indeed
+ \egroup}
+
+% \c!before \c!after \c!inbetween \c!commands \c!style \c!color
+
+\installcorenamespace{startstop}
+
+\installcommandhandler \??startstop {startstop} \??startstop
+
+\appendtoks
+ \frozen\setuevalue{\e!start\currentstartstop}{\syst_startstop_start {\currentstartstop}}%
+ \frozen\setuevalue{\e!stop \currentstartstop}{\syst_startstop_stop {\currentstartstop}}%
+ \frozen\setuevalue {\currentstartstop}{\syst_startstop_indeed{\currentstartstop}}%
+\to \everydefinestartstop
+
+\ifdefined\dotagconstruct \else \let\dotagconstruct\relax \fi
+
+\protected\def\syst_startstop_start#1%
+ {\namedstartstopparameter{#1}\c!before\relax
+ \bgroup
+ \def\currentstartstop{#1}%
+ % we will keep this for a while:
+ \startstopparameter\c!commands\relax % obsolete
+ % this is the new method:
+ \usesetupsparameter\startstopparameter\relax % only in the display version
+ \dostarttagged\t!construct\currentstartstop
+ \usestartstopstyleandcolor\c!style\c!color
+ \dotagconstruct}
+
+\protected\def\syst_startstop_stop#1%
+ {\dostoptagged
+ \egroup
+ \namedstartstopparameter{#1}\c!after\relax}
+
+\protected\def\syst_startstop_indeed#1%
+ {\groupedcommand
+ {\def\currentstartstop{#1}%
+ \startstopparameter\c!commands\relax % better: setups so that will show op soon
+ \dostarttagged\t!construct\currentstartstop
+ \usestartstopstyleandcolor\c!style\c!color
+ \startstopparameter\c!left\relax}
+ {\def\currentstartstop{#1}% safeguard, not really needed
+ \startstopparameter\c!right\relax
+ \dostoptagged
+ \startstopparameter\c!inbetween\relax}}
+
+% \definestartstop[tracing][\c!style=\tt]
+
+% \protected\def\ignorestartstop[#1]%
+% {\protected\expandafter\def\csname\e!start#1\expandafter\endcsname\expandafter
+% {\expandafter\gobbleuntil\csname\e!stop#1\endcsname}}
+%
+% \ignorestartstop[bagger]
+
+\installcorenamespace{highlight}
+
+\installcommandhandler \??highlight {highlight} \??highlight % we could do with less
+
+\setuphighlight
+ [\c!command=\v!yes]
+
+\appendtoks
+ \edef\p_command{\highlightparameter\c!command}%
+ \ifx\p_command\v!yes
+ \frozen\setuevalue\currenthighlight{\typo_highlights_indeed{\currenthighlight}}%
+ \fi
+\to \everydefinehighlight
+
+\ifdefined\dotaghighlight \else \let\dotaghighlight\relax \fi
+
+\permanent\protected\def\typo_highlights_indeed#1% inline style/color switch
+ {\dontleavehmode\groupedcommand % otherwise wrong par number in tags
+ {\def\currenthighlight{#1}%
+ \dostarttagged\t!highlight\currenthighlight
+ \usehighlightstyleandcolor\c!style\c!color
+ \dotaghighlight}
+ {\dostoptagged}}
+
+\permanent\protected\def\highlight[#1]%
+ {\typo_highlights_indeed{#1}}
+
+\permanent\protected\def\starthighlight[#1]%
+ {\begingroup
+ \def\currenthighlight{#1}%
+ \dostarttagged\t!highlight\currenthighlight
+ \usehighlightstyleandcolor\c!style\c!color
+ \dotaghighlight}
+
+\permanent\protected\def\stophighlight
+ {\dostoptagged
+ \endgroup}
+
+\aliased\let\directhighlight\typo_highlights_indeed
+
+\permanent\protected\def\defineexpandable
+ {\doifelsenextoptional
+ {\syst_basics_define_yes\def}%
+ {\syst_basics_define_nop\def}}
+
+\permanent\protected\def\define
+ {\doifelsenextoptional
+ {\syst_basics_define_yes{\protected\def}}%
+ {\syst_basics_define_nop{\protected\def}}}
+
+\protected\def\syst_basics_define_yes#1[#2]#3#4%
+ {\ifdefined#3%
+ \showmessage\m!system4{\string#3}%
+ \fi
+ \ifcase0#2\relax
+ #1#3{#4}\or
+ #1#3##1{#4}\or
+ #1#3##1##2{#4}\or
+ #1#3##1##2##3{#4}\or
+ #1#3##1##2##3##4{#4}\or
+ #1#3##1##2##3##4##5{#4}\or
+ #1#3##1##2##3##4##5##6{#4}\or
+ #1#3##1##2##3##4##5##6##7{#4}\or
+ #1#3##1##2##3##4##5##6##7##8{#4}\or
+ #1#3##1##2##3##4##5##6##7##8##9{#4}\else
+ #1#3{#4}\fi}
+
+\protected\def\syst_basics_define_nop#1#2#3%
+ {\ifdefined#2%
+ \showmessage\m!system4{\string#2}%
+ \fi
+ #1#2{#3}}
+
+% new:
+%
+% \checked\def \whatever#alpha#beta{#alpha + #beta}
+% \checked\edef\whatever#alpha#beta{#alpha + #beta}
+
+\permanent\protected\def\unique#1#2%
+ {\ifdefined#2%
+ \showmessage\m!system4{\string#2}%
+ \expandafter#1\expandafter\gobbleddefinition
+ \else
+ \expandafter#1%
+ \fi#2}
+
+\permanent\protected\def\checked#1#2%
+ {\ifdefined#2%
+ \showmessage\m!system4{\string#2}%
+ \fi
+ #1#2}
+
+% \startluacode
+% local formatters = string.formatters
+% local contextsprint, ctxcatcodes, prtcatcodes = context.sprint, tex.ctxcatcodes, tex.prtcatcodes
+% local match, gmatch, rep = string.match, string.gmatch, string.rep
+% local empty = {
+% "single",
+% "double",
+% "triple",
+% "quadruple",
+% "quintuple",
+% }
+% local check = {
+% "first",
+% "second",
+% "third",
+% "fourth",
+% "fifth",
+% }
+% function commands.define(str)
+% -- we could store the defaults in lua and call lua instead but why bother
+% local arg, cmd = match(str,"(.*)\\(.-)$")
+% local a = { }
+% for s in gmatch(arg,"%[(.-)%]") do
+% a[#a+1] = s
+% end
+% local n = tonumber(a[#a])
+% if n then
+% a[#a] = nil
+% else
+% n = 0
+% end
+% contextsprint(ctxcatcodes,formatters["\\protected\\def\\%s"](cmd))
+% if #a > 0 then
+% contextsprint(prtcatcodes,formatters["{\\do%sempty\\user_defined_%s}"](empty[#a],cmd))
+% contextsprint(prtcatcodes,formatters["\\def\\user_defined_%s"](cmd))
+% for i=1,#a do
+% contextsprint(ctxcatcodes,formatters["[#%s]"](i))
+% end
+% contextsprint(ctxcatcodes,"{")
+% for i=#a,1,-1 do
+% contextsprint(ctxcatcodes,formatters["\\if%sargument"](check[i]))
+% contextsprint(prtcatcodes,formatters["\\def\\next{\\user_defined_indeed_%s"](cmd))
+% for j=1,#a-i do
+% contextsprint(ctxcatcodes,formatters["[%s]"](a[j]))
+% end
+% for j=1,i do
+% contextsprint(ctxcatcodes,formatters["[#%s]"](j))
+% end
+% contextsprint(ctxcatcodes,"}")
+% if i == 1 then
+% contextsprint(ctxcatcodes,rep("\\fi",#a))
+% else
+% contextsprint(ctxcatcodes,"\\else")
+% end
+% end
+% contextsprint(ctxcatcodes,"\\next}")
+% contextsprint(prtcatcodes,formatters["\\def\\user_defined_indeed_%s"](cmd))
+% for i=1,#a do
+% contextsprint(ctxcatcodes,formatters["[#%s]"](i))
+% end
+% end
+% for i=1,n do
+% contextsprint(ctxcatcodes,formatters["#%s"](#a+i))
+% end
+% end
+% \stopluacode
+%
+% \protected\def\define#1#{\ctxcommand{define([[\detokenize{#1}]])}}
+%
+% \starttext
+% \define[2]\whatevera{#1+#2}
+% \whatevera{A}{B}
+% \define[me][too][2]\whateverb{#1+#2+#3+#4}
+% \whateverb[A]{B}{C}
+% \whateverb[A][B]{C}{D}
+% \define[alpha][beta][gamma][delta]\whateverc{#1+#2+#3+#4}
+% \whateverc[P][Q]
+% \stoptext
+
+%D This is a checked variant of \type {\getvalue}.
+
+\permanent\protected\def\macroname#1% brrr
+ {\begincsname#1\endcsname}
+
+% %D A weird one that I probably needed once, so it might as well become
+% %D obsolete.
+%
+% \protected\def\usecommands#1%
+% {\begingroup
+% \def\docommand##1{\setbox\scratchbox\hbox{\csname\string##1\endcsname##1}}%
+% \processcommalist[#1]\docommand
+% \endgroup}
+
+\permanent\protected\def\syst_log_indeed#1#2#3%
+ {\ctxcommand{systemlog("#1","#2",\!!bs#3\!!es)}}
+
+\aliased\let\systemlog\syst_log_indeed
+
+\permanent\protected\def\systemlogfirst
+ {\ifcase\directsystemparameter\c!n\relax
+ \expandafter\syst_log_indeed
+ \or
+ \expandafter\syst_log_indeed
+ \else
+ \expandafter\gobblethreearguments
+ \fi}
+
+\permanent\protected\def\systemloglast
+ {\ifcase\directsystemparameter\c!n\relax
+ \expandafter\syst_log_indeed
+ \or
+ \expandafter\gobblethreearguments
+ \or
+ \expandafter\gobblethreearguments
+ \or
+ \expandafter\gobblethreearguments
+ \or
+ \expandafter\syst_log_indeed
+ \fi}
+
+\protect \endinput
diff --git a/tex/context/base/mkiv/font-shp.lua b/tex/context/base/mkiv/font-shp.lua
index c3fea6d46..78e8597b9 100644
--- a/tex/context/base/mkiv/font-shp.lua
+++ b/tex/context/base/mkiv/font-shp.lua
@@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['font-shp'] = {
local tonumber, next = tonumber, next
local concat = table.concat
-local formatters = string.formatters
+local formatters, lower = string.formatters, string.lower
local otf = fonts.handlers.otf
local afm = fonts.handlers.afm
@@ -221,7 +221,7 @@ end
local function loadstreams(cache,filename,sub,instance)
local base = file.basename(filename)
local name = file.removesuffix(base)
- local kind = file.suffix(filename)
+ local kind = lower(file.suffix(filename))
local attr = lfs.attributes(filename)
local size = attr and attr.size or 0
local time = attr and attr.modification or 0
diff --git a/tex/context/base/mkiv/math-fen.mkxl b/tex/context/base/mkiv/math-fen.mkxl
index 50495cd2b..45a82e6c9 100644
--- a/tex/context/base/mkiv/math-fen.mkxl
+++ b/tex/context/base/mkiv/math-fen.mkxl
@@ -312,41 +312,41 @@
\pushoverloadmode
-\immutable\protected\def\Lparenthesis {\math_fenced_fenced_start{parenthesis}} \protected\def\Rparenthesis {\math_fenced_fenced_stop {parenthesis}}
-\immutable\protected\def\Lbracket {\math_fenced_fenced_start{bracket}} \protected\def\Rbracket {\math_fenced_fenced_stop {bracket}}
-\immutable\protected\def\Lbrace {\math_fenced_fenced_start{brace}} \protected\def\Rbrace {\math_fenced_fenced_stop {brace}}
-\immutable\protected\def\Langle {\math_fenced_fenced_start{angle}} \protected\def\Rangle {\math_fenced_fenced_stop {angle}}
-\immutable\protected\def\Ldoubleangle {\math_fenced_fenced_start{doubleangle}} \protected\def\Rdoubleangle {\math_fenced_fenced_stop {doubleangle}}
-\immutable\protected\def\Lbar {\math_fenced_fenced_start{bar}} \protected\def\Rbar {\math_fenced_fenced_stop {bar}}
-\immutable\protected\def\Ldoublebar {\math_fenced_fenced_start{doublebar}} \protected\def\Rdoublebar {\math_fenced_fenced_stop {doublebar}}
-\immutable\protected\def\Ltriplebar {\math_fenced_fenced_start{triplebar}} \protected\def\Rtriplebar {\math_fenced_fenced_stop {triplebar}}
-\immutable\protected\def\Lsolidus {\math_fenced_fenced_start{solidus}} \protected\def\Rsolidus {\math_fenced_fenced_stop {solidus}}
-\immutable\protected\def\Lfloor {\math_fenced_fenced_start{floor}} \protected\def\Rfloor {\math_fenced_fenced_stop {floor}}
-\immutable\protected\def\Lceiling {\math_fenced_fenced_start{ceiling}} \protected\def\Rceiling {\math_fenced_fenced_stop {ceiling}}
-\immutable\protected\def\Lmoustache {\math_fenced_fenced_start{moustache}} \protected\def\Rmoustache {\math_fenced_fenced_stop {moustache}}
-\immutable\protected\def\Luppercorner {\math_fenced_fenced_start{uppercorner}} \protected\def\Ruppercorner {\math_fenced_fenced_stop {uppercorner}}
-\immutable\protected\def\Llowercorner {\math_fenced_fenced_start{lowercorner}} \protected\def\Rlowercorner {\math_fenced_fenced_stop {lowercorner}}
-\immutable\protected\def\Lgroup {\math_fenced_fenced_start{group}} \protected\def\Rgroup {\math_fenced_fenced_stop {group}}
-\immutable\protected\def\Lopenbracket {\math_fenced_fenced_start{openbracket}} \protected\def\Ropenbracket {\math_fenced_fenced_stop {openbracket}}
-\immutable\protected\def\Lnothing {\math_fenced_fenced_start{nothing}} \protected\def\Rnothing {\math_fenced_fenced_stop {nothing}}
-
-\immutable\protected\def\Lparenthesismirrored {\math_fenced_fenced_stop {mirroredparenthesis}} \protected\def\Rparenthesismirrored {\math_fenced_fenced_start{mirroredparenthesis}}
-\immutable\protected\def\Lbracketmirrored {\math_fenced_fenced_stop {mirroredbracket}} \protected\def\Rbracketmirrored {\math_fenced_fenced_start{mirroredbracket}}
-\immutable\protected\def\Lbracemirrored {\math_fenced_fenced_stop {mirroredbrace}} \protected\def\Rbracemirrored {\math_fenced_fenced_start{mirroredbrace}}
-\immutable\protected\def\Langlemirrored {\math_fenced_fenced_stop {mirroredangle}} \protected\def\Ranglemirrored {\math_fenced_fenced_start{mirroredangle}}
-\immutable\protected\def\Ldoubleanglemirrored {\math_fenced_fenced_stop {mirroreddoubleangle}} \protected\def\Rdoubleanglemirrored {\math_fenced_fenced_start{mirroreddoubleangle}}
-\immutable\protected\def\Lbarmirrored {\math_fenced_fenced_stop {mirroredbar}} \protected\def\Rbarmirrored {\math_fenced_fenced_start{mirroredbar}}
-\immutable\protected\def\Ldoublebarmirrored {\math_fenced_fenced_stop {mirroreddoublebar}} \protected\def\Rdoublebarmirrored {\math_fenced_fenced_start{mirroreddoublebar}}
-\immutable\protected\def\Ltriplebarmirrored {\math_fenced_fenced_stop {mirroredtriplebar}} \protected\def\Rtriplebarmirrored {\math_fenced_fenced_start{mirroredtriplebar}}
-\immutable\protected\def\Lsolidusmirrored {\math_fenced_fenced_stop {mirroredsolidus}} \protected\def\Rsolidusmirrored {\math_fenced_fenced_start{mirroredsolidus}}
-\immutable\protected\def\Lfloormirrored {\math_fenced_fenced_stop {mirroredfloor}} \protected\def\Rfloormirrored {\math_fenced_fenced_start{mirroredfloor}}
-\immutable\protected\def\Lceilingmirrored {\math_fenced_fenced_stop {mirroredceiling}} \protected\def\Rceilingmirrored {\math_fenced_fenced_start{mirroredceiling}}
-\immutable\protected\def\Lmoustachemirrored {\math_fenced_fenced_stop {mirroredmoustache}} \protected\def\Rmoustachemirrored {\math_fenced_fenced_start{mirroredmoustache}}
-\immutable\protected\def\Luppercornermirrored {\math_fenced_fenced_stop {mirroreduppercorner}} \protected\def\Ruppercornermirrored {\math_fenced_fenced_start{mirroreduppercorner}}
-\immutable\protected\def\Llowercornermirrored {\math_fenced_fenced_stop {mirroredlowercorner}} \protected\def\Rlowercornermirrored {\math_fenced_fenced_start{mirroredlowercorner}}
-\immutable\protected\def\Lgroupmirrored {\math_fenced_fenced_stop {mirroredgroup}} \protected\def\Rgroupmirrored {\math_fenced_fenced_start{mirroredgroup}}
-\immutable\protected\def\Lopenbracketmirrored {\math_fenced_fenced_stop {mirroredopenbracket}} \protected\def\Ropenbracketmirrored {\math_fenced_fenced_start{mirroredopenbracket}}
-\immutable\protected\def\Lnothingmirrored {\math_fenced_fenced_stop {mirrorednothing}} \protected\def\Rnothingmirrored {\math_fenced_fenced_start{mirrorednothing}}
+\immutable\protected\def\Lparenthesis {\math_fenced_fenced_start{parenthesis}} \immutable\protected\def\Rparenthesis {\math_fenced_fenced_stop {parenthesis}}
+\immutable\protected\def\Lbracket {\math_fenced_fenced_start{bracket}} \immutable\protected\def\Rbracket {\math_fenced_fenced_stop {bracket}}
+\immutable\protected\def\Lbrace {\math_fenced_fenced_start{brace}} \immutable\protected\def\Rbrace {\math_fenced_fenced_stop {brace}}
+\immutable\protected\def\Langle {\math_fenced_fenced_start{angle}} \immutable\protected\def\Rangle {\math_fenced_fenced_stop {angle}}
+\immutable\protected\def\Ldoubleangle {\math_fenced_fenced_start{doubleangle}} \immutable\protected\def\Rdoubleangle {\math_fenced_fenced_stop {doubleangle}}
+\immutable\protected\def\Lbar {\math_fenced_fenced_start{bar}} \immutable\protected\def\Rbar {\math_fenced_fenced_stop {bar}}
+\immutable\protected\def\Ldoublebar {\math_fenced_fenced_start{doublebar}} \immutable\protected\def\Rdoublebar {\math_fenced_fenced_stop {doublebar}}
+\immutable\protected\def\Ltriplebar {\math_fenced_fenced_start{triplebar}} \immutable\protected\def\Rtriplebar {\math_fenced_fenced_stop {triplebar}}
+\immutable\protected\def\Lsolidus {\math_fenced_fenced_start{solidus}} \immutable\protected\def\Rsolidus {\math_fenced_fenced_stop {solidus}}
+\immutable\protected\def\Lfloor {\math_fenced_fenced_start{floor}} \immutable\protected\def\Rfloor {\math_fenced_fenced_stop {floor}}
+\immutable\protected\def\Lceiling {\math_fenced_fenced_start{ceiling}} \immutable\protected\def\Rceiling {\math_fenced_fenced_stop {ceiling}}
+\immutable\protected\def\Lmoustache {\math_fenced_fenced_start{moustache}} \immutable\protected\def\Rmoustache {\math_fenced_fenced_stop {moustache}}
+\immutable\protected\def\Luppercorner {\math_fenced_fenced_start{uppercorner}} \immutable\protected\def\Ruppercorner {\math_fenced_fenced_stop {uppercorner}}
+\immutable\protected\def\Llowercorner {\math_fenced_fenced_start{lowercorner}} \immutable\protected\def\Rlowercorner {\math_fenced_fenced_stop {lowercorner}}
+\immutable\protected\def\Lgroup {\math_fenced_fenced_start{group}} \immutable\protected\def\Rgroup {\math_fenced_fenced_stop {group}}
+\immutable\protected\def\Lopenbracket {\math_fenced_fenced_start{openbracket}} \immutable\protected\def\Ropenbracket {\math_fenced_fenced_stop {openbracket}}
+\immutable\protected\def\Lnothing {\math_fenced_fenced_start{nothing}} \immutable\protected\def\Rnothing {\math_fenced_fenced_stop {nothing}}
+
+\immutable\protected\def\Lparenthesismirrored {\math_fenced_fenced_stop {mirroredparenthesis}} \immutable\protected\def\Rparenthesismirrored {\math_fenced_fenced_start{mirroredparenthesis}}
+\immutable\protected\def\Lbracketmirrored {\math_fenced_fenced_stop {mirroredbracket}} \immutable\protected\def\Rbracketmirrored {\math_fenced_fenced_start{mirroredbracket}}
+\immutable\protected\def\Lbracemirrored {\math_fenced_fenced_stop {mirroredbrace}} \immutable\protected\def\Rbracemirrored {\math_fenced_fenced_start{mirroredbrace}}
+\immutable\protected\def\Langlemirrored {\math_fenced_fenced_stop {mirroredangle}} \immutable\protected\def\Ranglemirrored {\math_fenced_fenced_start{mirroredangle}}
+\immutable\protected\def\Ldoubleanglemirrored {\math_fenced_fenced_stop {mirroreddoubleangle}} \immutable\protected\def\Rdoubleanglemirrored {\math_fenced_fenced_start{mirroreddoubleangle}}
+\immutable\protected\def\Lbarmirrored {\math_fenced_fenced_stop {mirroredbar}} \immutable\protected\def\Rbarmirrored {\math_fenced_fenced_start{mirroredbar}}
+\immutable\protected\def\Ldoublebarmirrored {\math_fenced_fenced_stop {mirroreddoublebar}} \immutable\protected\def\Rdoublebarmirrored {\math_fenced_fenced_start{mirroreddoublebar}}
+\immutable\protected\def\Ltriplebarmirrored {\math_fenced_fenced_stop {mirroredtriplebar}} \immutable\protected\def\Rtriplebarmirrored {\math_fenced_fenced_start{mirroredtriplebar}}
+\immutable\protected\def\Lsolidusmirrored {\math_fenced_fenced_stop {mirroredsolidus}} \immutable\protected\def\Rsolidusmirrored {\math_fenced_fenced_start{mirroredsolidus}}
+\immutable\protected\def\Lfloormirrored {\math_fenced_fenced_stop {mirroredfloor}} \immutable\protected\def\Rfloormirrored {\math_fenced_fenced_start{mirroredfloor}}
+\immutable\protected\def\Lceilingmirrored {\math_fenced_fenced_stop {mirroredceiling}} \immutable\protected\def\Rceilingmirrored {\math_fenced_fenced_start{mirroredceiling}}
+\immutable\protected\def\Lmoustachemirrored {\math_fenced_fenced_stop {mirroredmoustache}} \immutable\protected\def\Rmoustachemirrored {\math_fenced_fenced_start{mirroredmoustache}}
+\immutable\protected\def\Luppercornermirrored {\math_fenced_fenced_stop {mirroreduppercorner}} \immutable\protected\def\Ruppercornermirrored {\math_fenced_fenced_start{mirroreduppercorner}}
+\immutable\protected\def\Llowercornermirrored {\math_fenced_fenced_stop {mirroredlowercorner}} \immutable\protected\def\Rlowercornermirrored {\math_fenced_fenced_start{mirroredlowercorner}}
+\immutable\protected\def\Lgroupmirrored {\math_fenced_fenced_stop {mirroredgroup}} \immutable\protected\def\Rgroupmirrored {\math_fenced_fenced_start{mirroredgroup}}
+\immutable\protected\def\Lopenbracketmirrored {\math_fenced_fenced_stop {mirroredopenbracket}} \immutable\protected\def\Ropenbracketmirrored {\math_fenced_fenced_start{mirroredopenbracket}}
+\immutable\protected\def\Lnothingmirrored {\math_fenced_fenced_stop {mirrorednothing}} \immutable\protected\def\Rnothingmirrored {\math_fenced_fenced_start{mirrorednothing}}
\definemathfence [interval] [\c!left="2997,\c!right="2998]
\definemathfence [openinterval] [interval] [\c!left="2998,\c!right="2998]
@@ -511,23 +511,23 @@
\pushoverloadmode
-\let\lbrack \lbracket
-\let\rbrack \rbracket
-\let\lceiling \lceil
-\let\rceiling \rceil
-\let\lparenthesis\lparent
-\let\rparenthesis\rparent
-\let\lparen \lparent
-\let\rparen \rparent
+\aliased\let\lbrack \lbracket
+\aliased\let\rbrack \rbracket
+\aliased\let\lceiling \lceil
+\aliased\let\rceiling \rceil
+\aliased\let\lparenthesis\lparent
+\aliased\let\rparenthesis\rparent
+\aliased\let\lparen \lparent
+\aliased\let\rparen \rparent
% Just defined:
-\let\Lceil \Lceiling
-\let\Rceil \Rceiling
-\let\Lparent\Lparenthesis
-\let\Rparent\Rparenthesis
-\let\Lparen \Lparenthesis
-\let\Rparen \Rparenthesis
+\aliased\let\Lceil \Lceiling
+\aliased\let\Rceil \Rceiling
+\aliased\let\Lparent\Lparenthesis
+\aliased\let\Rparent\Rparenthesis
+\aliased\let\Lparen \Lparenthesis
+\aliased\let\Rparen \Rparenthesis
\installmathfencepair \lbrace \Lbrace \rbrace \Rbrace
\installmathfencepair \lbracket \Lbracket \rbracket \Rbracket
diff --git a/tex/context/base/mkiv/node-ref.lua b/tex/context/base/mkiv/node-ref.lua
index 2094fc2c7..e0bd35f6b 100644
--- a/tex/context/base/mkiv/node-ref.lua
+++ b/tex/context/base/mkiv/node-ref.lua
@@ -98,6 +98,7 @@ local par_code = nodecodes.par
local leftskip_code = gluecodes.leftskip
local rightskip_code = gluecodes.rightskip
+local parfillleftskip_code = gluecodes.parfillleftskip
local parfillskip_code = gluecodes.parfillskip
----- linelist_code = listcodes.line
@@ -323,7 +324,8 @@ local function inject_list(id,current,reference,make,stack,pardir,txtdir)
local last = find_node_tail(first)
if getid(last) == glue_code and getsubtype(last) == rightskip_code then
local prev = getprev(last)
- moveright = getid(first) == glue_code and getsubtype(first) == leftskip_code
+ -- this can be more clever
+ moveright = getid(first) == glue_code and (getsubtype(first) == leftskip_code or getsubtype(first) == parfillleftskip_code)
if prev and getid(prev) == glue_code and getsubtype(prev) == parfillskip_code then
width = dimensions(current,first,getprev(prev)) -- maybe not current as we already take care of it
else
@@ -415,8 +417,6 @@ local function inject_areas(head,attribute,make,stack,done,skip,parent,pardir,tx
if r then
done[r] = done[r] - 1
end
- elseif id == glue_code and getsubtype(current) == leftskip_code then -- any glue at the left?
- --
elseif id == dir_code then
local direction, pop = getdirection(current)
txtdir = not pop and direction -- we might need a stack
@@ -424,7 +424,17 @@ local function inject_areas(head,attribute,make,stack,done,skip,parent,pardir,tx
if start_of_par(current) then
pardir = getdirection(current)
end
+ elseif id == glue_code and getsubtype(current) == leftskip_code then -- any glue at the left?
+ --
else
+ if id == glue_code then
+ local subtype = getsubtype(current)
+ if subtype == leftskip_code or subtype == parfillleftskip_code then
+ goto NEXT
+ elseif subtype == rightskip_code or subtype == parfillskip_code then
+ goto NEXT
+ end
+ end
local r = getattr(current,attribute)
if not r then
-- just go on, can be kerns
@@ -432,7 +442,7 @@ local function inject_areas(head,attribute,make,stack,done,skip,parent,pardir,tx
reference, first, last, firstdir = r, current, current, txtdir
elseif r == reference then
last = current
- elseif (done[reference] or 0) == 0 then -- or id == glue_code and getsubtype(current) == right_skip_code
+ elseif (done[reference] or 0) == 0 then -- or (id == glue_code and getsubtype(current) == right_skip_code) then
if not skip or r > skip then -- maybe no > test
head, current = inject_range(head,first,last,reference,make,stack,parent,pardir,firstdir)
reference, first, last, firstdir = nil, nil, nil, nil
@@ -441,6 +451,7 @@ local function inject_areas(head,attribute,make,stack,done,skip,parent,pardir,tx
reference, first, last, firstdir = r, current, current, txtdir
end
end
+ ::NEXT::
current = getnext(current)
end
if reference and (done[reference] or 0) == 0 then
diff --git a/tex/context/base/mkiv/pack-bck.mklx b/tex/context/base/mkiv/pack-bck.mklx
new file mode 100644
index 000000000..3c15beb5f
--- /dev/null
+++ b/tex/context/base/mkiv/pack-bck.mklx
@@ -0,0 +1,245 @@
+%D \module
+%D [ file=pack-bck, % moved from pack-rul,
+%D version=20111115, % 1998.10.16,
+%D title=\CONTEXT\ Packaging Macros,
+%D subtitle=Simple Backgrounds,
+%D author=Hans Hagen \& Wolfgang Schuster,
+%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 Packaging Macros / Simple Backgrounds}
+
+%D The code here is already pretty old and is used for simple backgrounds. As it is
+%D still used WS adapted the code to the new command handler methods so that it gets
+%D a second life. So it made sense to mkvi as well. Some more code is moved here
+%D too.
+
+%D \macros
+%D {setupbackground,startbackground,background}
+%D
+%D The section deals with backgrounds in the running text. This means that texts is
+%D to be collected and split over pages. To show what can be done, we provide this
+%D part of the documentation with some gray background and a red frame. Both the
+%D background and frame can have all characteristics of \type {\framed}.
+%D
+%D \starttyping
+%D \setupbackground
+%D [backgroundoffset=4pt,
+%D background=color,
+%D frame=on,
+%D framecolor=red,
+%D leftoffset=2pt]
+%D \stoptyping
+%D
+%D The implementation is not that sophisticated, but suffices. The main problem with
+%D this kind of functionality is to get the spacing all right.
+%D
+%D Specifying the background is more or less the same as
+%D specifying a framed box.
+%D
+%D \showsetup{setupbackground}
+%D
+%D {\em This mechanism is sort of obsolete and textbackgrounds should be used
+%D instead.}
+
+\unprotect
+
+\installcorenamespace {background}
+
+\installframedcommandhandler \??background {background} \??background
+
+% The mode is not that public an dmostlu an initial mode:
+%
+% 0 : no split
+% 1 : no split, honoring leftskip (messy)
+% 2 : split
+% 3 : split, honoring leftskip (messy)
+%
+% While processing the modes will change from 3->1 or 2->0. Don't depend on the
+% mode being public currently as it could become a key.
+
+\setnewconstant\backgroundsplitmode\plusthree
+
+\appendtoks
+ \frozen\setuevalue{\e!start\currentbackground}{\pack_backgrounds_start [\currentbackground]}%
+ \frozen\setuevalue{\e!stop \currentbackground}{\pack_backgrounds_stop }%
+ \frozen\setuevalue {\currentbackground}{\pack_backgrounds_direct[\currentbackground]}%
+\to \everydefinebackground
+
+\protected\def\pack_backgrounds_start[#tag]%
+ {\endgraf
+ \begingroup
+ \def\currentbackground{#tag}%
+ \doifelse{\backgroundparameter\c!state}\v!start
+ \pack_backgrounds_start_indeed
+ \pack_backgrounds_start_ignore}
+
+\tolerant\def\pack_backgrounds_start_indeed[#settings]%
+ {\setupcurrentbackground[#settings,\c!state=\v!start,\c!offset=\v!overlay]%
+ \let\pack_backgrounds_stop\pack_backgrounds_stop_indeed
+ \setbox\scratchboxone\vbox\bgroup
+ \strut
+ \vskip-2\lineheight
+ \strut
+ \blank[\v!disable]
+ \leftskip \backgroundparameter\c!leftoffset
+ \rightskip\backgroundparameter\c!rightoffset}
+
+\tolerant\def\pack_backgrounds_start_ignore[#settings]%
+ {\let\pack_backgrounds_stop\pack_backgrounds_stop_ignore}
+
+\let\pack_backgrounds_stop\relax
+
+\protected\def\pack_backgrounds_stop_indeed % we shoul duse the fast background variant of framed
+ {\endgraf
+ \removelastskip
+ \strut
+ \vskip-2\lineheight
+ \strut
+ % safeguard added
+ \ifdim\dimexpr\pagetotal+2\lineheight\relax>\pagegoal
+ \page
+ \fi
+ % till here
+ \egroup
+ \scratchdistance\leftskip % new **
+ \forgetall
+ \ifinsidefloat
+ \backgroundsplitmode\zerocount
+ \fi
+ \ifcase\backgroundsplitmode
+ \inheritedbackgroundframed{\box\scratchboxone}%
+ \or
+ \hskip\scratchdistance
+ \inheritedbackgroundframed{\box\scratchboxone}%
+ \else
+ \splitmaxdepth\boxmaxdepth
+ \splittopskip\topskip
+ \doloop
+ {\ifzeropt\pagetotal % empty page
+ \scratchdimen\textheight
+ \backgroundsplitmode\plusone % split to max height
+ \else
+ \setbox\scratchdimentwo\vbox{\backgroundparameter\c!before}%
+ \scratchdimen\dimexpr\pagegoal-\ht\scratchdimentwo-\pagetotal\relax
+ \backgroundsplitmode\plustwo % split to partial height
+ \fi
+ \ifdim\scratchdimen<\zeropoint
+ \scratchdimen\pagegoal
+ \fi
+ \advance\scratchdimen\dimexpr
+ -\backgroundparameter\c!topoffset
+ -\backgroundparameter\c!bottomoffset
+ \relax
+ \ifdim\scratchdimen>2\lineheight\relax % reasonable, will be configurable
+ \ifdim\ht\scratchboxone>\scratchdimen % larger than page
+ \setbox\scratchdimentwo\vsplit\scratchboxone to \scratchdimen
+ \else
+ \setbox\scratchdimentwo\box\scratchboxone
+ \backgroundsplitmode\zerocount % no split
+ \fi
+ \setbox\scratchdimentwo\vbox \ifcase\backgroundsplitmode\or to \textheight \fi % max split
+ {\vskip\backgroundparameter\c!topoffset
+ \unvcopy\scratchdimentwo
+ \prevdepth\dp\scratchdimentwo
+ \obeydepth
+ \vskip\backgroundparameter\c!bottomoffset
+ \vfill}
+ \backgroundparameter\c!before
+ \ifcase\backgroundsplitmode\or\or % partial split
+ \ifdim\pagegoal<\maxdimen
+ \pagegoal=1.2\pagegoal % be a bit more tolerant
+ \fi
+ \fi
+ \startlinecorrection
+ \ifnum\backgroundsplitmode=\plusthree
+ \hskip\scratchdistance % new **
+ \fi
+ \inheritedbackgroundframed{\box\scratchdimentwo}%
+ \stoplinecorrection
+ \ifcase\backgroundsplitmode % no split
+ \backgroundparameter\c!after
+ \else % some split
+ \page_otr_fill_and_eject_page % no \page !
+ \fi
+ \else
+ \page
+ \fi
+ \ifdim\ht\scratchboxone>\zeropoint \else
+ \exitloop
+ \fi}%
+ \fi
+ \endgroup
+ \endgraf}
+
+\protected\def\pack_backgrounds_stop_ignore
+ {\endgroup
+ \endgraf}
+
+\protected\def\pack_backgrounds_direct[#tag]%
+ {\begingroup
+ \def\currentbackground{#tag}%
+ \doifelse{\backgroundparameter\c!state}\c!start
+ \pack_backgrounds_direct_indeed
+ \pack_backgrounds_direct_ignore}
+
+\def\pack_backgrounds_direct_indeed
+ {\dowithnextboxcs\pack_backgrounds_direct_finish\vbox}
+
+\def\pack_backgrounds_direct_finish
+ {\setupcurrentbackground[\c!offset=\v!overlay]%
+ \inheritedbackgroundframed{\flushnextbox}%
+ \endgroup}
+
+\def\pack_backgrounds_direct_ignore
+ {\endgroup}
+
+\definebackground[\v!background]
+
+\ifdefined\startbackground \else
+ \permanent\expandafter\let\expandafter\startbackground\csname\e!start\v!background\endcsname
+ \permanent\expandafter\let\expandafter\stopbackground \csname\e!stop \v!background\endcsname
+ \permanent\expandafter\let\expandafter\background \csname \v!background\endcsname
+\fi
+
+\setupbackground
+ [\c!leftoffset=.5\bodyfontsize,
+ \c!rightoffset=\backgroundparameter\c!leftoffset,
+ \c!topoffset=\zeropoint,
+ \c!bottomoffset=\backgroundparameter\c!topoffset,
+ \c!state=\v!start,
+ \c!radius=.5\bodyfontsize,
+ \c!corner=\v!rectangular,
+ \c!frame=\v!off,
+ \c!depth=\zeropoint,
+ % \c!color=,
+ \c!background=\v!color,
+ \c!backgroundcolor=lightgray,
+ \c!before=,
+ \c!after=]
+
+%D \startbuffer
+%D \setupbackground[state=start,frame=on]
+%D
+%D \startbackground
+%D \input ward
+%D \stopbackground
+%D
+%D \background{\input ward\par}
+%D
+%D \setupbackground[state=stop]
+%D
+%D \startbackground
+%D \input ward
+%D \stopbackground
+%D
+%D \background{\input ward\par}
+%D \stopbuffer
+%D
+%D \typebuffer \getbuffer
+
+\protect \endinput
diff --git a/tex/context/base/mkiv/pack-rul.mkxl b/tex/context/base/mkiv/pack-rul.mkxl
index 126e5c5d3..8ab327c79 100644
--- a/tex/context/base/mkiv/pack-rul.mkxl
+++ b/tex/context/base/mkiv/pack-rul.mkxl
@@ -82,8 +82,8 @@
\expandafter\noexpand\csname inherited#1framedbox\endcsname}} % new
\protected\def\doinstallinheritedframed#1#2#3#4#5#6#7#8#9%
- {\enforced\def#5##1##2{\ifx##1\relax#6{##2}\else#4{##1}{##2}\fi}%
- \enforced\def#6##1{\ifcsname\??framed:##1\endcsname\??framed:##1\else\??empty\fi}% root
+ {\enforced\frozen\def#5##1##2{\ifx##1\relax#6{##2}\else#4{##1}{##2}\fi}%
+ \enforced\frozen\def#6##1{\ifcsname\??framed:##1\endcsname\??framed:##1\else\??empty\fi}% root
\frozen\instance\protected\def#8%
{\bgroup
\bgroup
diff --git a/tex/context/base/mkiv/page-bck.mkxl b/tex/context/base/mkiv/page-bck.mkxl
index 3db063dca..94e4f4a95 100644
--- a/tex/context/base/mkiv/page-bck.mkxl
+++ b/tex/context/base/mkiv/page-bck.mkxl
@@ -41,7 +41,7 @@
\fi
\to \everybeforepagebody
-\protected\def\initializepagebackgrounds
+\permanent\protected\def\initializepagebackgrounds
{\setfalse\c_page_backgrounds_new
\setfalse\c_page_backgrounds_new_right
\setfalse\c_page_backgrounds_new_left
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index a23f4712b..d9a49b9af 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 c6cbc4ea7..b9de0083b 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-itm.mklx b/tex/context/base/mkiv/strc-itm.mklx
index b7f9cc6d5..e2388eeec 100644
--- a/tex/context/base/mkiv/strc-itm.mklx
+++ b/tex/context/base/mkiv/strc-itm.mklx
@@ -809,7 +809,7 @@
\or
\strc_itemgroups_start_indeed{}%
\or
- \ifcondition\validassignment{#options}%
+ \ifhastok={#options}%
\strc_itemgroups_start_indeed{#options}%
\else
\edef\itemgroupextraoptions{#options}%
diff --git a/tex/context/base/mkiv/strc-pag.mkxl b/tex/context/base/mkiv/strc-pag.mkxl
new file mode 100644
index 000000000..07ac30d26
--- /dev/null
+++ b/tex/context/base/mkiv/strc-pag.mkxl
@@ -0,0 +1,497 @@
+%D \module
+%D [ file=strc-pag,
+%D version=2008.10.20,
+%D title=\CONTEXT\ Structure Macros,
+%D subtitle=Pagenumbering,
+%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 Structure Macros / Pagenumbering}
+
+\registerctxluafile{strc-pag}{}
+
+\unprotect
+
+\startcontextdefinitioncode
+
+% Allocation:
+
+\ifdefined\realpageno \else \permanent\countdef\realpageno \zerocount \fi \realpageno \plusone
+\ifdefined\userpageno \else \permanent\countdef\userpageno \plusone \fi \userpageno \plusone
+\ifdefined\subpageno \else \permanent\countdef\subpageno \plustwo \fi \subpageno \plusone % was \zerocount but that doesn't work well with bytext
+\ifdefined\arrangeno \else \permanent\countdef\arrangeno \plusthree \fi \arrangeno \zerocount % !
+\ifdefined\pagenoshift \else \permanent\countdef\pagenoshift\plusfour \fi \pagenoshift\zerocount % !
+\ifdefined\lastpageno \else \permanent\countdef\lastpageno \plusfive \fi \lastpageno \zerocount % !
+
+\ifdefined\pageno \else \aliased\let\pageno\userpageno \fi
+
+\def\realfolio{\the\realpageno}
+\def\userfolio{\the\userpageno}
+\def\subfolio {\the\subpageno }
+\def\lastfolio{\the\lastpageno}
+
+\newtoks\everyinitializepagecounters
+
+\protected\def\initializepagecounters
+ {\the\everyinitializepagecounters}
+
+\appendtoks
+ \initializepagecounters
+\to \everyjob
+
+% Page numbers are kind of independent of each other and therefore they
+% all get their own counter. After all, it's easier to combine them in
+% a pseudo counterset than to deal with a complex set itself.
+
+% \defineprefixset [mine][section-1,section-2]
+% \defineseparatorset[mine][:]
+%
+% \setupuserpagenumber
+% [way=bypart,
+% prefix=yes,
+% prefixset=mine,
+% prefixseparatorset=mine]
+
+% \defineconversionset[frontpart:pagenumber][][romannumerals]
+% \defineconversionset[bodypart:pagenumber] [][numbers]
+%
+% \setupuserpagenumber[way=byblock]
+% \setupuserpagenumber[way=bychapter]
+% \setupuserpagenumber[numberconversionset=pagenumber]
+%
+% \starttext
+% \startfrontmatter
+% \completecontent[criterium=all]
+% \chapter{tufte} \section{one} \input tufte \page \section{two} \input tufte \page
+% \chapter{tufte} \section{one} \input tufte \page \section{two} \input tufte \page
+% \stopfrontmatter
+% \startbodymatter
+% \chapter{knuth} \section{one} \input knuth \page \section{two} \input knuth \page \section{three} \input knuth \page
+% \chapter{knuth} \section{one} \input knuth \page \section{two} \input knuth \page \section{three} \input knuth \page
+% \stopbodymatter
+% \stoptext
+
+\definecounter[\s!realpage][\c!prefix=\v!no,\c!start=\plusone,\c!prefixsegments=,\s!counter=realpageno,\c!method=\v!page]
+\definecounter[\s!userpage][\c!prefix=\v!no,\c!start=\plusone,\c!prefixsegments=,\s!counter=userpageno,\c!method=\v!page]
+\definecounter[\s!subpage] [\c!prefix=\v!no,\c!start=\plusone,\c!prefixsegments=,\s!counter=subpageno, \c!method=\v!page]
+
+\newtoks\everysetuprealpagenumber % todo: set state: none, start, stop, reset
+\newtoks\everysetupuserpagenumber % todo: set state: none, start, stop, reset
+\newtoks\everysetupsubpagenumber % todo: set state: none, start, stop, reset
+
+\let\m_strc_pagenumbers_state_old\zerocount
+\let\m_strc_pagenumbers_state_new\zerocount
+
+\def\strc_pagenumbers_save_state#1{\edef\m_strc_pagenumbers_state_old{\namedcounterparameter#1\c!state}}
+
+\permanent\tolerant\protected\def\setuprealpagenumber[#1]{\strc_pagenumbers_save_state\s!realpage\setupcounter[\s!realpage][#1]\the\everysetuprealpagenumber}
+\permanent\tolerant\protected\def\setupuserpagenumber[#1]{\strc_pagenumbers_save_state\s!userpage\setupcounter[\s!userpage][#1]\the\everysetupuserpagenumber}
+\permanent\tolerant\protected\def\setupsubpagenumber [#1]{\strc_pagenumbers_save_state\s!subpage \setupcounter[\s!subpage ][#1]\the\everysetupsubpagenumber }
+
+\permanent\protected\def\resetrealpagenumber {} % not permitted
+\permanent\protected\def\resetuserpagenumber {\strc_counters_reset\s!userpage}
+\permanent\protected\def\resetsubpagenumber {\strc_counters_reset\s!subpage}
+
+\appendtoks
+ \strc_counters_set\s!realpage\realpageno
+ \strc_counters_set\s!userpage\userpageno
+ \strc_counters_set\s!subpage \subpageno
+ \lastpageno\lastcountervalue[\s!realpage]\relax
+\to \everyinitializepagecounters
+
+\aliased\let\setuppagenumber\setupuserpagenumber
+\aliased\let\resetpagenumber\resetuserpagenumber
+
+% invisible =
+
+\def\strc_pagenumbers_page_state_save % \normalexpanded?
+ {\clf_savepagedata
+ {
+ prefix {\namedcounterparameter\s!userpage\c!prefix}
+ separatorset {\namedcounterparameter\s!userpage\c!prefixseparatorset}
+ conversion {\namedcounterparameter\s!userpage\c!prefixconversion}
+ conversionset {\namedcounterparameter\s!userpage\c!prefixconversionset}
+ set {\namedcounterparameter\s!userpage\c!prefixset}
+ segments {\namedcounterparameter\s!userpage\c!prefixsegments}
+ connector {\namedcounterparameter\s!userpage\c!prefixconnector}
+ }{
+ conversion {\namedcounterparameter\s!userpage\c!numberconversion}
+ conversionset {\namedcounterparameter\s!userpage\c!numberconversionset}
+ starter {\namedcounterparameter\s!userpage\c!numberstarter}
+ stopper {\namedcounterparameter\s!userpage\c!numberstopper}
+ }{
+ viewerprefix {\namedcounterparameter\s!userpage\c!viewerprefix}
+ state {\namedcounterparameter\s!userpage\c!state}
+ }%
+ \relax}
+
+\prependtoks
+ \strc_pagenumbers_page_state_save
+\to \everyshipout
+
+\installcorenamespace{pagestatestack} % no level yet
+
+\protected\def\strc_pagenumbers_page_state_push{\setxvalue{\??pagestatestack\c!state}{\namedcounterparameter\s!userpage\c!state}}
+\protected\def\strc_pagenumbers_page_state_pop {\normalexpanded{\setuppagenumber[\c!state=\getvalue{\??pagestatestack\c!state}]}}
+
+\setuppagenumber
+ [\c!way=\v!by\v!text,
+ \c!prefix=\v!no,
+ \c!prefixset=\v!part,
+ \c!prefixconnector=\endash,
+ \c!state=\v!start]
+
+\setupsubpagenumber
+ [\c!way=\v!by\v!part,
+ \c!state=\v!start] % was stop but start looks better in logging
+
+% Counters
+
+%permanent\def\firstrealpagenumber{\convertedcounter[\s!realpage][\c!type=\v!first]}
+%permanent\def\firstuserpagenumber{\convertedcounter[\s!userpage][\c!type=\v!first]}
+%permanent\def\firstsubpagenumber {\convertedcounter[\s!subpage ][\c!type=\v!first]}
+
+%permanent\def\lastrealpagenumber {\convertedcounter[\s!realpage][\c!type=\v!last]}
+%permanent\def\lastuserpagenumber {\convertedcounter[\s!userpage][\c!type=\v!last]}
+%permanent\def\lastsubpagenumber {\convertedcounter[\s!subpage ][\c!type=\v!last]}
+
+%permanent\def\prevrealpagenumber {\convertedcounter[\s!realpage][\c!type=\v!previous]}
+%permanent\def\prevuserpagenumber {\convertedcounter[\s!userpage][\c!type=\v!previous]}
+%permanent\def\prevsubpagenumber {\convertedcounter[\s!subpage ][\c!type=\v!previous]}
+
+%permanent\def\nextrealpagenumber {\convertedcounter[\s!realpage][\c!type=\v!next]}
+%permanent\def\nextuserpagenumber {\convertedcounter[\s!userpage][\c!type=\v!next]}
+%permanent\def\nextsubpagenumber {\convertedcounter[\s!subpage ][\c!type=\v!next]}
+
+\permanent\def\firstrealpage{\strc_counters_first\s!realpage}
+\permanent\def\firstuserpage{\strc_counters_first\s!userpage}
+\permanent\def\firstsubpage {\strc_counters_first\s!subpage }
+
+\permanent\def\prevrealpage {\strc_counters_prev \s!realpage}
+\permanent\def\prevuserpage {\strc_counters_prev \s!userpage}
+\permanent\def\prevsubpage {\strc_counters_prev \s!subpage }
+
+\permanent\def\nextrealpage {\strc_counters_next \s!realpage}
+\permanent\def\nextuserpage {\strc_counters_next \s!userpage}
+\permanent\def\nextsubpage {\strc_counters_next \s!subpage }
+
+\permanent\def\lastrealpage {\strc_counters_last \s!realpage}
+\permanent\def\lastuserpage {\strc_counters_last \s!userpage}
+\permanent\def\lastsubpage {\strc_counters_last \s!subpage }
+
+\aliased\let\firstpage\firstrealpage
+\aliased\let\prevpage \prevrealpage
+\aliased\let\nextpage \nextrealpage
+\aliased\let\lastpage \lastrealpage
+
+% Compatibility counters:
+
+\permanent\def\nofrealpages {\lastrealpage} \permanent\def\totalnumberofpages{\lastrealpage}
+\permanent\def\nofuserpages {\lastuserpage} \permanent\def\lastpagenumber {\lastuserpage}
+\permanent\def\nofsubpages {\lastsubpage }
+
+% Renderers:
+
+\permanent\def\pagenumber {\strc_counters_raw\s!userpage}
+\permanent\def\prefixedpagenumber {\directconvertedcounter\s!userpage\empty} % \userpagenumber
+
+\permanent\def\realpagenumber {\directconvertedcounter\s!realpage\empty}
+\permanent\def\userpagenumber {\directconvertedcounter\s!userpage\empty}
+\permanent\def\subpagenumber {\directconvertedcounter\s!subpage \empty}
+
+\permanent\def\firstrealpagenumber{\directconvertedcounter\s!realpage\v!first}
+\permanent\def\firstuserpagenumber{\directconvertedcounter\s!userpage\v!first}
+\permanent\def\firstsubpagenumber {\directconvertedcounter\s!subpage \v!first}
+
+\permanent\def\lastrealpagenumber {\directconvertedcounter\s!realpage\v!last}
+\permanent\def\lastuserpagenumber {\directconvertedcounter\s!userpage\v!last}
+\permanent\def\lastsubpagenumber {\directconvertedcounter\s!subpage \v!last}
+
+\permanent\def\prevrealpagenumber {\directconvertedcounter\s!realpage\v!previous}
+\permanent\def\prevuserpagenumber {\directconvertedcounter\s!userpage\v!previous}
+\permanent\def\prevsubpagenumber {\directconvertedcounter\s!subpage \v!previous}
+
+\permanent\def\nextrealpagenumber {\directconvertedcounter\s!realpage\v!next}
+\permanent\def\nextuserpagenumber {\directconvertedcounter\s!userpage\v!next}
+\permanent\def\nextsubpagenumber {\directconvertedcounter\s!subpage \v!next}
+
+\protected\def\strc_pagenumbers_decrement_counters % only at the end
+ {\strc_counters_decrement\s!realpage
+ \strc_counters_decrement\s!userpage
+ \strc_counters_decrement\s!subpage}
+
+\protected\def\strc_pagenumbers_increment_counters
+ {\incrementpagenumber
+ \incrementsubpagenumber}
+
+\appendtoks
+ \strc_pagenumbers_decrement_counters
+\to \everygoodbye
+
+\newcount\c_strc_subpage_first_real \c_strc_subpage_first_real\plusone
+
+\appendtoks
+ \ifcase\subpageno\relax
+ \global\c_strc_subpage_first_real\realpageno
+ \or
+ \global\c_strc_subpage_first_real\realpageno
+ \fi
+\to \everybeforepagebody
+
+\def\therealsubpageno#1% new helper
+ {\the\numexpr\c_strc_subpage_first_real+#1+\minusone\relax}
+
+% Equivalents (compatibility):
+%
+% todo: maybe leave lastpage etc lua calls
+
+\permanent\def\realpage{\the\realpageno}
+\permanent\def\userpage{\the\userpageno}
+\permanent\def\subpage {\the\subpageno}
+
+% Hooks:
+
+\permanent\def\currentpage{\the\realpageno}% rather useless
+
+\appendtoks
+ \ifnum\realpageno>\lastpage \enforced\glet\lastpage\lastrealpage \fi
+\to \everyinitializepagecounters
+
+% States:
+
+\newconditional\layoutisdoublesided % already defined: \newif\ifdoublesided
+\newconditional\layoutissinglesided % already defined: \newif\ifsinglesided
+
+% Realpage and subpage numbers:
+
+\permanent\protected\def\setnextrealpageno{\global\realpageno\strc_counters_incremented\s!realpage\relax}
+\permanent\protected\def\setnextsubpageno {\global\subpageno \strc_counters_incremented\s!subpage \relax}
+
+% Page numbers: (can move to lua) ... inconsistent names
+
+\installcorenamespace{pagenumberinc}
+\installcorenamespace{pagenumberdec}
+
+\protected\def\strc_pagenumbers_decrement_userpage{\global\userpageno\strc_counters_decremented\s!userpage\relax}
+\protected\def\strc_pagenumbers_increment_userpage{\global\userpageno\strc_counters_incremented\s!userpage\relax}
+
+\permanent\protected\def\decrementsubpagenumber{\global\subpageno \strc_counters_decremented\s!subpage \relax}
+\permanent\protected\def\incrementsubpagenumber{\global\subpageno \strc_counters_incremented\s!subpage \relax}
+
+\protected\def\strc_pagenumbers_synchronize_userpage{\global\c_strc_pagenumbers_state_userpage\plustwo} % start and visible
+
+\permanent\protected\def\decrementpagenumber{\csname\??pagenumberdec\namedcounterparameter\s!userpage\c!state\endcsname}
+\permanent\protected\def\incrementpagenumber{\csname\??pagenumberinc\namedcounterparameter\s!userpage\c!state\endcsname}
+
+\letvalue{\??pagenumberdec\v!start}\strc_pagenumbers_decrement_userpage
+\letvalue{\??pagenumberdec\v!none }\strc_pagenumbers_decrement_userpage
+\letvalue{\??pagenumberdec\v!empty}\strc_pagenumbers_decrement_userpage
+
+\letvalue{\??pagenumberinc\v!start}\strc_pagenumbers_increment_userpage
+\letvalue{\??pagenumberinc\v!none }\strc_pagenumbers_increment_userpage
+\setvalue{\??pagenumberinc\v!empty}{\strc_pagenumbers_increment_userpage\strc_pagenumbers_synchronize_userpage}
+\letvalue{\??pagenumberinc\v!keep }\strc_pagenumbers_synchronize_userpage
+
+% Setup general page numbering
+
+\installcorenamespace{pagenumbering}
+
+\installdirectcommandhandler \??pagenumbering {pagenumbering}
+
+% some day ifsinglesided and ifdoublesided will become obsolete
+
+\newtoks\everysidedswitch
+
+\appendtoks
+ \singlesidedfalse \setfalse\layoutisdoublesided
+ \doublesidedfalse \setfalse\layoutissinglesided
+ \resetsystemmode\v!singlesided
+ \resetsystemmode\v!doublesided
+ \processallactionsinset
+ [\directpagenumberingparameter\c!alternative]%
+ [ \v!singlesided=>\setsystemmode\v!singlesided\singlesidedtrue\settrue\layoutissinglesided,
+ \v!doublesided=>\setsystemmode\v!doublesided\doublesidedtrue\settrue\layoutisdoublesided]%
+ \the\everysidedswitch
+ \pageduplexmode
+ \ifsinglesided
+ \ifdoublesided\plustwo\else\zerocount\fi
+ \else
+ \ifdoublesided\plusone\else\zerocount\fi
+ \fi
+ \page_backgrounds_recalculate
+ \strc_pagenumbers_set_location
+\to \everysetuppagenumbering
+
+\appendtoks
+ \ifdefined\trackingmarginnotestrue
+ \ifdoublesided
+ \trackingmarginnotestrue
+ \else
+ \trackingmarginnotesfalse
+ \fi
+ \fi
+\to \everysidedswitch
+
+\ifdefined \page_backgrounds_recalculate \else
+ \let\page_backgrounds_recalculate\relax
+\fi
+
+\ifdefined \strc_pagenumbers_set_location \else
+ \let\strc_pagenumbers_set_location\relax
+\fi
+
+\protected\def\strc_pagenumbers_flush_final_page
+ {\edef\p_strc_pagenumbers_page{\directpagenumberingparameter\c!page}%
+ \ifempty\p_strc_pagenumbers_page \else
+ \ifx\p_strc_pagenumbers_page\v!no \else
+ \page[\p_strc_pagenumbers_page]%
+ \fi
+ \fi}
+
+% The numbered location handler is there because we need to be downward
+% compatible. So, in fact there can be multiple handlers active at the
+% same time, but only the current one does something.
+
+% Rendering:
+
+\protected\def\strc_pagenumbers_place_location
+ {\ifnum\c_strc_pagenumbers_state_userpage=\plustwo
+ \ifnum\c_strc_pagenumbers_state=\plusone
+ \doif{\directpagenumberingparameter\c!strut}\v!yes\strut
+ \begingroup
+ \usepagenumberingstyleandcolor\c!style\c!color
+ \directpagenumberingparameter\c!command
+ {\directpagenumberingparameter\c!left
+ \labeltexts\v!pagenumber\prefixedpagenumber
+ \directpagenumberingparameter\c!right}%
+ \endgroup
+ \fi
+ \fi}
+
+\permanent\protected\def\completepagenumber
+ {\ifnum\c_strc_pagenumbers_state_userpage=\plustwo
+ \ifnum\c_strc_pagenumbers_state=\plusone
+ \directpagenumberingparameter\c!left
+ \labeltexts\v!pagenumber\prefixedpagenumber
+ \directpagenumberingparameter\c!right
+ \fi
+ \fi}
+
+\permanent\protected\def\placepagenumber
+ {\ifnum\c_strc_pagenumbers_state_userpage=\plustwo
+ \ifnum\c_strc_pagenumbers_state=\plusone
+ \labeltexts\v!pagenumber\pagenumber
+ \fi
+ \fi}
+
+\permanent\protected\def\referencepagenumber[#1]%
+ {\doifelsenothing{#1}{?}{}}
+
+% The numbered location handler is there because we need to be downward
+% compatible. So, in fact there can be multiple handlers active at the
+% same time, but only the current one does something.
+
+\setnewconstant\c_strc_pagenumbers_state_realpage\plustwo % counter state : 0=stop, 1=start, 2=start and visible
+\setnewconstant\c_strc_pagenumbers_state_userpage\plustwo % counter state : 0=stop, 1=start, 2=start and visible
+\setnewconstant\c_strc_pagenumbers_state_subpage \plustwo % counter state : 0=stop, 1=start, 2=start and visible
+\setnewconstant\c_strc_pagenumbers_state \plusone % general number: 0=invisible, 1=visible
+
+\protected\def\strc_pagenumbers_check_state_change#1#2%
+ {\edef\m_strc_pagenumbers_state_new{\namedcounterparameter#1\c!state}%
+ \ifx\m_strc_pagenumbers_state_new\m_strc_pagenumbers_state_old \else
+ #2\ifx\m_strc_pagenumbers_state_new\v!start\plustwo\else\zerocount\fi
+ \fi}
+
+\appendtoks % todo: set state: none, start, stop, reset
+ \strc_pagenumbers_check_state_change\s!realpage\c_strc_pagenumbers_state_realpage
+\to \everysetuprealpagenumber
+
+\appendtoks % todo: set state: none, start, stop, reset
+ \strc_pagenumbers_check_state_change\s!userpage\c_strc_pagenumbers_state_userpage
+\to \everysetupuserpagenumber
+
+\appendtoks % todo: set state: none, start, stop, reset
+ \strc_pagenumbers_check_state_change\s!subpage\c_strc_pagenumbers_state_subpage
+\to \everysetupsubpagenumber
+
+\appendtoks % todo: set state: none, start, stop, reset
+ \doifelse{\directpagenumberingparameter\c!state}\v!start
+ {\c_strc_pagenumbers_state\plusone }%
+ {\c_strc_pagenumbers_state\zerocount}%
+\to \everysetuppagenumbering
+
+% Done
+
+% \c!way=\v!by\v!part
+% \c!text=
+% \v!chapter\v!number=\v!no
+% \v!part\v!number=\v!yes
+% \c!numberseparator=--
+% \c!conversion=\v!numbers
+
+\setuppagenumbering
+ [\c!alternative=\v!singlesided,
+ \c!location={\v!header,\v!middle},
+ \c!width=, % in geval van \v!marginedge
+ \c!left=,
+ \c!right=,
+ \c!page=\v!last,
+ \c!textseparator=\tfskip,
+ \c!state=\v!start,
+ \c!command=,
+ \c!strut=\v!yes,
+ \c!style=, % empty, otherwise conflict
+ \c!color=]
+
+% just for downward compatbility
+
+\appendtoks
+ \edef\askeduserpagenumber{\namedcounterparameter\s!userpage\c!number}%
+ \ifempty\askeduserpagenumber \else
+ \normalexpanded{\setuppagenumber[\c!start=\askeduserpagenumber,\c!number=]}%
+ \userpageno\strc_counters_raw\s!userpage
+ \fi
+\to \everysetupuserpagenumber % todo: set state: none, start, stop, reset
+
+\appendtoks
+ \edef\askedsubpagenumber{\namedcounterparameter\s!subpage\c!number}%
+ \ifempty\askedsubpagenumber \else
+ \normalexpanded{\setupsubpagenumber[\c!start=\askedsubpagenumber,\c!number=]}%
+ \subpageno\strc_counters_raw\s!subpage\relax
+ \fi
+\to \everysetupsubpagenumber % todo: set state: none, start, stop, reset
+
+% \setuplayout[width=300pt,backspace=4cm]
+% \setuppagenumbering [alternative=doublesided]
+% \setupuserpagenumber[start=2]
+% \starttext \dorecurse{20}{\input knuth \par} \stoptext
+
+\protected\def\strc_pagenumbers_check_change_shift
+ {\userpageno\strc_counters_raw\s!userpage\relax
+ \ifnum\realpageno=\plusone
+ \ifodd\userpageno
+ \else
+ \global\pagenoshift\plusone
+ \fi
+ \fi}
+
+\appendtoks % todo: set state: none, start, stop, reset
+ % this makes starting at an even page possible
+ \strc_pagenumbers_check_change_shift
+\to \everysetupuserpagenumber
+
+\appendtoks % todo: set state: none, start, stop, reset
+ % this makes starting at an even page possible
+ \strc_pagenumbers_check_change_shift
+\to \everysetuppagenumbering
+
+\initializepagecounters
+
+\stopcontextdefinitioncode
+
+\protect \endinput
diff --git a/tex/context/base/mkiv/strc-sbe.mkxl b/tex/context/base/mkiv/strc-sbe.mkxl
index e7878f205..bb6ba789a 100644
--- a/tex/context/base/mkiv/strc-sbe.mkxl
+++ b/tex/context/base/mkiv/strc-sbe.mkxl
@@ -44,8 +44,8 @@
{\strc_sectionblock_define_normal[#1][#3]%
%\expandafter\newif\csname if#2\endcsname % obsolete
\strc_sectionblock_set_environment{#1}\empty
- \setuvalue{\e!start#2}{\startsectionblock[#1]}%
- \setuvalue{\e!stop #2}{\stopsectionblock}}
+ \frozen\setuvalue{\e!start#2}{\startsectionblock[#1]}%
+ \frozen\setuvalue{\e!stop #2}{\stopsectionblock}}
\ifdefined \resetallstructuremarks \else
\let\resetallstructuremarks\relax
diff --git a/tex/context/base/mkiv/symb-ini.mkxl b/tex/context/base/mkiv/symb-ini.mkxl
index 5d10ae1ba..ae1fe8565 100644
--- a/tex/context/base/mkiv/symb-ini.mkxl
+++ b/tex/context/base/mkiv/symb-ini.mkxl
@@ -252,12 +252,13 @@
\the\t_symb_setups
\ifconditional\c_symb_found
\endgroup\expandafter\firstoftwoarguments
- \orelse\ifconditional\c_symb_found
- \symb_fetch_second\currentsymbol
- \endgroup\expandafter\firstoftwoarguments
\else
\symb_fetch_second\currentsymbol
- \endgroup\expandafter\secondoftwoarguments
+ \ifconditional\c_symb_found
+ \endgroup\doubleexpandafter\firstoftwoarguments
+ \else
+ \endgroup\doubleexpandafter\secondoftwoarguments
+ \fi
\fi}
\aliased\let\doifsymboldefinedelse\doifelsesymboldefined
diff --git a/tex/context/base/mkiv/typo-scr.mkxl b/tex/context/base/mkiv/typo-scr.mkxl
index 7b72cb314..36e2997e2 100644
--- a/tex/context/base/mkiv/typo-scr.mkxl
+++ b/tex/context/base/mkiv/typo-scr.mkxl
@@ -184,8 +184,8 @@
\dp\scratchbox\strutdp
\box\scratchbox}
-\permanent\tolerant\protected\def\typo_scripts_highlow_indeed[#1]#*[#2]#:#3#4%
- {\typo_scripts_lowhigh_indeed[#1][#2]{#4}{#3}}
+\permanent\tolerant\protected\def\typo_scripts_highlow[#1]#*[#2]#:#3#4%
+ {\typo_scripts_lowhigh[#1][#2]{#4}{#3}}
\permanent\protected\def\lohi{\typo_scripts_lowhigh[]}
\permanent\protected\def\hilo{\typo_scripts_highlow[]}
diff --git a/tex/context/interface/mkii/keys-cs.xml b/tex/context/interface/mkii/keys-cs.xml
index 76c186103..f97364024 100644
--- a/tex/context/interface/mkii/keys-cs.xml
+++ b/tex/context/interface/mkii/keys-cs.xml
@@ -286,6 +286,7 @@
<cd:variable name='intermezzo' value='intermezzo'/>
<cd:variable name='intext' value='dotextu'/>
<cd:variable name='intro' value='uvod'/>
+ <cd:variable name='invertedshort' value='invertedshort'/>
<cd:variable name='italic' value='kurziva'/>
<cd:variable name='italicbold' value='kurzivnitucne'/>
<cd:variable name='item' value='polozka'/>
@@ -389,6 +390,7 @@
<cd:variable name='nonumber' value='nonumber'/>
<cd:variable name='norepeat' value='norepeat'/>
<cd:variable name='normal' value='normalni'/>
+ <cd:variable name='normalshort' value='normalshort'/>
<cd:variable name='nospacing' value='nospacing'/>
<cd:variable name='nostopper' value='nostopper'/>
<cd:variable name='not' value='ne'/>
@@ -456,6 +458,7 @@
<cd:variable name='rectangular' value='pravouhly'/>
<cd:variable name='reference' value='odkaz'/>
<cd:variable name='referral' value='znacka'/>
+ <cd:variable name='region' value='region'/>
<cd:variable name='register' value='rejstrik'/>
<cd:variable name='regular' value='pravidelne'/>
<cd:variable name='relative' value='relativni'/>
diff --git a/tex/context/modules/mkiv/s-system-macros.mkxl b/tex/context/modules/mkiv/s-system-macros.mkxl
index e0903f132..0a7b9c179 100644
--- a/tex/context/modules/mkiv/s-system-macros.mkxl
+++ b/tex/context/modules/mkiv/s-system-macros.mkxl
@@ -156,11 +156,13 @@
\HL
\stoptabulate
+\start \hsize 15cm \veryraggedright
Often frozen commands are redefined on demand and they can be overloaded. Mutable
doesn't mean that a user can change it without consequences, for instance the
\type {\current...} ones. Primitives come with the engine, permanent macros are
the core of \CONTEXT. Noaligned macros are special and dealt deep down when
scanning for alignment specific primitives.
+\par \stop
\starttabulate
\BC number of visible macros \NC \NumberOfVisible \NC \NR
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 1928dc8de..368ce6215 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 : c:/data/develop/context/sources/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/sources/luatex-fonts.lua
--- merge date : 2020-11-07 12:43
+-- merge date : 2020-11-07 18:44
do -- begin closure to overcome local limits and interference
@@ -36026,7 +36026,7 @@ if not modules then modules={} end modules ['font-shp']={
}
local tonumber,next=tonumber,next
local concat=table.concat
-local formatters=string.formatters
+local formatters,lower=string.formatters,string.lower
local otf=fonts.handlers.otf
local afm=fonts.handlers.afm
local pfb=fonts.handlers.pfb
@@ -36219,7 +36219,7 @@ end
local function loadstreams(cache,filename,sub,instance)
local base=file.basename(filename)
local name=file.removesuffix(base)
- local kind=file.suffix(filename)
+ local kind=lower(file.suffix(filename))
local attr=lfs.attributes(filename)
local size=attr and attr.size or 0
local time=attr and attr.modification or 0