From 98b29c780ec554009fc3942f64fbab5e150b8e66 Mon Sep 17 00:00:00 2001
From: Hans Hagen <pragma@wxs.nl>
Date: Thu, 10 May 2012 17:00:00 +0200
Subject: beta 2012.05.10 17:00

---
 tex/context/base/cont-new.mkii                     |   2 +-
 tex/context/base/cont-new.mkiv                     |   2 +-
 tex/context/base/context-version.pdf               | Bin 4070 -> 4071 bytes
 tex/context/base/context-version.png               | Bin 105493 -> 105651 bytes
 tex/context/base/context.mkii                      |   2 +-
 tex/context/base/context.mkiv                      |   2 +-
 tex/context/base/core-con.lua                      |  42 +++----
 tex/context/base/core-con.mkiv                     |   8 ++
 tex/context/base/core-dat.lua                      |  10 ++
 tex/context/base/core-dat.mkiv                     |   3 +
 tex/context/base/file-mod.lua                      |  14 +--
 tex/context/base/mult-sys.mkiv                     |   1 +
 tex/context/base/pack-rul.mkiv                     |   3 -
 tex/context/base/s-art-01.mkiv                     |  32 +++---
 tex/context/base/spac-ali.mkiv                     |  14 ++-
 tex/context/base/spac-grd.mkiv                     |  89 +++++++--------
 tex/context/base/spac-pag.mkiv                     | 127 ++-------------------
 tex/context/base/spac-ver.mkiv                     |   7 +-
 tex/context/base/status-files.pdf                  | Bin 24337 -> 24304 bytes
 tex/context/base/status-lua.pdf                    | Bin 173419 -> 173832 bytes
 tex/context/base/strc-itm.mkvi                     |   8 +-
 tex/context/base/typo-mar.mkiv                     |  20 +++-
 tex/generic/context/luatex/luatex-fonts-merged.lua |   2 +-
 23 files changed, 162 insertions(+), 226 deletions(-)

(limited to 'tex')

diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index 6241a2f3e..ec14cb9e4 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.05.08 23:00}
+\newcontextversion{2012.05.10 17:00}
 
 %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 ac8cfd1af..a3be92aa7 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,7 +11,7 @@
 %C therefore copyrighted by \PRAGMA. See mreadme.pdf for
 %C details.
 
-\newcontextversion{2012.05.08 23:00}
+\newcontextversion{2012.05.10 17:00}
 
 %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/context-version.pdf b/tex/context/base/context-version.pdf
index 8639cacf9..7d4b45c8e 100644
Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ
diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png
index 1742b5b42..cf930e8f9 100644
Binary files a/tex/context/base/context-version.png and b/tex/context/base/context-version.png differ
diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii
index 0a142a192..a6011b7e7 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.05.08 23:00}
+\edef\contextversion{2012.05.10 17:00}
 
 %D For those who want to use this:
 
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 70c12126f..9f595171e 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -23,7 +23,7 @@
 %D up and the dependencies are more consistent.
 
 \edef\contextformat {\jobname}
-\edef\contextversion{2012.05.08 23:00}
+\edef\contextversion{2012.05.10 17:00}
 
 %D For those who want to use this:
 
diff --git a/tex/context/base/core-con.lua b/tex/context/base/core-con.lua
index 571a850f4..e4b516e3b 100644
--- a/tex/context/base/core-con.lua
+++ b/tex/context/base/core-con.lua
@@ -764,29 +764,29 @@ local v_space    = variables.space
 
 local convert = converters.convert
 
