summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2012-08-13 22:00:23 +0300
committerMarius <mariausol@gmail.com>2012-08-13 22:00:23 +0300
commit8b6878eed417a121bd64a64b856a8d8388b33ba5 (patch)
treedd3d7c8ad8e489cfb82938b8c2ec7e4e94b27423
parent8d62ad07f4ed4984107cb8575f44ea04bbfeb1b3 (diff)
downloadcontext-8b6878eed417a121bd64a64b856a8d8388b33ba5.tar.gz
beta 2012.08.13 18:45
-rw-r--r--scripts/context/lua/mtxrun.lua2
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua2
-rw-r--r--scripts/context/stubs/unix/mtxrun2
-rw-r--r--tex/context/base/buff-ini.mkiv24
-rw-r--r--tex/context/base/cont-new.mkii2
-rw-r--r--tex/context/base/cont-new.mkiv255
-rw-r--r--tex/context/base/context-version.pdfbin4087 -> 4089 bytes
-rw-r--r--tex/context/base/context-version.pngbin105941 -> 106764 bytes
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/core-env.lua2
-rw-r--r--tex/context/base/core-env.mkiv68
-rw-r--r--tex/context/base/l-url.lua2
-rw-r--r--tex/context/base/m-spreadsheet.lua153
-rw-r--r--tex/context/base/m-spreadsheet.mkiv34
-rw-r--r--tex/context/base/math-ini.mkiv5
-rw-r--r--tex/context/base/math-noa.lua222
-rw-r--r--tex/context/base/node-ser.lua26
-rw-r--r--tex/context/base/page-flt.mkiv25
-rw-r--r--tex/context/base/spac-hor.mkiv55
-rw-r--r--tex/context/base/status-files.pdfbin24408 -> 24434 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin190434 -> 190437 bytes
-rw-r--r--tex/context/base/strc-flt.mkvi3
-rw-r--r--tex/context/base/syst-aux.lua16
-rw-r--r--tex/context/base/syst-aux.mkiv15
-rw-r--r--tex/context/base/syst-ini.mkiv5
-rw-r--r--tex/context/base/task-ini.lua1
-rw-r--r--tex/context/base/typo-scr.mkiv2
-rw-r--r--tex/context/base/util-dim.lua10
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
30 files changed, 526 insertions, 411 deletions
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 4af1453a1..2090ec584 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -3377,7 +3377,7 @@ local amp = P("&")
local key = Cs(((escapedchar+1)-equal )^0)
local value = Cs(((escapedchar+1)-amp -endofstring)^0)
-local splitquery = Cf ( Cc { } * P { "sequence",
+local splitquery = Cf ( Ct("") * P { "sequence",
sequence = V("pair") * (amp * V("pair"))^0,
pair = Cg(key * equal * value),
}, rawset)
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 4af1453a1..2090ec584 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -3377,7 +3377,7 @@ local amp = P("&")
local key = Cs(((escapedchar+1)-equal )^0)
local value = Cs(((escapedchar+1)-amp -endofstring)^0)
-local splitquery = Cf ( Cc { } * P { "sequence",
+local splitquery = Cf ( Ct("") * P { "sequence",
sequence = V("pair") * (amp * V("pair"))^0,
pair = Cg(key * equal * value),
}, rawset)
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index 4af1453a1..2090ec584 100644
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -3377,7 +3377,7 @@ local amp = P("&")
local key = Cs(((escapedchar+1)-equal )^0)
local value = Cs(((escapedchar+1)-amp -endofstring)^0)
-local splitquery = Cf ( Cc { } * P { "sequence",
+local splitquery = Cf ( Ct("") * P { "sequence",
sequence = V("pair") * (amp * V("pair"))^0,
pair = Cg(key * equal * value),
}, rawset)
diff --git a/tex/context/base/buff-ini.mkiv b/tex/context/base/buff-ini.mkiv
index 239a274c0..5f9d1d1e6 100644
--- a/tex/context/base/buff-ini.mkiv
+++ b/tex/context/base/buff-ini.mkiv
@@ -199,4 +199,28 @@
\def\getbufferdata[#1]{\buff_get_stored_indeed{#1}}
+%D This is a weird one, moved from cont-new. Do we really need it? If not
+%D it will go away.
+
+\bgroup \permitcircumflexescape
+
+\obeylines % don't remove %'s !
+
+\gdef\collapsedspace#1%
+ {\ifx#1^^M%
+ \expandafter\collapsedspace
+ \else
+ \space
+ \expandafter#1%
+ \fi}
+
+\unexpanded\gdef\collapsespaces
+ {\prependtoksonce\relax\to\everyeof%
+ \ignorelines%
+ \ignoretabs%
+ \let\obeyedspace\collapsedspace%
+ \obeyspaces}
+
+\egroup
+
\protect \endinput
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index 0d7722073..5d0d77e4f 100644
--- a/tex/context/base/cont-new.mkii
+++ b/tex/context/base/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2012.08.11 14:11}
+\newcontextversion{2012.08.13 18:45}
%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/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 7c64b1d24..b0b002991 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,11 +11,10 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2012.08.11 14:11}
+\newcontextversion{2012.08.13 18:45}
-%D This file is loaded at runtime, thereby providing an
-%D excellent place for hacks, patches, extensions and new
-%D features.
+%D This file is loaded at runtime, thereby providing an excellent place for
+%D hacks, patches, extensions and new features.
\unprotect
@@ -27,88 +26,9 @@
(\dimexpr#1\relax-\numexpr#3-1\relax\dimexpr#2\relax)/#3\else#1%
\fi
\relax}
-
-\def\singlewidened #1{\hbox spread 1em{\hss#1\hss}}
-\def\complexwidened[#1]#2{\hbox spread #1{\hss#2\hss}}
-
-\definecomplexorsimple\widened
-
-\let\active\activecatcode % for a while (tikz)
-
-% todo
-%
-% \def\definelocation{\dodoubleargument\dodefinelocation}
-% \def\dodefinelocation[#1][#2]{\setvalue{loc:#1}{#2}}
-%
-% \definelocation[lt] [\v!left\v!top]
-% \definelocation[tl] [\v!left\v!top]
-% \definelocation[\v!top\v!left][\v!left\v!top]
-%
-% \def\getlocation#1{\executeifdefined{loc:#1}{#1}}
-
-% \let\cs\getvalue % no, we want \cs to be czech
-
-% experimental so this may change ! ! ! not adapted to new low level description names
-
-\def\startdescriptions
- {\dosingleempty\dostartdescriptions}
-
-\def\dostartdescriptions[#1]%
- {\begingroup
- \def\item{\getvalue{#1}}%
- \let\dostoppairdescription \donothing
- \let\@@description \dostartpairdescription
- \let\@@startsomedescription\dostartsomedescription}
-
-\def\stopdescriptions
- {\dostoppairdescription
- \endgroup}
-\def\dostartpairdescription[#1][#2]%
- {\dostoppairdescription
- \def\dostoppairdescription{\@@stopdescription{#1}}%
- \bgroup
- \def\currentdescription{#1}%
- \doifelse{\descriptionparameter{\s!do\c!state}}\v!start
- {\@@makedescription{#1}[#2]{}}
- {\@@makedescription{#1}[#2]}}
+%D Idea:
-\def\dostartsomedescription% #1[#2]#3%
- {\bgroup
- \@@makedescription} % {#1}[#2]{#3}}
-
-% \starttext
-%
-% \definedescription[test]
-%
-% \startdescriptions
-% \test{Foo} Bar bar bar
-% \test{Foo} Bar bar bar
-% \test{Foo} Bar bar bar
-% \stopdescriptions
-%
-% \startdescriptions[test]
-% \item{Foo} Bar bar bar
-% \item{Foo} Bar bar bar
-% \item{Foo} Bar bar bar
-% \stopdescriptions
-%
-% \startdescriptions
-% \starttest{Foo} Bar bar bar \stoptest
-% \starttest{Foo} Bar bar bar \stoptest
-% \starttest{Foo} Bar bar bar \stoptest
-% \stopdescriptions
-%
-% \startdescriptions[test]
-% \item{Foo} Bar bar bar
-% \item{Foo} Bar bar bar
-% \item{Foo} Bar bar bar
-% \stopdescriptions
-%
-% \stoptext
-
-% this will be activated when
-%
% \newinsert\thispageinsert % <- installinsertion
%
% \def\flushatthispage
@@ -119,77 +39,13 @@
% \appendtoks
% \ifvoid\thispageinsert\else\hbox{\smashedbox\thispageinsert}\fi
% \to \everyshipout
-
+
+%D Idea:
+
% \definemarkedpage[nobackgrounds]
% \markpage[nobackgrounds]
% \doifmarkedpageelse{nobackgrounds}
-
-\def\modevalue#1#2#3%
- {\@EA\ifx\csname\@mode@\systemmodeprefix#1\endcsname\endcsname\enabledmode#2\else#2\fi}
-
-\def\systemmodevalue#1%
- {\modevalue{\systemmodeprefix#1}}
-
-% new, still to be improved
-%
-% \dorecurse{10}
-% {\input thuan
-% \placefigure{}{\framed[height=1.5cm]{test}}
-% \placefloatplaceholder}
-
-\def\placefloatplaceholder
- {\ifconditional\c_page_floats_room \else
- \scratchdimen\pagegoal
- \advance\scratchdimen-\pagetotal
- \advance\scratchdimen-3\lineheight
- \ifdim\scratchdimen>\zeropoint
- \startlinecorrection[blank]
- \mhbox{\inframed{\labeltexts{placeholder}{\lastcaptiontag}}}%
- \stoplinecorrection
- \else
- \allowbreak
- \fi
- \fi}
-
-\setuplabeltext
- [placeholder={, moved}]
-
-% move to support module, and then use context(...)
-
-\startluacode
- function commands.percentageof(str,dim)
- local n = str:match("^(.*)%%$")
- context.sprint(tex.ctxcatcodes,(n and (tonumber(n)/100)*dim .. "sp") or str)
- end
-\stopluacode
-
-\gdef\setpercentdimen#1#2%
- {#1=\ctxcommand{percentageof("#2",\number#1)}\relax}
-
-% \scratchdimen=100pt \setpercentdimen\scratchdimen{10\letterpercent} \the\scratchdimen
-% \scratchdimen=100pt \setpercentdimen\scratchdimen{5pt} \the\scratchdimen
-
-\bgroup \permitcircumflexescape
-
-\obeylines % don't remove %'s !
-\gdef\collapsedspace#1%
- {\ifx#1^^M%
- \expandafter\collapsedspace
- \else
- \space
- \expandafter#1%
- \fi}
-
-\gdef\collapsespaces
- {\prependtoksonce\relax\to\everyeof%
- \ignorelines%
- \ignoretabs%
- \let\obeyedspace\collapsedspace%
- \obeyspaces}
-
-\egroup
-
\unexpanded\def\inlinedbox
{\bgroup
\dowithnextbox
@@ -215,45 +71,10 @@
#2\expandafter\expandafter\expandafter\doxprecurse\expandafter
\fi\expandafter{\the\numexpr#1-1\relax}{#2}}
-% \unexpanded\def\buttonframed{\dodoubleempty\localframed[\??bt]} % goodie
-
\unexpanded\def\asciistr#1{\dontleavehmode{\defconvertedargument\ascii{#1}\verbatimfont\ascii}}
\def\shapefill{\vskip\zeropoint\s!plus\lineheight\s!minus\lineheight\relax}
-
-% \ruledhbox
-% {\startignorespaces
-% \def\oeps{a}
-% \startignorespaces
-% \def\oeps{a}
-% \stopignorespaces
-% \def\oeps{a}
-% \stopignorespaces
-% \oeps}
-
-\newsignal\boissignal
-\newcount \boislevel
-\long\def\startignorespaces
- {\advance\boislevel\plusone
- \ifcase\boislevel\or \ifhmode
- \hskip\boissignal
- \fi \fi
- \ignorespaces}
-
-\long\def\stopignorespaces
- {\ifcase\boislevel\or \ifhmode
- \doloop
- {\ifdim\lastskip=\zeropoint
- \exitloop
- \else\ifdim\lastskip=\boissignal
- \unskip
- \exitloop
- \else
- \unskip
- \fi\fi}%
- \fi \fi
- \advance\boislevel\minusone}
\def\minimalhbox#1#%
{\dowithnextbox
@@ -287,13 +108,6 @@
% \the\dimexpr(\dimchoice{11pt}{{<10pt}{8pt}{<12pt}{9pt}{<15pt}{10pt}{=11pt}{12pt}})
% \the\dimexpr(\dimchoice{14pt}{{<10pt}{8pt}{<12pt}{9pt}{<15pt}{10pt}{=11pt}{12pt}})
-%\def\tabulaterule % to be redone, not correct
-% {\dotabulaterule
-% {\hrule\s!height.5\scratchdimen\s!depth.5\scratchdimen\relax
-% \doif{\tabulateparameter\c!distance}\v!grid
-% {\kern-\scratchdimen}}} % experimental tm-prikkels
-%
-
% between alignment lines certain rules apply, and even a
% simple test can mess up a table, which is why we have a
% special test facility
@@ -315,34 +129,14 @@
\def\tightvbox{\dowithnextbox{\nextboxdp\zeropoint\flushnextbox}\vbox}
\def\tightvtop{\dowithnextbox{\nextboxht\zeropoint\flushnextbox}\vtop}
-% what is this stupid macro meant for:
-
-\def\hyphenationpoint
- {\hskip\zeropoint}
-
-\def\hyphenated#1%
- {\bgroup
- \!!counta\zerocount
- \def\hyphenated##1{\advance\!!counta\plusone}%
- \handletokens#1\with\hyphenated
- \!!countb\plusone
- \def\hyphenated##1%
- {##1%
- \advance\!!countb\plusone\relax
- \ifnum\!!countb>2 \ifnum\!!countb<\!!counta
- \hyphenationpoint
- \fi\fi}%
- \handletokens#1\with\hyphenated
- \egroup}
-
-\def\obeysupersubletters
+\unexpanded\def\obeysupersubletters
{\let\super\normalsuper
\let\suber\normalsuber
\let\normalsuper\letterhat
\let\normalsuber\letterunderscore
\enablesupersub}
-\def\obeysupersubmath
+\unexpanded\def\obeysupersubmath
{\let\normalsuper\letterhat
\let\normalsuber\letterunderscore
\enablesupersub}
@@ -363,29 +157,10 @@
\else
\stopbaselinecorrection
\fi}
-
+
\def\checkgridsnapping
{\lineskip\ifgridsnapping\zeropoint\else\normallineskip\fi}
-\def\startplaatsen
- {\dosingleempty\dostartplaatsen}
-
-\def\dostartplaatsen[#1]% tzt n*links etc
- {\endgraf
- \noindent\bgroup
- \setlocalhsize
- \hbox to \localhsize\bgroup
- \doifnot{#1}\v!left\hss
- \def\stopplaatsen
- {\unskip\unskip\unskip
- \doifnot{#1}\v!right\hss
- \egroup
- \egroup
- \endgraf}%
- \gobblespacetokens}
-
-% \startplaatsen[links] bla \stopplaatsen
-
\def\startcolumnmakeup % don't change
{\bgroup
\getrawnoflines\textheight % teksthoogte kan topskip hebben, dus raw
@@ -404,16 +179,6 @@
\egroup
\page_otr_command_synchronize_hsize}
-\long\def\startexternalfigure
- {\dotripleempty\dostartexternalfigure}
-
-\long\def\dostartexternalfigure[#1][#2][#3]#4\stopexternalfigure
- {\gdef\figuredescription{#4}%
- \externalfigure[#1][#2][#3]%
- \globallet\figuredescription\empty}
-
-\let\figuredescription\empty
-
% incomplete, will be a special case of float placement
\def\startfixed{\dosingleempty\dostartfixed}
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index 1372d89dd..63662ffd6 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png
index 67cdddeaa..1010da9f7 100644
--- a/tex/context/base/context-version.png
+++ b/tex/context/base/context-version.png
Binary files differ
diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii
index 2b6855cbc..b1a8bcb98 100644
--- a/tex/context/base/context.mkii
+++ b/tex/context/base/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2012.08.11 14:11}
+\edef\contextversion{2012.08.13 18:45}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 6c12acb10..51396d161 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -25,7 +25,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2012.08.11 14:11}
+\edef\contextversion{2012.08.13 18:45}
%D For those who want to use this:
diff --git a/tex/context/base/core-env.lua b/tex/context/base/core-env.lua
index cd4284a7d..96da8cc9f 100644
--- a/tex/context/base/core-env.lua
+++ b/tex/context/base/core-env.lua
@@ -37,7 +37,7 @@ setmetatableindex(tex.modes, function(t,k)
if m then
return m()
else
- local n = "mode" .. k
+ local n = "mode>" .. k
if csname_id(n) == undefined then
return false
else
diff --git a/tex/context/base/core-env.mkiv b/tex/context/base/core-env.mkiv
index 6b369b29a..38d3b1b29 100644
--- a/tex/context/base/core-env.mkiv
+++ b/tex/context/base/core-env.mkiv
@@ -54,42 +54,44 @@
% fast internal ones
+\def\??mode{mode>} % special namespace, also used at lua end
+
\def\syst_modes_new#1%
- {\expandafter\newcount\csname\s!mode#1\endcsname}
+ {\expandafter\newcount\csname\??mode#1\endcsname}
\unexpanded\def\newmode#1%
- {\ifcsname\s!mode#1\endcsname\else\syst_modes_new{#1}\fi}
+ {\ifcsname\??mode#1\endcsname\else\syst_modes_new{#1}\fi}
\unexpanded\def\setmode#1%
- {\ifcsname\s!mode#1\endcsname\else\syst_modes_new{#1}\fi
- \csname\s!mode#1\endcsname\enabledmode}
+ {\ifcsname\??mode#1\endcsname\else\syst_modes_new{#1}\fi
+ \csname\??mode#1\endcsname\enabledmode}
\unexpanded\def\resetmode#1%
- {\ifcsname\s!mode#1\endcsname\else\syst_modes_new{#1}\fi
- \csname\s!mode#1\endcsname\disabledmode}
+ {\ifcsname\??mode#1\endcsname\else\syst_modes_new{#1}\fi
+ \csname\??mode#1\endcsname\disabledmode}
\unexpanded\def\newsystemmode#1%
- {\ifcsname\s!mode\systemmodeprefix#1\endcsname\else\syst_modes_new{\systemmodeprefix#1}\fi}
+ {\ifcsname\??mode\systemmodeprefix#1\endcsname\else\syst_modes_new{\systemmodeprefix#1}\fi}
\unexpanded\def\setsystemmode#1%
- {\ifcsname\s!mode\systemmodeprefix#1\endcsname\else\syst_modes_new{\systemmodeprefix#1}\fi
- \csname\s!mode\systemmodeprefix#1\endcsname\enabledmode}
+ {\ifcsname\??mode\systemmodeprefix#1\endcsname\else\syst_modes_new{\systemmodeprefix#1}\fi
+ \csname\??mode\systemmodeprefix#1\endcsname\enabledmode}
\unexpanded\def\resetsystemmode#1%
- {\ifcsname\s!mode\systemmodeprefix#1\endcsname\else\syst_modes_new{\systemmodeprefix#1}\fi
- \csname\s!mode\systemmodeprefix#1\endcsname\disabledmode}
+ {\ifcsname\??mode\systemmodeprefix#1\endcsname\else\syst_modes_new{\systemmodeprefix#1}\fi
+ \csname\??mode\systemmodeprefix#1\endcsname\disabledmode}
% \def\dosetsystemmode#1%
-% {\csname\s!mode\systemmodeprefix#1\endcsname\enabledmode}
+% {\csname\??mode\systemmodeprefix#1\endcsname\enabledmode}
%
% \def\doresetsystemmode#1%
-% {\csname\s!mode\systemmodeprefix#1\endcsname\disabledmode}
+% {\csname\??mode\systemmodeprefix#1\endcsname\disabledmode}
% demo: trialtypesetting is a systemmode as well as an if
\newsystemmode{trialtypesetting} % the name of \@@trialtypesetting might change (also at the lua end)
-\expandafter\let\expandafter\@@trialtypesetting\csname\s!mode\systemmodeprefix trialtypesetting\endcsname % private !
+\expandafter\let\expandafter\@@trialtypesetting\csname\??mode\systemmodeprefix trialtypesetting\endcsname % private !
\appendtoks
\@@trialtypesetting\enabledmode
@@ -112,25 +114,25 @@
\def\syst_modes_disable[#1]{\protect\rawprocesscommacommand[#1]\syst_modes_disable_indeed}
\def\syst_modes_prevent_indeed#1%
- {\ifcsname\s!mode#1\endcsname\else\syst_modes_new{#1}\fi
- \csname\s!mode#1\endcsname\preventedmode}
+ {\ifcsname\??mode#1\endcsname\else\syst_modes_new{#1}\fi
+ \csname\??mode#1\endcsname\preventedmode}
\def\syst_modes_enable_indeed#1% we can speed it up by moving the new outside
- {\ifcsname\s!mode#1\endcsname\else\syst_modes_new{#1}\fi
- \ifnum\csname\s!mode#1\endcsname=\preventedmode \else
- \csname\s!mode#1\endcsname\enabledmode
+ {\ifcsname\??mode#1\endcsname\else\syst_modes_new{#1}\fi
+ \ifnum\csname\??mode#1\endcsname=\preventedmode \else
+ \csname\??mode#1\endcsname\enabledmode
\fi}
\def\syst_modes_disable_indeed#1%
- {\ifcsname\s!mode#1\endcsname\else\syst_modes_new{#1}\fi
- \ifnum\csname\s!mode#1\endcsname=\preventedmode \else
- \csname\s!mode#1\endcsname\disabledmode
+ {\ifcsname\??mode#1\endcsname\else\syst_modes_new{#1}\fi
+ \ifnum\csname\??mode#1\endcsname=\preventedmode \else
+ \csname\??mode#1\endcsname\disabledmode
\fi}
% handy for mp
\def\booleanmodevalue#1%
- {\ifcsname\s!mode#1\endcsname\ifcase\csname\s!mode#1\endcsname\s!false\else\s!true\fi\else\s!false\fi}
+ {\ifcsname\??mode#1\endcsname\ifcase\csname\??mode#1\endcsname\s!false\else\s!true\fi\else\s!false\fi}
% check macros
@@ -141,8 +143,8 @@
\newconditional\c_checked_mode
\def\syst_modes_check_indeed#1%
- {\ifcsname\s!mode#1\endcsname
- \ifcase\csname\s!mode#1\endcsname\else
+ {\ifcsname\??mode#1\endcsname
+ \ifcase\csname\??mode#1\endcsname\else
\let\syst_modes_check_step\gobbleoneargument
\fi
\fi}
@@ -157,8 +159,8 @@
\fi}
\def\syst_modes_check_all_indeed#1%
- {\ifcsname\s!mode#1\endcsname
- \ifcase\csname\s!mode#1\endcsname
+ {\ifcsname\??mode#1\endcsname
+ \ifcase\csname\??mode#1\endcsname
\let\syst_modes_check_all_step\gobbleoneargument
\fi
\else
@@ -198,25 +200,25 @@
%D Pushing/popping:
\unexpanded\def\pushmode[#1]%
- {\ifcsname\s!mode#1\endcsname\else\syst_modes_new{#1}\fi
- \expandafter\edef\csname\??modestack#1\endcsname{\number\csname\s!mode#1\endcsname}%
+ {\ifcsname\??mode#1\endcsname\else\syst_modes_new{#1}\fi
+ \expandafter\edef\csname\??modestack#1\endcsname{\number\csname\??mode#1\endcsname}%
\expandafter\pushmacro\csname\??modestack#1\endcsname}
\unexpanded\def\popmode[#1]%
{\ifcsname\??modestack#1\endcsname
\expandafter\popmacro\csname\??modestack#1\endcsname
- \csname\s!mode#1\endcsname\csname\??modestack#1\endcsname\relax
+ \csname\??mode#1\endcsname\csname\??modestack#1\endcsname\relax
\fi}
\def\pushsystemmode#1%
- {\ifcsname\s!mode\systemmodeprefix#1\endcsname\else\syst_modes_new{\systemmodeprefix#1}\fi
- \expandafter\edef\csname\??modestack\systemmodeprefix#1\endcsname{\number\csname\s!mode\systemmodeprefix#1\endcsname}%
+ {\ifcsname\??mode\systemmodeprefix#1\endcsname\else\syst_modes_new{\systemmodeprefix#1}\fi
+ \expandafter\edef\csname\??modestack\systemmodeprefix#1\endcsname{\number\csname\??mode\systemmodeprefix#1\endcsname}%
\expandafter\pushmacro\csname\??modestack\systemmodeprefix#1\endcsname}
\def\popsystemmode#1%
{\ifcsname\??modestack\systemmodeprefix#1\endcsname
\expandafter\popmacro\csname\??modestack\systemmodeprefix#1\endcsname
- \csname\s!mode\systemmodeprefix#1\endcsname\csname\??modestack\systemmodeprefix#1\endcsname\relax
+ \csname\??mode\systemmodeprefix#1\endcsname\csname\??modestack\systemmodeprefix#1\endcsname\relax
\fi}
%D Here is a relatively new variant of mode checking:
diff --git a/tex/context/base/l-url.lua b/tex/context/base/l-url.lua
index 647b3b6f3..9c7acce1f 100644
--- a/tex/context/base/l-url.lua
+++ b/tex/context/base/l-url.lua
@@ -126,7 +126,7 @@ local amp = P("&")
local key = Cs(((escapedchar+1)-equal )^0)
local value = Cs(((escapedchar+1)-amp -endofstring)^0)
-local splitquery = Cf ( Cc { } * P { "sequence",
+local splitquery = Cf ( Ct("") * P { "sequence",
sequence = V("pair") * (amp * V("pair"))^0,
pair = Cg(key * equal * value),
}, rawset)
diff --git a/tex/context/base/m-spreadsheet.lua b/tex/context/base/m-spreadsheet.lua
index 7d8fe9e07..30980684f 100644
--- a/tex/context/base/m-spreadsheet.lua
+++ b/tex/context/base/m-spreadsheet.lua
@@ -6,8 +6,9 @@ if not modules then modules = { } end modules ['m-spreadsheet'] = {
license = "see context related readme files"
}
-local byte, format, gsub = string.byte, string.format, string.gsub
-local R, P, C, V, Cs, Cc, Carg, lpegmatch = lpeg.R, lpeg.P, lpeg.C, lpeg.V, lpeg.Cs, lpeg.Cc, lpeg.Carg, lpeg.match
+local byte, format, gsub, find = string.byte, string.format, string.gsub, string.find
+local R, P, S, C, V, Cs, Cc, Ct, Cg, Cf, Carg = lpeg.R, lpeg.P, lpeg.S, lpeg.C, lpeg.V, lpeg.Cs, lpeg.Cc, lpeg.Ct, lpeg.Cg, lpeg.Cf, lpeg.Carg
+local lpegmatch, patterns = lpeg.match, lpeg.patterns
local setmetatable, loadstring, next, tostring, tonumber,rawget = setmetatable, loadstring, next, tostring, tonumber, rawget
local context = context
@@ -61,18 +62,27 @@ function spreadsheets.setup(t)
end
end
+local function emptydata(name,settings)
+ local data = { }
+ local specifications = { }
+ local settings = settings or { }
+ setmetatable(data,d_mt)
+ setmetatable(specifications,d_mt)
+ setmetatable(settings,s_mt)
+ return {
+ name = name,
+ data = data,
+ maxcol = 0,
+ maxrow = 0,
+ settings = settings,
+ temp = { }, -- for local usage
+ specifications = specifications,
+ }
+end
+
function spreadsheets.reset(name)
if not name or name == "" then name = defaultname end
- local d = { }
- local s = { }
- setmetatable(d,d_mt)
- setmetatable(s,s_mt)
- data[name] = {
- name = name,
- data = d,
- settings = s,
- temp = { }, -- for local usage
- }
+ data[name] = emptydata(name,data[name] and data[name].settings)
end
function spreadsheets.start(name,s)
@@ -88,15 +98,7 @@ function spreadsheets.start(name,s)
setmetatable(s,s_mt)
data[current].settings = s
else
- local d = { }
- setmetatable(d,d_mt)
- setmetatable(s,s_mt)
- data[current] = {
- name = name,
- data = d,
- settings = s,
- temp = { },
- }
+ data[current] = emptydata(name,s)
end
end
@@ -125,22 +127,54 @@ function datacell(a,b,...)
return format("dat[%s]",n)
end
-local cell = C(R("AZ"))^1 / datacell * (Cc("[") * (R("09")^1) * Cc("]") + #P(1))
-local pattern = Cs((cell + P(1))^0)
+local function checktemplate(s)
+ if find(s,"%%") then
+ -- normal template
+ return s
+ elseif find(s,"@") then
+ -- tex specific template
+ return gsub(s,"@","%%")
+ else
+ -- tex specific quick template
+ return "%" .. s
+ end
+end
+
+local quoted = Cs(patterns.unquoted)
+local spaces = patterns.whitespace^0
+local cell = C(R("AZ"))^1 / datacell * (Cc("[") * (R("09")^1) * Cc("]") + #P(1))
+
+-- A nasty aspect of lpeg: Cf ( spaces * Cc("") * { "start" ... this will create a table that will
+-- be reused, so we accumulate!
+
+local pattern = Cf ( spaces * Ct("") * { "start",
+ start = V("value") + V("set") + V("format") + V("string") + V("code"),
+ value = Cg(P([[=]]) * spaces * Cc("kind") * Cc("value")) * V("code"),
+ set = Cg(P([[!]]) * spaces * Cc("kind") * Cc("set")) * V("code"),
+ format = Cg(P([[@]]) * spaces * Cc("kind") * Cc("format")) * spaces * Cg(Cc("template") * Cs(quoted/checktemplate)) * V("code"),
+ string = Cg(#S([["']]) * Cc("kind") * Cc("string")) * Cg(Cc("content") * quoted),
+ code = spaces * Cg(Cc("code") * Cs((cell + P(1))^0)),
+}, rawset)
local functions = { }
spreadsheets.functions = functions
-function functions.sum(c,f,t)
- if f and t then
- local r = 0
- for i=f,t do
+function functions._s_(row,col,c,f,t)
+ local r = 0
+ if f and t then -- f..t
+ -- ok
+ elseif f then -- 1..f
+ f, t = 1, f
+ else
+ f, t = 1, row - 1
+ end
+ for i=f,t do
+ local ci = c[i]
+ if type(ci) == "number" then
r = r + c[i]
end
- return r
- else
- return 0
end
+ return r
end
functions.fmt= string.tformat
@@ -150,6 +184,9 @@ local template = [[
local dat = _m_.data['%s'].data
local tmp = _m_.temp
local fnc = _m_.functions
+ local row = %s
+ local col = %s
+ function fnc.sum(...) return fnc._s_(row,col,...) end
local sum = fnc.sum
local fmt = fnc.fmt
return %s
@@ -167,17 +204,45 @@ local function propername(name)
end
end
+-- if name == "" then name = current if name == "" then name = defaultname end end
+
local function execute(name,r,c,str)
- -- if name == "" then name = current if name == "" then name = defaultname end end
- str = lpegmatch(pattern,str,1,name)
- str = format(template,name,str)
- local result = loadstring(str) -- utilities.lua.strippedloadstring(str,true) -- when tracing
- result = result and result() or 0
- data[name].data[c][r] = result
- if type(result) == "function" then
- return result()
- else
- return result
+ if str ~= "" then
+ local d = data[name]
+ if c > d.maxcol then
+ d.maxcol = c
+ end
+ if r > d.maxrow then
+ d.maxrow = r
+ end
+ local specification = lpegmatch(pattern,str,1,name)
+ d.specifications[c][r] = specification
+ local kind = specification.kind
+ if kind == "string" then
+ return specification.content or ""
+ else
+ local code = specification.code
+ if code and code ~= "" then
+ code = format(template,name,r,c,code or "")
+ local result = loadstring(code) -- utilities.lua.strippedloadstring(code,true) -- when tracing
+ result = result and result()
+ if type(result) == "function" then
+ result = result()
+ end
+ if type(result) == "number" then
+ d.data[c][r] = result
+ end
+ if not result then
+ -- nothing
+ elseif kind == "set" then
+ -- no return
+ elseif kind == "format" then
+ return format(specification.template,result)
+ else
+ return result
+ end
+ end
+ end
end
end
@@ -196,10 +261,10 @@ function spreadsheets.get(name,r,c,str)
else
local result = execute(name,r,c,str)
if result then
- if type(result) == "number" then
- dname.data[c][r] = result
- result = tostring(result)
- end
+-- if type(result) == "number" then
+-- dname.data[c][r] = result
+-- result = tostring(result)
+-- end
local settings = dname.settings
local split = settings.split
local period = settings.period
diff --git a/tex/context/base/m-spreadsheet.mkiv b/tex/context/base/m-spreadsheet.mkiv
index f4c87d100..ed9a92d05 100644
--- a/tex/context/base/m-spreadsheet.mkiv
+++ b/tex/context/base/m-spreadsheet.mkiv
@@ -104,27 +104,45 @@
\fi
\appendtoks
- \resetspreadsheet
+ \module_spreadsheet_reset[\currentspreadsheet]%
\let\setspr\TABLEsetspreadsheet
\let\getspr\TABLEgetspreadsheet
\to \everyTABLEpass
\unexpanded\def\startspreadsheettable % quick and dirty
- {\dosingleempty\module_spreadsheet_start_table}
+ {\dodoubleempty\module_spreadsheet_start_table}
-\unexpanded\def\module_spreadsheet_start_table[#1]%
+\unexpanded\def\module_spreadsheet_start_table[#1][#2]%
{\bgroup
- \module_spreadsheet_start[#1]%%
- \unexpanded\def\startrow{\bTR}%
- \unexpanded\def\stoprow {\eTR}%
- \unexpanded\def\startcell##1\stopcell{\bTD\getspr{##1}\eTD}%
- \bTABLE[\c!align=\v!flushright]}
+ \let\startrow \module_spreadsheet_row_start
+ \let\stoprow \module_spreadsheet_row_stop
+ \let\startcell\module_spreadsheet_cell_start
+ \let\stopcell \module_spreadsheet_cell_stop
+ \doifassignmentelse{#1}
+ {\module_spreadsheet_start
+ \bTABLE[\c!align=\v!flushright,#1]}
+ {\module_spreadsheet_start[#1]%
+ \bTABLE[\c!align=\v!flushright,#2]}}
\unexpanded\def\stopspreadsheettable
{\eTABLE
\stopspreadsheet
\egroup}
+\unexpanded\def\module_spreadsheet_row_start{\bTR}
+\unexpanded\def\module_spreadsheet_row_stop {\eTR}
+
+\unexpanded\def\module_spreadsheet_cell_start
+ {\doifnextoptionalelse\module_spreadsheet_cell_start_yes\module_spreadsheet_cell_start_nop}
+
+\unexpanded\def\module_spreadsheet_cell_start_yes[#1]#2\stopcell
+ {\bTD[#1]\getspr{#2}\eTD}
+
+\unexpanded\def\module_spreadsheet_cell_start_nop#1\stopcell
+ {\bTD\getspr{#1}\eTD}
+
+\let\module_spreadsheet_cell_stop\relax
+
\protect
\continueifinputfile{m-spreadsheet.mkiv}
diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv
index 7f7577f2b..641faf44a 100644
--- a/tex/context/base/math-ini.mkiv
+++ b/tex/context/base/math-ini.mkiv
@@ -847,15 +847,16 @@
\c_math_italics_attribute\csname\??mathitalics
\ifcsname\??mathitalics\p_italics\endcsname\p_italics\else\v!none\fi
\endcsname\relax
- \math_italics_initialize
+ % \math_italics_initialize
\to \everyswitchmathematics % only in mathematics
\appendtoks
+ \math_italics_initialize
\attribute\mathitalicsattribute\c_math_italics_attribute
\to \everymathematics
\setupmathematics
- [\s!italics=]
+ [\s!italics=4]
% looks nicer but can generate bogus csnames
%
diff --git a/tex/context/base/math-noa.lua b/tex/context/base/math-noa.lua
index 02288432f..6643a8758 100644
--- a/tex/context/base/math-noa.lua
+++ b/tex/context/base/math-noa.lua
@@ -56,11 +56,14 @@ local has_attribute = node.has_attribute
local mlist_to_hlist = node.mlist_to_hlist
local font_of_family = node.family_font
local insert_node_after = node.insert_after
+local insert_node_before = node.insert_before
local free_node = node.free
local new_node = node.new -- todo: pool: math_noad math_sub
local new_kern = nodes.pool.kern
+local topoints = number.topoints
+
local fonthashes = fonts.hashes
local fontdata = fonthashes.identifiers
local fontcharacters = fonthashes.characters
@@ -103,6 +106,9 @@ local math_style = nodecodes.style -- attr style
local math_choice = nodecodes.choice -- attr display text script scriptscript
local math_fence = nodecodes.fence -- attr subtype
+local hlist_code = nodecodes.hlist
+local glyph_code = nodecodes.glyph
+
local left_fence_code = 1
local function process(start,what,n,parent)
@@ -758,72 +764,104 @@ local a_mathitalics = attributes.private("mathitalics")
local italics = { }
local default_factor = 1/20
-italics[math_char] = function(pointer,what,n,parent)
- local method = has_attribute(pointer,a_mathitalics)
- if method and method > 0 then
- local char = pointer.char
- local font = font_of_family(pointer.fam) -- todo: table
- local correction
- if method == 1 then
- -- only font data triggered by fontitalics
- local italics = fontitalics[font]
- if italics then
- local character = fontcharacters[font][char]
- correction = character and character.italic_correction -- or character.italic (this one is for tex)
- end
- elseif method == 2 then
- -- only font data triggered by fontdata
+
+local function getcorrection(method,font,char)
+
+ local correction
+
+ if method == 1 then
+ -- only font data triggered by fontitalics
+ local italics = fontitalics[font]
+ if italics then
+ local character = fontcharacters[font][char]
+ correction = character and character.italic_correction -- or character.italic (this one is for tex)
+ end
+ elseif method == 2 then
+ -- only font data triggered by fontdata
+ local character = fontcharacters[font][char]
+ correction = character and character.italic_correction -- or character.italic (this one is for tex)
+ elseif method == 3 then
+ -- only quad based by selective
+ local visual = chardata[char].visual
+ if not visual then
+ -- skip
+ elseif visual == "it" or visual == "bi" then
+ correction = fontproperties[font].mathitalic_defaultvalue or default_factor*fontquads[font]
+ end
+ elseif method == 4 then
+ -- combination of 1 and 3
+ local italics = fontitalics[font]
+ if italics then
local character = fontcharacters[font][char]
correction = character and character.italic_correction -- or character.italic (this one is for tex)
- elseif method == 3 then
- -- only quad based by selective
+ end
+ if not correction then
local visual = chardata[char].visual
if not visual then
-- skip
elseif visual == "it" or visual == "bi" then
correction = fontproperties[font].mathitalic_defaultvalue or default_factor*fontquads[font]
end
- elseif method == 4 then
- -- combination of 1 and 3
- local italics = fontitalics[font]
- if italics then
- local character = fontcharacters[font][char]
- correction = character and character.italic_correction -- or character.italic (this one is for tex)
- end
- if not correction then
- local visual = chardata[char].visual
- if not visual then
- -- skip
- elseif visual == "it" or visual == "bi" then
- correction = fontproperties[font].mathitalic_defaultvalue or default_factor*fontquads[font]
- end
- end
end
+ end
+
+ if correction and correction ~= 0 then
+ return correction
+ end
+
+end
+
+local function insert_kern(current,kern)
+ local sub = new_node(math_sub) -- todo: pool
+ local noad = new_node(math_noad) -- todo: pool
+ sub.head = kern
+ kern.next = noad
+ noad.nucleus = current
+ return sub
+end
+
+italics[math_char] = function(pointer,what,n,parent)
+ local method = has_attribute(pointer,a_mathitalics)
+ if method and method > 0 then
+ local char = pointer.char
+ local font = font_of_family(pointer.fam) -- todo: table
+ local correction = getcorrection(method,font,char)
-- maybe also correction when next == nil
+ -- when sub/sup -> already done
- if correction and correction ~= 0 then
- local next_noad = parent.next
- if not next_noad then
- if true then -- this might become an option
- if trace_italics then
- report_italics("method %s: adding %s italic correction between %s (0x%05X) and end math",
- method,number.points(correction),utfchar(char),char)
- end
- insert_node_after(parent,parent,new_kern(correction))
+ if correction then
+ if parent.id == math_noad and (parent.sub or parent.sup) then
+ if sub then
+ parent.sub = insert_kern(sub,new_kern(correction))
end
- elseif next_noad.id == math_noad then
- local next_subtype = next_noad.subtype
- if next_subtype == noad_punct or next_subtype == noad_ord then
- local next_nucleus = next_noad.nucleus
- if next_nucleus.id == math_char then
- local next_char = next_nucleus.char
- if not chardata[next_char].italic then -- or category
- if trace_italics then
- report_italics("method %s: adding %s italic correction between %s (0x%05X) and %s (0x%05X)",
- method,number.points(correction),utfchar(char),char,utfchar(next_char),next_char)
+ local sup = parent.sup
+ if sup then
+ parent.sup = insert_kern(sup,new_kern(correction))
+ end
+ else
+ local next_noad = parent.next
+ if not next_noad then
+ if true then -- this might become an option
+ if trace_italics then
+ report_italics("method %s: adding %s italic correction between %s (0x%05X) and end math",
+ method,number.points(correction),utfchar(char),char)
+ end
+ insert_node_after(parent,parent,new_kern(correction))
+ end
+ elseif next_noad.id == math_noad then
+ local next_subtype = next_noad.subtype
+ if next_subtype == noad_punct or next_subtype == noad_ord then
+ local next_nucleus = next_noad.nucleus
+ if next_nucleus.id == math_char then
+ local next_char = next_nucleus.char
+ if not chardata[next_char].italic then -- or category
+ if trace_italics then
+ report_italics("method %s: adding %s italic correction between %s (0x%05X) and %s (0x%05X)",
+ method,number.points(correction),utfchar(char),char,utfchar(next_char),next_char)
+ end
+ insert_node_after(parent,parent,new_kern(correction))
end
- insert_node_after(parent,parent,new_kern(correction))
end
end
end
@@ -832,7 +870,27 @@ italics[math_char] = function(pointer,what,n,parent)
end
end
+-- italics[math_noad] = function(pointer,what,n,parent)
+-- local nucleus = pointer.nucleus
+-- if nucleus.id == math_char then
+-- local method = has_attribute(pointer,a_mathitalics)
+-- if method and method > 0 then
+-- local char = nucleus.char
+-- local font = font_of_family(nucleus.fam) -- todo: table
+-- local correction = getcorrection(method,font,char)
+-- if correction then
+-- if trace_italics then
+-- report_italics("method %s: adding %s italic correction between %s (0x%05X) and script",
+-- method,number.points(correction),utfchar(char),char)
+-- end
+-- insert_node_after(nucleus,nucleus,new_kern(correction))
+-- end
+-- end
+-- end
+-- end
+
function handlers.italics(head,style,penalties)
+-- nodes.showsimplelist(head)
processnoads(head,italics,"italics")
return true
end
@@ -847,6 +905,66 @@ enable = function()
enable = false
end
+-- -- -- -- -- -- -- --
+-- -- -- -- -- -- -- --
+
+-- -- nice but not okay with multiple scripts (we need more clever hlist-shift checking then
+--
+-- local function processitalics(head,previous,previousmethod)
+-- local current = head
+-- while current do
+-- local id = current.id
+-- if id == glyph_code then
+-- local method = has_attribute(current,a_mathitalics)
+-- if method and method > 0 then -- keep method of previous
+-- if previous then
+-- local previousfont = previous.font
+-- local previouschar = previous.char
+-- local currentchar = current.char
+-- local correction = getcorrection(previousmethod,previousfont,previouschar)
+-- if correction then
+-- if trace_italics then
+-- report_italics("correction %s between U+%05X and U+%05X using method",topoints(correction),previouschar,currentchar,previousmethod)
+-- end
+-- insert_node_after(previous,previous,new_kern(correction))
+-- else
+-- if trace_italics then
+-- report_italics("no correction between U+%05X and U+%05X",previouschar,currentchar)
+-- end
+-- end
+-- end
+-- previous, previousmethod = current, method
+-- end
+-- elseif id == hlist_code then
+-- previous, previousmethod = processitalics(current.list,previous,previousmethod)
+-- elseif id == vlist_code then
+-- previous, previousmethod = processitalics(current.list,previous,previousmethod)
+-- else
+-- previous, previousmethod = nil
+-- end
+-- current = current.next
+-- end
+-- return previous, previousmethod
+-- end
+--
+-- function handlers.italics(head,style,penalties)
+-- processitalics(head)
+-- return true
+-- end
+--
+-- local enable
+--
+-- enable = function()
+-- tasks.enableaction("math", "noads.handlers.italics")
+-- if trace_italics then
+-- report_italics("enabling math italics")
+-- end
+-- enable = false
+-- end
+
+-- -- -- -- -- -- -- --
+-- -- -- -- -- -- -- --
+
-- best do this only on math mode (less overhead)
function mathematics.setitalics(n)
diff --git a/tex/context/base/node-ser.lua b/tex/context/base/node-ser.lua
index 63690d00a..df68e16d5 100644
--- a/tex/context/base/node-ser.lua
+++ b/tex/context/base/node-ser.lua
@@ -19,6 +19,7 @@ local nodes, node = nodes, node
local traverse = node.traverse
local nodecodes = nodes.nodecodes
+local noadcodes = nodes.noadcodes
local nodefields = nodes.fields
local hlist_code = nodecodes.hlist
@@ -94,9 +95,9 @@ end
-- under construction:
-local function totable(n,flat,verbose) -- todo: no attributes
+local function totable(n,flat,verbose,noattributes)
-- todo: no local function
- local function to_table(n,flat,verbose)
+ local function to_table(n,flat,verbose,noattributes) -- no need to pass
local f = nodefields(n)
local tt = { }
for k=1,#f do
@@ -105,6 +106,8 @@ local function totable(n,flat,verbose) -- todo: no attributes
if nv then
if ignore[v] then
-- skip
+ elseif noattributes and v == "attr" then
+ -- skip
elseif expand[v] then
if type(nv) == "number" or type(nv) == "string" then
tt[v] = nv
@@ -128,14 +131,14 @@ local function totable(n,flat,verbose) -- todo: no attributes
local t, tn = { }, 0
while n do
tn = tn + 1
- t[tn] = to_table(n,flat,verbose)
+ t[tn] = to_table(n,flat,verbose,noattributes)
n = n.next
end
return t
else
local t = to_table(n)
if n.next then
- t.next = totable(n.next,flat,verbose)
+ t.next = totable(n.next,flat,verbose,noattributes)
end
return t
end
@@ -154,7 +157,7 @@ end
-- todo: adapt to nodecodes etc
-local function serialize(root,name,handle,depth,m)
+local function serialize(root,name,handle,depth,m,noattributes)
handle = handle or print
if depth then
depth = depth .. " "
@@ -188,6 +191,11 @@ local function serialize(root,name,handle,depth,m)
local k = fld[f]
if k == "ref_count" then
-- skip
+ elseif noattributes and k == "attr" then
+ -- skip
+ elseif k == "id" then
+ local v = root[k]
+ handle(format("%s id=%s,",depth,nodecodes[v] or noadcodes[v] or v))
elseif k then
local v = root[k]
local t = type(v)
@@ -206,12 +214,12 @@ local function serialize(root,name,handle,depth,m)
elseif t == "boolean" then
handle(format("%s %s=%q,",depth,key(k),tostring(v)))
elseif v then -- userdata or table
- serialize(v,k,handle,depth,m+1)
+ serialize(v,k,handle,depth,m+1,noattributes)
end
end
end
if root['next'] then -- userdata or table
- serialize(root['next'],'next',handle,depth,m+1)
+ serialize(root['next'],'next',handle,depth,m+1,noattributes)
end
end
if m and m > 0 then
@@ -221,13 +229,13 @@ local function serialize(root,name,handle,depth,m)
end
end
-function nodes.serialize(root,name)
+function nodes.serialize(root,name,noattributes)
local t, n = { }, 0
local function flush(s)
n = n + 1
t[n] = s
end
- serialize(root, name, flush, nil, 0)
+ serialize(root,name,flush,nil,0,noattributes)
return concat(t,"\n")
end
diff --git a/tex/context/base/page-flt.mkiv b/tex/context/base/page-flt.mkiv
index 56d801072..65abc844c 100644
--- a/tex/context/base/page-flt.mkiv
+++ b/tex/context/base/page-flt.mkiv
@@ -153,7 +153,7 @@
\ifvoid\floatbox
\exitloop
\else
- \def\currentfloat{#1}%
+ \def {#1}%
\blank[\rootfloatparameter\c!spacebefore]%
\box\floatbox
\blank[\rootfloatparameter\c!spaceafter]%
@@ -227,6 +227,29 @@
% \fi
\fi}}
+%D This is a future mechamism that will be integrated once we're sure about it:
+%D
+%D \starttyping
+%D \dorecurse{10}
+%D {\input thuan
+%D \placefigure{}{\framed[height=1.5cm]{test}}
+%D \placefloatplaceholder}
+%D \stoptyping
+
+\unexpanded\def\placefloatplaceholder
+ {\ifconditional\c_page_floats_room \else
+ \ifdim\dimexpr\pagegoal-\pagetotal-3\lineheight\relax>\zeropoint
+ \startlinecorrection[blank]
+ \mhbox{\inframed{\labeltexts{placeholder}{\lastcaptiontag}}}%
+ \stoplinecorrection
+ \else
+ \allowbreak
+ \fi
+ \fi}
+
+\setuplabeltext
+ [placeholder={\Word{\lastplacedfloat}~, moved}]
+
%D Page floats use different stacks.
\newtoks\everybeforeflushedpagefloat
diff --git a/tex/context/base/spac-hor.mkiv b/tex/context/base/spac-hor.mkiv
index a750577ce..2753bdac4 100644
--- a/tex/context/base/spac-hor.mkiv
+++ b/tex/context/base/spac-hor.mkiv
@@ -1001,8 +1001,63 @@
\unexpanded\def\medglue {\spac_glues_text_or_math\medmuskip \v!medium}
\unexpanded\def\thickglue{\spac_glues_text_or_math\thickmuskip\v!big}
+%D A rather unknown one:
+
+\unexpanded\def\widened % moved from cont-new
+ {\doifnextoptionalelse\spac_widened_yes\spac_widened_nop}
+
+\def\spac_widened_yes[#1]#2{\hbox \s!spread #1{\hss#2\hss}}
+\def\spac_widened_nop #1{\hbox \s!spread \emwidth{\hss#1\hss}}
+
+\definecomplexorsimple\widened
+
%D For the moment here (used in page-txt):
\unexpanded\def\ignoredlinebreak{\unskip\space\ignorespaces}
+%D \macros
+%D {startignorespaces}
+%D
+%D I'll probably forget that this one exists:
+%D
+%D \starttyping
+%D \ruledhbox
+%D {\startignorespaces
+%D \def\oeps{a}
+%D \startignorespaces
+%D \def\oeps{a}
+%D \stopignorespaces
+%D \def\oeps{a}
+%D \stopignorespaces
+%D \oeps}
+%D \stoptyping
+
+\newsignal\s_spac_ignore_spaces
+\newcount \c_spac_ignore_spaces
+
+\unexpanded\def\startignorespaces
+ {\advance\c_spac_ignore_spaces\plusone
+ \ifcase\c_spac_ignore_spaces\or \ifhmode
+ \hskip\s_spac_ignore_spaces
+ \fi \fi
+ \ignorespaces}
+
+\unexpanded\def\stopignorespaces
+ {\ifcase\c_spac_ignore_spaces \or
+ \ifhmode
+ \doloop\spac_ignore_spaces_body
+ \fi
+ \fi
+ \advance\c_spac_ignore_spaces\minusone}
+
+\def\spac_ignore_spaces_body
+ {\ifdim\lastskip=\zeropoint
+ \exitloop
+ \else\ifdim\lastskip=\s_spac_ignore_spaces
+ \unskip
+ \exitloop
+ \else
+ \unskip
+ \fi\fi}
+
\protect \endinput
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 7e7883e05..539067d56 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index e9ce17b5b..b05be9286 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/strc-flt.mkvi b/tex/context/base/strc-flt.mkvi
index e1e6e75a1..128cc824d 100644
--- a/tex/context/base/strc-flt.mkvi
+++ b/tex/context/base/strc-flt.mkvi
@@ -443,11 +443,14 @@
% we're really dealing with the float. Some day I'll root out
% the global settings.
+\let\lastplacedfloat\empty
+
\def\strc_floats_set_current_tag#tag%
{\edef\currentfloat{#tag}%
\ifx\currentfloat\empty
\let\currentfloat\v!figure % a bit of a hack
\fi
+ \global\let\lastplacedfloat\currentfloat
\let\m_strc_floats_saved_userdata\empty
\let\currentfloatcaption\currentfloat}
diff --git a/tex/context/base/syst-aux.lua b/tex/context/base/syst-aux.lua
index b5dd4e7e2..b04d11d89 100644
--- a/tex/context/base/syst-aux.lua
+++ b/tex/context/base/syst-aux.lua
@@ -11,11 +11,12 @@ if not modules then modules = { } end modules ['syst-aux'] = {
-- utfmatch(str,"(.?)(.*)$")
-- utf.sub(str,1,1)
-local commands = commands
+local commands, context = commands, context
local settings_to_array = utilities.parsers.settings_to_array
local concat = table.concat
-local P, C, lpegmatch, utf8char = lpeg.P, lpeg.C, lpeg.match, lpeg.patterns.utf8char
+local format = string.format
+local P, C, Carg, lpegmatch, utf8char = lpeg.P, lpeg.C, lpeg.Carg, lpeg.match, lpeg.patterns.utf8char
local setvalue = context.setvalue
@@ -62,3 +63,14 @@ end
-- end
-- end
-- end
+
+local pattern = (C((1-P("%"))^1) * Carg(1)) /function(n,d) return format("%.0fsp",d * tonumber(n)/100) end * P("%") * P(-1)
+
+-- commands.percentageof("10%",65536*10)
+
+function commands.percentageof(str,dim)
+ context(lpegmatch(pattern,str,1,dim) or str)
+end
+
+-- \gdef\setpercentdimen#1#2%
+-- {#1=\ctxcommand{percentageof("#2",\number#1)}\relax}
diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv
index 721a2def9..0fab918b7 100644
--- a/tex/context/base/syst-aux.mkiv
+++ b/tex/context/base/syst-aux.mkiv
@@ -1355,6 +1355,21 @@
\fi}
%D \macros
+%D {setpercentdimen}
+%D
+%D \starttyping
+%D \scratchdimen=100pt \setpercentdimen\scratchdimen{10\letterpercent}
+%D \scratchdimen=100pt \setpercentdimen\scratchdimen{5pt}
+%D \scratchdimen \percentdimen \hsize {10\letterpercent}
+%D \stoptyping
+
+\def\percentdimen#1#2% dimen percentage (with %)
+ {\dimexpr\ctxcommand{percentageof("#2",\number#1)}\relax}
+
+\unexpanded\def\setpercentdimen#1#2% dimen percentage (with %)
+ {#1=\ctxcommand{percentageof("#2",\number#1)}\relax}
+
+%D \macros
%D {makerawcommalist,
%D rawdoinsetelse,
%D rawprocesscommalist,
diff --git a/tex/context/base/syst-ini.mkiv b/tex/context/base/syst-ini.mkiv
index 922c93b75..1c87c4ed4 100644
--- a/tex/context/base/syst-ini.mkiv
+++ b/tex/context/base/syst-ini.mkiv
@@ -540,6 +540,11 @@
\chardef\commentcatcode = 14
\chardef\invalidcatcode = 15
+%D For a while we keep the following, as systems like tikz need it. Best
+%D not use that one \CONTEXT.
+
+\let\active\activecatcode
+
%D Constants to be used with \type {\currentgrouptype}.
\chardef\bottomlevelgroupcode = 0
diff --git a/tex/context/base/task-ini.lua b/tex/context/base/task-ini.lua
index 58f7cbd40..37e01996d 100644
--- a/tex/context/base/task-ini.lua
+++ b/tex/context/base/task-ini.lua
@@ -83,6 +83,7 @@ appendaction("math", "normalizers", "noads.handlers.tags", nil, "noh
appendaction("math", "normalizers", "noads.handlers.italics", nil, "nohead") -- disabled
appendaction("math", "builders", "builders.kernel.mlist_to_hlist") -- always on
+------------("math", "builders", "noads.handlers.italics", nil, "nohead") -- disabled
-- quite experimental (nodes.handlers.graphicvadjust might go away)
diff --git a/tex/context/base/typo-scr.mkiv b/tex/context/base/typo-scr.mkiv
index 50c360924..c5e1ec5fb 100644
--- a/tex/context/base/typo-scr.mkiv
+++ b/tex/context/base/typo-scr.mkiv
@@ -263,6 +263,6 @@
\egroup}
\unexpanded\def\lomihi {\typo_scripts_lowmidhigh\empty}
-\unexpanded\def\himilo#1#2#3{\typo_scripts_lowmidhigh\empty{#1}{#3}{#2}}
+\unexpanded\def\himilo#1#2#3{\typo_scripts_lowmidhigh\empty{#3}{#2}{#1}}
\protect \endinput
diff --git a/tex/context/base/util-dim.lua b/tex/context/base/util-dim.lua
index 4668326df..4bae2d099 100644
--- a/tex/context/base/util-dim.lua
+++ b/tex/context/base/util-dim.lua
@@ -436,12 +436,12 @@ probably use a hash instead of a one-element table.</p>
<p>Goodie:s</p>
--ldx]]--
-function number.percent(n) -- will be cleaned up once luatex 0.30 is out
- local hsize = tex.hsize
- if type(hsize) == "string" then
- hsize = stringtodimen(hsize)
+function number.percent(n,d) -- will be cleaned up once luatex 0.30 is out
+ d = d or tex.hsize
+ if type(d) == "string" then
+ d = stringtodimen(d)
end
- return (n/100) * hsize
+ return (n/100) * d
end
number["%"] = number.percent
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 49a55c0eb..3b6506586 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 08/11/12 14:11:43
+-- merge date : 08/13/12 18:45:25
do -- begin closure to overcome local limits and interference