From 6472806d2b22969e53d332eec7331d26099adb3d Mon Sep 17 00:00:00 2001
From: Marius <mariausol@gmail.com>
Date: Fri, 26 Aug 2011 03:00:14 +0300
Subject: beta 2011.08.26 01:43

---
 tex/context/base/cont-new.mkii                     |   2 +-
 tex/context/base/cont-new.mkiv                     |   2 +-
 tex/context/base/context-version.pdf               | Bin 4091 -> 4089 bytes
 tex/context/base/context-version.png               | Bin 105302 -> 104744 bytes
 tex/context/base/context.mkii                      |   2 +-
 tex/context/base/context.mkiv                      |   2 +-
 tex/context/base/lpdf-fmt.lua                      |   2 +-
 tex/context/base/lxml-tab.lua                      |  67 ++++++++++++---------
 tex/context/base/lxml-xml.lua                      |  21 ++++---
 tex/context/base/pack-rul.mkiv                     |   2 +-
 tex/context/base/s-mod-00.mkiv                     |  12 ++--
 tex/context/base/scrn-fld.mkvi                     |   2 +-
 tex/context/base/status-files.pdf                  | Bin 23872 -> 23870 bytes
 tex/context/base/status-lua.pdf                    | Bin 162209 -> 162205 bytes
 tex/generic/context/luatex/luatex-fonts-merged.lua |   2 +-
 15 files changed, 64 insertions(+), 52 deletions(-)

(limited to 'tex')

diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index 606d035fd..b6dbba5e0 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{2011.08.23 13:04}
+\newcontextversion{2011.08.26 01:43}
 
 %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 22b9b10d9..6ee2a3bfb 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{2011.08.23 13:04}
+\newcontextversion{2011.08.26 01:43}
 
 %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 a43882f0a..8c927f12b 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 192df98ef..4e9c93bbe 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 ce774e9d8..578783b40 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{2011.08.23 13:04}
+\edef\contextversion{2011.08.26 01:43}
 
 %D For those who want to use this:
 
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 705823f3b..433fbb340 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -20,7 +20,7 @@
 %D your styles an modules.
 
 \edef\contextformat {\jobname}
-\edef\contextversion{2011.08.23 13:04}
+\edef\contextversion{2011.08.26 01:43}
 
 %D For those who want to use this:
 
diff --git a/tex/context/base/lpdf-fmt.lua b/tex/context/base/lpdf-fmt.lua
index 29f2ef5a0..8e118db12 100644
--- a/tex/context/base/lpdf-fmt.lua
+++ b/tex/context/base/lpdf-fmt.lua
@@ -438,7 +438,7 @@ local function handleinternalprofile(s,include)
                 elseif not channel then
                     report_backend("error, couldn't resolve channel entry for colorspace '%s'",colorspace)
                 else
-                    profile = pdfflushstreamfileobject(fullname,{ N = channel },false) -- uncompressed
+                    profile = pdfflushstreamfileobject(fullname,pdfdictionary{ N = channel },false) -- uncompressed
                     internalprofiles[tag] = profile
                     if trace_format then
                         report_backend("including '%s' color profile from '%s'",colorspace,fullname)