-local days = {
-    variables.sunday,
-    variables.monday,
-    variables.tuesday,
-    variables.wednesday,
-    variables.thursday,
-    variables.friday,
-    variables.saturday,
+local days = { -- not variables.sunday
+    "sunday",
+    "monday",
+    "tuesday",
+    "wednesday",
+    "thursday",
+    "friday",
+    "saturday",
 }
 
-local months = {
-     variables.january,
-     variables.february,
-     variables.march,
-     variables.april,
-     variables.may,
-     variables.june,
-     variables.july,
-     variables.august,
-     variables.september,
-     variables.october,
-     variables.november,
-     variables.december,
+local months = { -- not variables.januari
+     "january",
+     "february",
+     "march",
+     "april",
+     "may",
+     "june",
+     "july",
+     "august",
+     "september",
+     "october",
+     "november",
+     "december",
 }
 
 function commands.dayname(n)
diff --git a/tex/context/base/core-con.mkiv b/tex/context/base/core-con.mkiv
index 301b56612..241d43165 100644
--- a/tex/context/base/core-con.mkiv
+++ b/tex/context/base/core-con.mkiv
@@ -696,6 +696,14 @@
 \defineconversion [cn-c]                 [\chinesecapnumerals]
 \defineconversion [cn-a]                 [\chineseallnumerals]
 
+%D In case a font has no greek (WS):
+
+\defineconversion [mathgreek]
+  [\m{α},\m{β},\m{γ},\m{δ},\m{ε},\m{ζ},
+   \m{η},\m{θ},\m{ι},\m{κ},\m{λ},\m{μ},
+   \m{ν},\m{ξ},\m{ο},\m{π},\m{ρ},\m{σ},
+   \m{τ},\m{υ},\m{φ},\m{χ},\m{ψ},\m{ω}]
+
 %D Symbol sets:
 
 \ifdefined\symbol \else \def\symbol[#1]{#1} \fi % todo
diff --git a/tex/context/base/core-dat.lua b/tex/context/base/core-dat.lua
index 2317eb759..071a3fe0b 100644
--- a/tex/context/base/core-dat.lua
+++ b/tex/context/base/core-dat.lua
@@ -234,3 +234,13 @@ function commands.pagestaterealpage(name,tag)
         context(t)
     end
 end
+
+function commands.setpagestaterealpageno(name,tag)
+    local t = collected[name]
+    t = t and (t[tag] or t[tonumber(tag)])
+    if t then
+        texcount.realpagestateno = t
+    else
+        texcount.realpagestateno = texcount.realpageno
+    end
+end
diff --git a/tex/context/base/core-dat.mkiv b/tex/context/base/core-dat.mkiv
index f1d2a52cb..5aef39d69 100644
--- a/tex/context/base/core-dat.mkiv
+++ b/tex/context/base/core-dat.mkiv
@@ -95,4 +95,7 @@
 \def\pagestaterealpage#1#2%
   {\ctxcommand{pagestaterealpage("#1","#2")}}
 
+\def\setpagestaterealpageno#1#2%
+  {\ctxcommand{setpagestaterealpageno("#1","#2")}}
+
 \protect
diff --git a/tex/context/base/file-mod.lua b/tex/context/base/file-mod.lua
index 75e898f4b..e6592f0f0 100644
--- a/tex/context/base/file-mod.lua
+++ b/tex/context/base/file-mod.lua
@@ -154,7 +154,7 @@ end)
 
 -- moved from syst-lua.lua:
 
-local splitter = lpeg.tsplitat(lpeg.S(". "))
+local splitter = lpeg.tsplitter(lpeg.S(". "),tonumber)
 
 function commands.doifolderversionelse(one,two) -- one >= two
     if not two then
@@ -162,11 +162,9 @@ function commands.doifolderversionelse(one,two) -- one >= two
     elseif one == "" then
         one = environment.version
     end
-    local y_1, m_1, d_1 = lpeg.match(splitter,one)
-    local y_2, m_2, d_2 = lpeg.match(splitter,two)
-    commands.testcase (
-        (tonumber(y_1) or 0) >= (tonumber(y_2) or 0) and
-        (tonumber(m_1) or 0) >= (tonumber(m_2) or 0) and
-        (tonumber(d_1) or 0) >= (tonumber(d_1) or 0)
-    )
+    one = lpeg.match(splitter,one)
+    two = lpeg.match(splitter,two)
+    one = (one[1] or 0) * 10000 + (one[2] or 0) * 100 + (one[3] or 0)
+    two = (two[1] or 0) * 10000 + (two[2] or 0) * 100 + (two[3] or 0)
+    commands.testcase(one>=two)
 end
diff --git a/tex/context/base/mult-sys.mkiv b/tex/context/base/mult-sys.mkiv
index bf40fa8c1..4ec4c2221 100644
--- a/tex/context/base/mult-sys.mkiv
+++ b/tex/context/base/mult-sys.mkiv
@@ -342,6 +342,7 @@
 \definesystemconstant  {full}
 \definesystemconstant  {text}
 \definesystemconstant  {paragraph}
+\definesystemconstant  {margintext}
 \definesystemconstant  {line}
 
 \definesystemconstant  {number}
diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv
index 73c1be29f..f65641b96 100644
--- a/tex/context/base/pack-rul.mkiv
+++ b/tex/context/base/pack-rul.mkiv
@@ -2530,9 +2530,6 @@
      \egroup
      \forgetall % brrr too often
      \vskip-\lineheight
-     % will be an option, not default
-     % \setbaselinecorrections
-     % \donegbotbaselinecorrection
      \verticalstrut
    \else
      \egroup
diff --git a/tex/context/base/s-art-01.mkiv b/tex/context/base/s-art-01.mkiv
index d62689798..10b4de9ab 100644
--- a/tex/context/base/s-art-01.mkiv
+++ b/tex/context/base/s-art-01.mkiv
@@ -3,34 +3,34 @@
 % \showframe
 
 \setuplayout
-  [topspace=2cm,
-   bottomspace=2.5cm,
-   width=middle,
-   height=middle,
-   footer=0pt]
+  [\c!topspace=2cm,
+   \c!bottomspace=2.5cm,
+   \c!width=\v!middle,
+   \c!height=\v!middle,
+   \c!footer=0pt]
 
 \setupbodyfont
   [dejavu]
 
 \setupwhitespace
-  [big]
+  [\v!big]
 
 \setuphead
-  [chapter]
-  [style=\bfc,
-   headerstate=high]
+  [\v!chapter]
+  [\c!style=\bfc,
+   \c!headerstate=\v!high]
 
 \setuphead
-  [section]
-  [style=\bfb]
+  [\v!section]
+  [\c!style=\bfb]
 
 \setuphead
-  [subsection]
-  [style=\bfa]
+  [\v!subsection]
+  [\c!style=\bfa]
 
 \setuphead
-  [subsubsection]
-  [style=\bf,
-   after=]
+  [\v!subsubsection]
+  [\c!style=\bf,
+   \c!after=]
 
 \stopmodule
diff --git a/tex/context/base/spac-ali.mkiv b/tex/context/base/spac-ali.mkiv
index ff384d13d..57806b6f2 100644
--- a/tex/context/base/spac-ali.mkiv
+++ b/tex/context/base/spac-ali.mkiv
@@ -37,9 +37,21 @@
 \installcorenamespace{aligncommand}
 \installcorenamespace{alignhorizontal}
 \installcorenamespace{alignvertical}
+
 \installcorenamespace{alignmentnormalcache}
 \installcorenamespace{alignmentraggedcache}
 
+% nasty hack:
+
+\installcorenamespace{alignmentnormalcacheodd}
+\installcorenamespace{alignmentnormalcacheeven}
+
+\installcorenamespace{alignmentraggedcacheodd}
+\installcorenamespace{alignmentraggedcacheeven}
+
+\def\??alignmentnormalcache{\ifodd\realpageno\??alignmentnormalcacheodd\else\??alignmentnormalcacheeven\fi}
+\def\??alignmentraggedcache{\ifodd\realpageno\??alignmentraggedcacheodd\else\??alignmentraggedcacheeven\fi}
+
 \newtoks\everyresetalign % todo
 
 % We will not use bodydir and pagedir so we disable them. That way we get
@@ -503,7 +515,7 @@
      \rawprocesscommacommand[\askedraggedalign]\spac_align_collect
    \fi
    \normalexpanded{\t_spac_align_collected
-     {% \resetrealignsignal % can go as it is alway set
+     {% \resetrealignsignal % can go as it is always set
       \setfalse\raggedonelinerstate % bad
       \the\t_spac_align_collected
       \spac_align_flush_horizontal
diff --git a/tex/context/base/spac-grd.mkiv b/tex/context/base/spac-grd.mkiv
index 0fd837bba..af9babe15 100644
--- a/tex/context/base/spac-grd.mkiv
+++ b/tex/context/base/spac-grd.mkiv
@@ -100,27 +100,41 @@
 % \definecolor[GridLineColor][red]
 % \definecolor[GridTextColor][blue]
 
-\let\thetopbaselinecorrection   \!!zeropoint
-\let\thebotbaselinecorrection   \!!zeropoint
-\let\thenegtopbaselinecorrection\!!zeropoint
-\let\thenegbotbaselinecorrection\!!zeropoint
-
-\def\setbaselinecorrections
-  {\setbox0\hbox{\setstrut\strut}%
-   \setbox2\hbox{(}%
-   \dimen0\ht0\advance\dimen0 -\ht2
-   \ifdim\dimen0<\zeropoint\dimen0\zeropoint\fi
-   \dimen2\dp0\advance\dimen2 -\dp2
-   \ifdim\dimen2<\zeropoint\dimen2\zeropoint\fi
-   \edef\thetopbaselinecorrection   {\the\dimen0}\dimen0-\dimen0
-   \edef\thebotbaselinecorrection   {\the\dimen2}\dimen2-\dimen2
-   \edef\thenegtopbaselinecorrection{\the\dimen0}%
-   \edef\thenegbotbaselinecorrection{\the\dimen2}}
-
-\def\dotopbaselinecorrection   {\kern\thetopbaselinecorrection}
-\def\dobotbaselinecorrection   {\kern\thebotbaselinecorrection}
-\def\donegtopbaselinecorrection{\kern\thenegtopbaselinecorrection}
-\def\donegbotbaselinecorrection{\kern\thenegbotbaselinecorrection}
+\newdimen\d_spac_lines_correction_before
+\newdimen\d_spac_lines_correction_after
+
+\newbox  \b_spac_lines_correction_before
+\newbox  \b_spac_lines_correction_after
+
+\def\spac_lines_initialize_corrections
+  {\setbox\b_spac_lines_correction_before\hbox{\setstrut\strut}%
+   \setbox\b_spac_lines_correction_after \hbox{(}%
+   \d_spac_lines_correction_before\dimexpr\ht\b_spac_lines_correction_before-\ht\b_spac_lines_correction_after\relax
+   \d_spac_lines_correction_after \dimexpr\dp\b_spac_lines_correction_before-\dp\b_spac_lines_correction_after\relax
+   \ifdim\d_spac_lines_correction_before<\zeropoint\d_spac_lines_correction_before\zeropoint\fi
+   \ifdim\d_spac_lines_correction_after <\zeropoint\d_spac_lines_correction_after \zeropoint\fi}
+
+\unexpanded\def\dotopbaselinecorrection{\kern\d_spac_lines_correction_before}
+\unexpanded\def\dobotbaselinecorrection{\kern\d_spac_lines_correction_after }
+
+% experiment, todo: proper mkiv mechanism
+%
+% \input ward \par
+% \startframedtext test  \stopframedtext
+% \input ward \par
+% \startlinecorrection \framed{xxx} \stoplinecorrection
+% \input ward \par
+%
+% \setupwhitespace[big]
+%
+% \input ward \par
+% \startframedtext test  \stopframedtext
+% \input ward \par
+% \startlinecorrection \framed{xxx} \stoplinecorrection
+% \input ward \par
+
+\unexpanded\def\dotopbaselinecorrection{\expandafter\blank\expandafter[\the\d_spac_lines_correction_before]}
+\unexpanded\def\dobotbaselinecorrection{\expandafter\blank\expandafter[\the\d_spac_lines_correction_after ]}
 
 \def\showbaselinecorrection
   {\def\dobaselinecorrection % visualization is not watertight!
@@ -135,9 +149,9 @@
       \egroup
       \prevdepth\strutdp}%
    \def\dotopbaselinecorrection
-     {\hrule\!!height\thetopbaselinecorrection}%
+     {\hrule\!!height\d_spac_lines_correction_before}%
    \def\dobotbaselinecorrection
-     {\hrule\!!height\thebotbaselinecorrection}}
+     {\hrule\!!height\d_spac_lines_correction_after}}
 
 \def\dobaselinecorrection % beware, this one is redefined / used locally elsewhere
   {\ifdim\prevdepth>\zeropoint\kern-\prevdepth\fi
@@ -227,7 +241,7 @@
 \def\forcedtopbaselinecorrection
   {\ifvmode
      \bgroup
-     \setbaselinecorrections
+     \spac_lines_initialize_corrections
      \whitespace % no longer ok
      \nointerlineskip
      \dotopbaselinecorrection
@@ -237,7 +251,7 @@
 \def\botbaselinecorrection
   {\ifvmode
      \bgroup
-     \setbaselinecorrections
+     \spac_lines_initialize_corrections
      \dobotbaselinecorrection
      \allowbreak % new, otherwise problems when many in a row
      \prevdepth\strutdp
@@ -245,27 +259,6 @@
    \fi}
 
 \let\forcedbotbaselinecorrection\botbaselinecorrection
-
-% experiment, todo: proper mkiv mechanism
-%
-% \input ward \par
-% \startframedtext test  \stopframedtext
-% \input ward \par
-% \startlinecorrection \framed{xxx} \stoplinecorrection
-% \input ward \par
-%
-% \setupwhitespace[big]
-%
-% \input ward \par
-% \startframedtext test  \stopframedtext
-% \input ward \par
-% \startlinecorrection \framed{xxx} \stoplinecorrection
-% \input ward \par
-
-\def\dotopbaselinecorrection   {\blank[\thetopbaselinecorrection   ]}
-\def\dobotbaselinecorrection   {\blank[\thebotbaselinecorrection   ]}
-\def\donegtopbaselinecorrection{\blank[\thenegtopbaselinecorrection]}
-\def\donegbotbaselinecorrection{\blank[\thenegbotbaselinecorrection]}
 
 % nointerlineskip
 %
@@ -277,8 +270,8 @@
 \def\forcedtopbaselinecorrection
   {\ifvmode
      \bgroup
-     \setbaselinecorrections
-     \vspacing[white]
+     \spac_lines_initialize_corrections
+     \vspacing[\v!white]
 %      \nointerlineskip %
      \dotopbaselinecorrection
      \egroup
diff --git a/tex/context/base/spac-pag.mkiv b/tex/context/base/spac-pag.mkiv
index 10b5d1acd..da4c8e970 100644
--- a/tex/context/base/spac-pag.mkiv
+++ b/tex/context/base/spac-pag.mkiv
@@ -18,8 +18,6 @@
 %D The code here has evolved over time and might not be the best
 %D around. Maybe much will be gone a some point.
 
-%D The pagestate code will be redone.
-
 \installcorenamespace {alignswitch}
 
 \letvalue{\??alignswitch\v!left  }\zerocount
@@ -38,107 +36,22 @@
      \doforcedtrackpagestate{#1}{#2}%
    \fi \fi}
 
-% \def\doforcedtrackpagestate#1#2%
-%   {\ifcase\frozenpagestate
-%      \global\advance#2\plusone
-%      \lazysavetaggedtwopassdata{#1}{0}{\number#2}{\noexpand\realfolio}%
-%    \fi}
-
 \def\doforcedtrackpagestate#1#2%
   {\ifcase\frozenpagestate
      \global\advance#2\plusone
      \setpagestate[#1][\number#2]%
    \fi}
 
-% \def\doifrightpagestateelse#1#2% not expandable !
-%   {\ifcase\frozenpagestate
-%      \pagestatemismatchfalse
-%      \realpagestateno\realfolio
-%      \ifinpagebody
-%        \ifdoublesided
-%          \ifodd\realpageno\relax
-%            \syst_twopass_set_found
-%          \else
-%            \syst_twopass_set_not_found
-%          \fi
-%        \else
-%          \syst_twopass_set_found
-%        \fi
-%      \else\ifdoublesided
-%        \findtwopassdata{#1}{\number#2}%
-%        \ifconditional\twopassdatafound
-%          \realpagestateno\twopassdata\relax
-%          \ifnum\twopassdata=\realpageno \else
-%            \pagestatemismatchtrue
-%          \fi
-%          \ifodd\twopassdata\relax
-%            \syst_twopass_set_found
-%          \else
-%            \syst_twopass_set_not_found
-%          \fi
-%        \else
-%          \ifodd\realpageno\relax
-%            \syst_twopass_set_found
-%          \else
-%            \syst_twopass_set_not_found
-%          \fi
-%        \fi
-%      \else
-%        \syst_twopass_set_found
-%      \fi\fi
-%    \else
-%      \ifodd\realpagestateno\relax
-%        \syst_twopass_set_found
-%      \else
-%        \syst_twopass_set_not_found
-%      \fi
-%    \fi
-%    \ifconditional\twopassdatafound
-%      \expandafter\firstoftwoarguments
-%    \else
-%      \expandafter\secondoftwoarguments
-%    \fi}
-
-% \def\doifforcedrightpagestateelse#1#2%
-%   {\ifcase\frozenpagestate
-%      \pagestatemismatchfalse
-%      \realpagestateno\realfolio
-%      \findtwopassdata{#1}{\number#2}%
-%      \ifconditional\twopassdatafound
-%        \realpagestateno\twopassdata\relax
-%        \ifnum\twopassdata=\realpageno \else
-%          \pagestatemismatchtrue
-%        \fi
-%        \ifodd\twopassdata\relax
-%          \syst_twopass_set_found
-%        \else
-%          \syst_twopass_set_not_found
-%        \fi
-%      \else
-%        \ifodd\realpageno\relax
-%          \syst_twopass_set_found
-%        \else
-%          \syst_twopass_set_not_found
-%        \fi
-%      \fi
-%    \else
-%      \ifodd\realpagestateno\relax
-%        \syst_twopass_set_found
-%      \else
-%        \syst_twopass_set_not_found
-%      \fi
-%    \fi
-%    \ifconditional\twopassdatafound
-%      \expandafter\firstoftwoarguments
-%    \else
-%      \expandafter\secondoftwoarguments
-%    \fi}
-
 \let\m_spac_pagestates_realpage\empty
 
 \newconditional\c_spac_pagestates_found
 
-\def\doifrightpagestateelse#1#2% not expandable !
+\unexpanded\def\docheckpagestate#1#2%
+  {\ifcase\frozenpagestate
+     \setpagestaterealpageno{#1}{\number#2}%
+   \fi}
+
+\unexpanded\def\doifrightpagestateelse#1#2% not expandable !
   {\ifcase\frozenpagestate
      \pagestatemismatchfalse
      \realpagestateno\realfolio
@@ -187,7 +100,7 @@
      \expandafter\secondoftwoarguments
    \fi}
 
-\def\doifforcedrightpagestateelse#1#2%
+\unexpanded\def\doifforcedrightpagestateelse#1#2%
   {\ifcase\frozenpagestate
      \pagestatemismatchfalse
      \realpagestateno\realfolio
@@ -222,42 +135,24 @@
      \expandafter\secondoftwoarguments
    \fi}
 
-\def\freezepagestate {\frozenpagestate\plusone  }
-\def\defrostpagestate{\frozenpagestate\zerocount}
+\unexpanded\def\freezepagestate {\frozenpagestate\plusone  }
+\unexpanded\def\defrostpagestate{\frozenpagestate\zerocount}
 
 % we can make more of these on top, but how to deal with mixed frozen states
 
 % \dorecurse{500}{\dontleavehmode\signalrightpage\doifrightpageelse{right}{left}\par} % given doublesided
 
-% \definetwopasslist\s!paragraph
-
 \newcount\nofraggedparagraphs
 
 \definepagestate[\s!paragraph]
 
-\def\signalrightpage  {\dotrackpagestate      \s!paragraph\nofraggedparagraphs} % use \dontleavehmode if needed
-\def\doifrightpageelse{\doifrightpagestateelse\s!paragraph\nofraggedparagraphs}
+\unexpanded\def\signalrightpage  {\dotrackpagestate      \s!paragraph\nofraggedparagraphs} % use \dontleavehmode if needed
+\unexpanded\def\doifrightpageelse{\doifrightpagestateelse\s!paragraph\nofraggedparagraphs}
 
 \installcorenamespace{pagechanges}
 
 \newif\ifpagechanged \let\lastchangedpage\empty
 
-% \def\spac_pagechanges_check#1#2#3%
-%   {\pagechangedfalse
-%    \doforcedtrackpagestate{#2}{#3}%
-%    \findtwopassdata{#2}{\number#3}%
-%    \ifconditional\twopassdatafound
-%      \ifnum\twopassdata>0\getvalue{\??pagechanges#2:#1}\relax
-%        \pagechangedtrue
-%      \fi
-%    \fi
-%    \ifpagechanged
-%      \letgvalue{\??pagechanges#2:#1}\twopassdata
-%      \globallet\lastchangedpage\twopassdata
-%    \else
-%      \globallet\lastchangedpage\realfolio
-%    \fi}
-
 \def\spac_pagechanges_check#1#2#3%
   {\pagechangedfalse
    \doforcedtrackpagestate{#2}{#3}%
diff --git a/tex/context/base/spac-ver.mkiv b/tex/context/base/spac-ver.mkiv
index f962e6694..c7d097ccb 100644
--- a/tex/context/base/spac-ver.mkiv
+++ b/tex/context/base/spac-ver.mkiv
@@ -468,15 +468,16 @@
 \let\m_spac_lines_around           \empty
 
 \setvalue{\??linesaround\v!blank  }{\blank}
+\setvalue{\??linesaround\v!local  }{\setlocalhsize}
 \letvalue{\??linesaround\empty    }\relax
 \setvalue{\??linesaround\s!unknown}{\blank[\m_spac_lines_around]}
 
 \unexpanded\def\startlinecorrection
-  {\dodoubleempty\spac_lines_start_correction}
+  {\bgroup
+   \dodoubleempty\spac_lines_start_correction}
 
 \def\spac_lines_start_correction[#1][#2]% #2 gobbles spaces
-  {\bgroup
-   \edef\m_spac_lines_around{#1}%
+  {\edef\m_spac_lines_around{#1}%
    \expandafter\let\expandafter\spac_lines_action_around\csname\??linesaround
      \ifcsname\??linesaround\m_spac_lines_around\endcsname\m_spac_lines_around\else\s!unknown\fi
    \endcsname
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 9b26595cf..4ee6cbf9d 100644
Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index c3a27cc4d..05e586174 100644
Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ
diff --git a/tex/context/base/strc-itm.mkvi b/tex/context/base/strc-itm.mkvi
index d0191f78f..86acba33c 100644
--- a/tex/context/base/strc-itm.mkvi
+++ b/tex/context/base/strc-itm.mkvi
@@ -990,8 +990,8 @@
      \strc_itemgroups_between_command
    \fi}
 
-\unexpanded\def\strc_itemgroups_start_item[#reference]% we can reuse more
-  {\def\currentitemreference{#reference}%
+\unexpanded\def\strc_itemgroups_start_item[#1]% we can reuse more
+  {\def\currentitemreference{#1}%
    \ifconditional\c_strc_itemgroups_text
      % begin of item
    \else
@@ -1007,7 +1007,9 @@
      \strc_itemgroups_start_item_next
    \fi
    \ifconditional\c_strc_itemgroups_concat
-     \vskip-\dimexpr\lastskip+\lineheight\relax
+   % \vskip-\dimexpr\lastskip+\lineheight\relax
+     \vskip-\lastskip   % we cannot use a \dimexpr here  because
+     \vskip-\lineheight % then we loose the stretch and shrink
      \nobreak
      \setfalse\c_strc_itemgroups_concat
    \fi
diff --git a/tex/context/base/typo-mar.mkiv b/tex/context/base/typo-mar.mkiv
index e1b25a9ae..a393fc250 100644
--- a/tex/context/base/typo-mar.mkiv
+++ b/tex/context/base/typo-mar.mkiv
@@ -154,6 +154,19 @@
 % trialtypesetting: no need for margin stuff while trialing as
 % is has no dimensions
 
+\definesystemconstant{margintext}
+
+\newcount\nofmargintexts
+
+\definepagestate[\s!margintext]
+
+\unexpanded\def\typo_margins_data_synchronize
+  {\doforcedtrackpagestate\s!margintext\nofmargintexts % includes increment
+   \docheckpagestate\s!margintext\nofmargintexts
+  %\doifrightpagestateelse\s!margintext\nofmargintexts\relax\relax
+   \realpageno\realpagestateno
+   \swapmargins}
+
 \unexpanded\def\margindata
   {\iftrialtypesetting
      \expandafter\typo_margins_data_nop
@@ -192,6 +205,7 @@
          \the\everymargindatacontent
          \usemargindatastyleandcolor\c!style\c!color
          \setupcurrentmarginframed[\c!location=\v!normal,#textparameters]%
+\typo_margins_data_synchronize
          \inheritedmarginframedframed\bgroup
            \ifx\currentmargindatastrut\empty \else
              \synchronizestrut\currentmargindatastrut
@@ -207,6 +221,7 @@
        \edef\currentmargindatawidth{\margindataparameter\c!width}%
        \ifx\currentmargindatawidth\empty
          \setbox\nextbox\hbox \currentmarginreference \bgroup
+\typo_margins_data_synchronize
            \the\everymargindatacontent
            \usemargindatastyleandcolor\c!style\c!color
            \ifx\currentmargindatastrut\empty \else
@@ -219,8 +234,9 @@
          \egroup
          \let\currentmarginfirstheight\empty
        \else
-         \dosetraggedcommand{\margindataparameter\c!align}%
          \setbox\nextbox\hbox \currentmarginreference \bgroup
+\typo_margins_data_synchronize
+           \dosetraggedcommand{\margindataparameter\c!align}%
            \vtop \bgroup
              \the\everymargindatacontent
              \usemargindatastyleandcolor\c!style\c!color
@@ -241,7 +257,7 @@
      \dostoptagged
    \fi
    \ifdone
-     \anch_positions_initialize % we use positions at the lua end (will become pdf.h/v)
+     \anch_positions_initialize % we use positions at the lua end
      \ctxlua{typesetters.margins.save{
        location    = "\margindataparameter\c!location",
        method      = "\margindataparameter\c!method",
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 50a0716a0..64c8a69ec 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  : 05/08/12 23:00:24
+-- merge date  : 05/10/12 17:00:26
 
 do -- begin closure to overcome local limits and interference
 
-- 
cgit v1.2.3