diff --git a/tex/context/base/lxml-tab.lua b/tex/context/base/lxml-tab.lua
index 99c7226a8..1e4601998 100644
--- a/tex/context/base/lxml-tab.lua
+++ b/tex/context/base/lxml-tab.lua
@@ -346,7 +346,7 @@ local predefined_simplified = {
 
 local nofprivates = 0xF0000 -- shared but seldom used
 
-local privates_u = {
+local privates_u = { -- unescaped
     [ [[&]] ] = "&amp;",
     [ [["]] ] = "&quot;",
     [ [[']] ] = "&apos;",
@@ -457,40 +457,44 @@ local function handle_any_entity(str)
         if not a then
             a = resolve_predefined and predefined_simplified[str]
             if a then
-                -- one of the predefined
-            elseif type(resolve) == "function" then
-                a = resolve(str) or entities[str]
-            else
-                a = entities[str]
-            end
-            if a then
-                if type(a) == "function" then
-                    if trace_entities then
-                        report_xml("expanding entity &%s; (function)",str)
-                    end
-                    a = a(str) or ""
-                end
-                a = lpegmatch(parsedentity,a) or a
                 if trace_entities then
-                    report_xml("resolved entity &%s; -> %s (internal)",str,a)
+                    report_xml("resolved entity &%s; -> %s (predefined)",str,a)
                 end
             else
-                local unknown_any_entity = placeholders.unknown_any_entity
-                if unknown_any_entity then
-                    a = unknown_any_entity(str) or ""
+                if type(resolve) == "function" then
+                    a = resolve(str) or entities[str]
+                else
+                    a = entities[str]
                 end
                 if a then
+                    if type(a) == "function" then
+                        if trace_entities then
+                            report_xml("expanding entity &%s; (function)",str)
+                        end
+                        a = a(str) or ""
+                    end
+                    a = lpegmatch(parsedentity,a) or a -- for nested
                     if trace_entities then
-                        report_xml("resolved entity &%s; -> %s (external)",str,a)
+                        report_xml("resolved entity &%s; -> %s (internal)",str,a)
                     end
                 else
-                    if trace_entities then
-                        report_xml("keeping entity &%s;",str)
+                    local unknown_any_entity = placeholders.unknown_any_entity
+                    if unknown_any_entity then
+                        a = unknown_any_entity(str) or ""
                     end
-                    if str == "" then
-                        a = "&error;"
+                    if a then
+                        if trace_entities then
+                            report_xml("resolved entity &%s; -> %s (external)",str,a)
+                        end
                     else
-                        a = "&" .. str .. ";"
+                        if trace_entities then
+                            report_xml("keeping entity &%s;",str)
+                        end
+                        if str == "" then
+                            a = "&error;"
+                        else
+                            a = "&" .. str .. ";"
+                        end
                     end
                 end
             end
@@ -632,6 +636,7 @@ local publicdoctype    = doctypename * somespace * P("PUBLIC") * somespace * val
 local systemdoctype    = doctypename * somespace * P("SYSTEM") * somespace * value * somespace * doctypeset
 local simpledoctype    = (1-close)^1 -- * balanced^0
 local somedoctype      = C((somespace * (publicdoctype + systemdoctype + definitiondoctype + simpledoctype) * optionalspace)^0)
+local somedoctype      = C((somespace * (publicdoctype + systemdoctype + definitiondoctype + simpledoctype) * optionalspace)^0)
 
 local instruction      = (spacing * begininstruction * someinstruction * endinstruction) / function(...) add_special("@pi@",...) end
 local comment          = (spacing * begincomment     * somecomment     * endcomment    ) / function(...) add_special("@cm@",...) end
@@ -685,6 +690,8 @@ local function xmlconvert(data, settings)
         resolve_predefined = true
     end
     --
+--~ inspect(settings)
+    --
     stack, top, at, xmlns, errorstr = { }, { }, { }, { }, nil
     acache, hcache, dcache = { }, { }, { } -- not stored
     reported_attribute_errors = { }
@@ -745,11 +752,11 @@ local function xmlconvert(data, settings)
     if errorstr and errorstr ~= "" then
         result.error = true
     end
-strip, utfize, resolve, resolve_predefined = nil, nil, nil, nil
-unify_predefined, cleanup, entities = nil, nil, nil
-stack, top, at, xmlns, errorstr = nil, nil, nil, nil, nil
-acache, hcache, dcache = nil, nil, nil
-reported_attribute_errors, mt, errorhandler = nil, nil, nil
+    strip, utfize, resolve, resolve_predefined = nil, nil, nil, nil
+    unify_predefined, cleanup, entities = nil, nil, nil
+    stack, top, at, xmlns, errorstr = nil, nil, nil, nil, nil
+    acache, hcache, dcache = nil, nil, nil
+    reported_attribute_errors, mt, errorhandler = nil, nil, nil
     return result
 end
 
diff --git a/tex/context/base/lxml-xml.lua b/tex/context/base/lxml-xml.lua
index 5012f69e5..05405015d 100644
--- a/tex/context/base/lxml-xml.lua
+++ b/tex/context/base/lxml-xml.lua
@@ -111,10 +111,10 @@ local function chainattribute(collected,arguments) -- todo: optional levels
     return ""
 end
 
-local function raw(collected) -- hybrid
+local function raw(collected) -- hybrid (not much different from text so it might go)
     if collected then
         local e = collected[1] or collected
-        return (e and xmlserialize(e)) or "" -- only first as we cannot concat function
+        return e and xmltostring(e) or "" -- only first as we cannot concat function
     else
         return ""
     end
@@ -138,10 +138,15 @@ local xmltexthandler = xmlnewhandlers {
 }
 
 local function xmltotext(root)
-    if not root then
+    local dt = root.dt
+    if not dt then
         return ""
-    elseif type(root) == 'string' then
-        return root
+    end
+    local nt = #dt -- string or table
+    if nt == 0 then
+        return ""
+    elseif nt == 1 and type(dt[1]) == "string" then
+        return dt[1] -- no escaping of " ' < > &
     else
         return xmlserialize(root,xmltexthandler) or ""
     end
@@ -152,7 +157,7 @@ end
 local function text(collected) -- hybrid
     if collected then
         local e = collected[1] or collected
-        return (e and xmltotext(e.dt)) or ""
+        return (e and xmltotext(e)) or ""
     else
         return ""
     end
@@ -300,10 +305,10 @@ function xml.text(id,pattern)
     if pattern then
      -- return text(xmlfilter(id,pattern))
         local collected = xmlfilter(id,pattern)
-        return (collected and xmltotext(collected[1].dt)) or ""
+        return (collected and xmltotext(collected[1])) or ""
     elseif id then
      -- return text(id)
-        return xmltotext(id.dt) or ""
+        return xmltotext(id) or ""
     else
         return ""
     end
diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv
index c6743117c..97724ff00 100644
--- a/tex/context/base/pack-rul.mkiv
+++ b/tex/context/base/pack-rul.mkiv
@@ -1169,7 +1169,7 @@
 %D future extensions.
 
 %D \macros
-%D   {\doassigncheckedframeoffset}
+%D   {doassigncheckedframeoffset}
 %D
 %D Offset helper (see menus):
 
diff --git a/tex/context/base/s-mod-00.mkiv b/tex/context/base/s-mod-00.mkiv
index eadefbe12..3752f85ca 100644
--- a/tex/context/base/s-mod-00.mkiv
+++ b/tex/context/base/s-mod-00.mkiv
@@ -272,7 +272,7 @@
   {\EveryPar
      {\doglobal\newcounter\NOfMarginLines}}
 
-\def\dodomargeaanduidingen[#1]#2%
+\unexpanded\def\dodomargeaanduidingen[#1]#2%
   {\def\docommand##1%
      {\indent\hbox
         {\ifx#2\relax
@@ -285,7 +285,7 @@
        \endgraf}%
    \processcommalist[#1]\docommand}
 
-\def\margeaanduidingen#1[#2]%
+\unexpanded\def\margeaanduidingen#1[#2]% to be renamed
   {\def\domargeaanduidingen##1##2%
      {\margintitle[#2]%
         {\switchtobodyfont[\v!small]%
@@ -299,13 +299,13 @@
          \processcommalist[##2]\index}}%
    \dodoublegroupempty\domargeaanduidingen}
 
-\def\complexmacros{\margeaanduidingen\tex  }
-\def\complexextras{\margeaanduidingen\relax}
+\unexpanded\def\complexmacros{\margeaanduidingen\tex  }
+\unexpanded\def\complexextras{\margeaanduidingen\relax}
 
-\def\complexelements
+\unexpanded\def\complexelements
   {\margeaanduidingen\someelement}
 
-\def\someelement#1{\type{<#1>}}
+\unexpanded\def\someelement#1{\type{<#1>}}
 
 \definecomplexorsimpleempty\macros
 \definecomplexorsimpleempty\extras
diff --git a/tex/context/base/scrn-fld.mkvi b/tex/context/base/scrn-fld.mkvi
index f25685788..c786f3832 100644
--- a/tex/context/base/scrn-fld.mkvi
+++ b/tex/context/base/scrn-fld.mkvi
@@ -443,7 +443,7 @@
      \setupfieldcontentframed[#tag][\s!parent=\??wc,#variant]%
    \fi\fi\fi\fi}
 
-\def\scrn_field_setup_fields[#variant][#totalsettings][#labelsettings][#fieldsettings]
+\def\scrn_field_setup_fields[#variant][#totalsettings][#labelsettings][#fieldsettings]%
   {\iffourthargument
      \setupfieldtotalframed  [\c!alternative={#variant},#totalsettings]%
      \setupfieldlabelframed  [#labelsettings]%
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 42f71838c..c9d27a01e 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 ab1c683f0..c8d4e573f 100644
Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 8bd088870..99c22f268 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/23/11 13:04:49
+-- merge date  : 08/26/11 01:43:42
 
 do -- begin closure to overcome local limits and interference
 
-- 
cgit v1.2.3