From 250c6bdd3d89cde9d2401172ea0310536eb58db8 Mon Sep 17 00:00:00 2001 From: Marius Date: Tue, 29 May 2012 20:00:14 +0300 Subject: beta 2012.05.29 18:43 --- scripts/context/lua/mtxrun.lua | 75 ++++++++++++++++++++- scripts/context/stubs/mswin/mtxrun.lua | 75 ++++++++++++++++++++- scripts/context/stubs/unix/mtxrun | 75 ++++++++++++++++++++- tex/context/base/chem-str.lua | 18 ++--- tex/context/base/chem-str.mkiv | 10 +-- tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4129 -> 4131 bytes tex/context/base/context-version.png | Bin 106186 -> 106219 bytes tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 2 +- tex/context/base/font-emp.mkvi | 4 ++ tex/context/base/lxml-aux.lua | 47 ++++++++++++- tex/context/base/lxml-tab.lua | 28 ++++++++ tex/context/base/status-files.pdf | Bin 24405 -> 24421 bytes tex/context/base/status-lua.pdf | Bin 180115 -> 180131 bytes tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 17 files changed, 319 insertions(+), 23 deletions(-) diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index d2f7e408f..644c1d9b2 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -8174,6 +8174,34 @@ function xml.makestandalone(root) return root end +function xml.kind(e) + local dt = e and e.dt + if dt then + local n = #dt + if n == 1 then + local d = dt[1] + if d.special then + local tg = d.tg + if tg == "@cd@" then + return "cdata" + elseif tg == "@cm" then + return "comment" + elseif tg == "@pi@" then + return "instruction" + elseif tg == "@dt@" then + return "declaration" + end + elseif type(d) == "string" then + return "text" + end + return "element" + elseif n > 0 then + return "mixed" + end + end + return "empty" +end + end -- of closure @@ -9601,7 +9629,7 @@ local xmlfilter = xml.filter local type, setmetatable, getmetatable = type, setmetatable, getmetatable local insert, remove, fastcopy, concat = table.insert, table.remove, table.fastcopy, table.concat -local gmatch, gsub, format = string.gmatch, string.gsub, string.format +local gmatch, gsub, format, find, strip = string.gmatch, string.gsub, string.format, string.find, string.strip local utfbyte = utf.byte local function report(what,pattern,c,e) @@ -10293,6 +10321,51 @@ function xml.setcdata(e,str) -- also setcomment } } end +-- maybe helpers like this will move to an autoloader + +function xml.separate(x,pattern) + local collected = xmlapplylpath(x,pattern) + if collected then + for c=1,#collected do + local e = collected[c] + local d = e.dt + if d == x then + report_xml("warning: xml.separate changes root") + x = d + end + local t, n = { "\n" }, 1 + local i, nd = 1, #d + while i <= nd do + while i <= nd do + local di = d[i] + if type(di) == "string" then + if di == "\n" or find(di,"^%s+$") then -- first test is speedup + i = i + 1 + else + d[i] = strip(di) + break + end + else + break + end + end + if i > nd then + break + end + t[n+1] = "\n" + t[n+2] = d[i] + t[n+3] = "\n" + n = n + 3 + i = i + 1 + end + t[n+1] = "\n" + setmetatable(t,getmetatable(d)) + e.dt = t + end + end + return x +end + end -- of closure diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index d2f7e408f..644c1d9b2 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -8174,6 +8174,34 @@ function xml.makestandalone(root) return root end +function xml.kind(e) + local dt = e and e.dt + if dt then + local n = #dt + if n == 1 then + local d = dt[1] + if d.special then + local tg = d.tg + if tg == "@cd@" then + return "cdata" + elseif tg == "@cm" then + return "comment" + elseif tg == "@pi@" then + return "instruction" + elseif tg == "@dt@" then + return "declaration" + end + elseif type(d) == "string" then + return "text" + end + return "element" + elseif n > 0 then + return "mixed" + end + end + return "empty" +end + end -- of closure @@ -9601,7 +9629,7 @@ local xmlfilter = xml.filter local type, setmetatable, getmetatable = type, setmetatable, getmetatable local insert, remove, fastcopy, concat = table.insert, table.remove, table.fastcopy, table.concat -local gmatch, gsub, format = string.gmatch, string.gsub, string.format +local gmatch, gsub, format, find, strip = string.gmatch, string.gsub, string.format, string.find, string.strip local utfbyte = utf.byte local function report(what,pattern,c,e) @@ -10293,6 +10321,51 @@ function xml.setcdata(e,str) -- also setcomment } } end +-- maybe helpers like this will move to an autoloader + +function xml.separate(x,pattern) + local collected = xmlapplylpath(x,pattern) + if collected then + for c=1,#collected do + local e = collected[c] + local d = e.dt + if d == x then + report_xml("warning: xml.separate changes root") + x = d + end + local t, n = { "\n" }, 1 + local i, nd = 1, #d + while i <= nd do + while i <= nd do + local di = d[i] + if type(di) == "string" then + if di == "\n" or find(di,"^%s+$") then -- first test is speedup + i = i + 1 + else + d[i] = strip(di) + break + end + else + break + end + end + if i > nd then + break + end + t[n+1] = "\n" + t[n+2] = d[i] + t[n+3] = "\n" + n = n + 3 + i = i + 1 + end + t[n+1] = "\n" + setmetatable(t,getmetatable(d)) + e.dt = t + end + end + return x +end + end -- of closure diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index d2f7e408f..644c1d9b2 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -8174,6 +8174,34 @@ function xml.makestandalone(root) return root end +function xml.kind(e) + local dt = e and e.dt + if dt then + local n = #dt + if n == 1 then + local d = dt[1] + if d.special then + local tg = d.tg + if tg == "@cd@" then + return "cdata" + elseif tg == "@cm" then + return "comment" + elseif tg == "@pi@" then + return "instruction" + elseif tg == "@dt@" then + return "declaration" + end + elseif type(d) == "string" then + return "text" + end + return "element" + elseif n > 0 then + return "mixed" + end + end + return "empty" +end + end -- of closure @@ -9601,7 +9629,7 @@ local xmlfilter = xml.filter local type, setmetatable, getmetatable = type, setmetatable, getmetatable local insert, remove, fastcopy, concat = table.insert, table.remove, table.fastcopy, table.concat -local gmatch, gsub, format = string.gmatch, string.gsub, string.format +local gmatch, gsub, format, find, strip = string.gmatch, string.gsub, string.format, string.find, string.strip local utfbyte = utf.byte local function report(what,pattern,c,e) @@ -10293,6 +10321,51 @@ function xml.setcdata(e,str) -- also setcomment } } end +-- maybe helpers like this will move to an autoloader + +function xml.separate(x,pattern) + local collected = xmlapplylpath(x,pattern) + if collected then + for c=1,#collected do + local e = collected[c] + local d = e.dt + if d == x then + report_xml("warning: xml.separate changes root") + x = d + end + local t, n = { "\n" }, 1 + local i, nd = 1, #d + while i <= nd do + while i <= nd do + local di = d[i] + if type(di) == "string" then + if di == "\n" or find(di,"^%s+$") then -- first test is speedup + i = i + 1 + else + d[i] = strip(di) + break + end + else + break + end + end + if i > nd then + break + end + t[n+1] = "\n" + t[n+2] = d[i] + t[n+3] = "\n" + n = n + 3 + i = i + 1 + end + t[n+1] = "\n" + setmetatable(t,getmetatable(d)) + e.dt = t + end + end + return x +end + end -- of closure diff --git a/tex/context/base/chem-str.lua b/tex/context/base/chem-str.lua index 6e2af50fb..fb325ccea 100644 --- a/tex/context/base/chem-str.lua +++ b/tex/context/base/chem-str.lua @@ -293,18 +293,18 @@ local function process(spec,text,n,rulethickness,rulecolor,offset) if set then for i=1,#set do local si = set[i] - m = m + 1 ; metacode[m] = format('chem_%s(%s,%s,"\\dochemicaltext{%s}");',operation,bonds,si,si) + m = m + 1 ; metacode[m] = format('chem_%s(%s,%s,"\\chemicaltext{%s}");',operation,bonds,si,si) end elseif upto then for i=index,upto do local si = set[i] - m = m + 1 ; metacode[m] = format('chem_%s(%s,%s,"\\dochemicaltext{%s}");',operation,bonds,si,si) + m = m + 1 ; metacode[m] = format('chem_%s(%s,%s,"\\chemicaltext{%s}");',operation,bonds,si,si) end elseif index then - m = m + 1 ; metacode[m] = format('chem_%s(%s,%s,"\\dochemicaltext{%s}");',operation,bonds,index,index) + m = m + 1 ; metacode[m] = format('chem_%s(%s,%s,"\\chemicaltext{%s}");',operation,bonds,index,index) else for i=1,max do - m = m + 1 ; metacode[m] = format('chem_%s(%s,%s,"\\dochemicaltext{%s}");',operation,bonds,i,i) + m = m + 1 ; metacode[m] = format('chem_%s(%s,%s,"\\chemicaltext{%s}");',operation,bonds,i,i) end end elseif what == "text" then @@ -320,7 +320,7 @@ local function process(spec,text,n,rulethickness,rulecolor,offset) local a = align and align[si] if a then a = "." .. a else a = "" end t = molecule(processor_tostring(t)) - m = m + 1 ; metacode[m] = format('chem_%s%s(%s,%s,"\\dochemicaltext{%s}");',operation,a,bonds,si,t) + m = m + 1 ; metacode[m] = format('chem_%s%s(%s,%s,"\\chemicaltext{%s}");',operation,a,bonds,si,t) end end elseif upto then @@ -331,7 +331,7 @@ local function process(spec,text,n,rulethickness,rulecolor,offset) local s = align and align[i] if s then s = "." .. s else s = "" end t = molecule(processor_tostring(t)) - m = m + 1 ; metacode[m] = format('chem_%s%s(%s,%s,"\\dochemicaltext{%s}");',operation,s,bonds,i,t) + m = m + 1 ; metacode[m] = format('chem_%s%s(%s,%s,"\\chemicaltext{%s}");',operation,s,bonds,i,t) end end elseif index == 0 then @@ -339,7 +339,7 @@ local function process(spec,text,n,rulethickness,rulecolor,offset) if not t then txt, t = fetch(txt) end if t then t = molecule(processor_tostring(t)) - m = m + 1 ; metacode[m] = format('chem_%s_zero("\\dochemicaltext{%s}");',operation,t) + m = m + 1 ; metacode[m] = format('chem_%s_zero("\\chemicaltext{%s}");',operation,t) end elseif index then local t = text @@ -348,7 +348,7 @@ local function process(spec,text,n,rulethickness,rulecolor,offset) local s = align and align[index] if s then s = "." .. s else s = "" end t = molecule(processor_tostring(t)) - m = m + 1 ; metacode[m] = format('chem_%s%s(%s,%s,"\\dochemicaltext{%s}");',operation,s,bonds,index,t) + m = m + 1 ; metacode[m] = format('chem_%s%s(%s,%s,"\\chemicaltext{%s}");',operation,s,bonds,index,t) end else for i=1,max do @@ -358,7 +358,7 @@ local function process(spec,text,n,rulethickness,rulecolor,offset) local s = align and align[i] if s then s = "." .. s else s = "" end t = molecule(processor_tostring(t)) - m = m + 1 ; metacode[m] = format('chem_%s%s(%s,%s,"\\dochemicaltext{%s}");',operation,s,bonds,i,t) + m = m + 1 ; metacode[m] = format('chem_%s%s(%s,%s,"\\chemicaltext{%s}");',operation,s,bonds,i,t) end end end diff --git a/tex/context/base/chem-str.mkiv b/tex/context/base/chem-str.mkiv index e74c268da..1d60a293e 100644 --- a/tex/context/base/chem-str.mkiv +++ b/tex/context/base/chem-str.mkiv @@ -99,12 +99,12 @@ \edef\chemicaltoplocation{t} \edef\chemicalbotlocation{b} -\def\chem_text#1% in ppchtex we had a more clever alignment - {\usechemicalstyleandcolor\c!style\c!color - \strut - #1} % maybe also \setstrut +% \unexpanded\def\chemicaltext#1% in ppchtex we had a more clever alignment +% {\usechemicalstyleandcolor\c!style\c!color +% \strut +% #1} % maybe also \setstrut -\def\chem_text#1% +\unexpanded\def\chemicaltext#1% {\mathematics {\usechemicalstyleandcolor\c!style\c!color \strut diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index eddc0890c..39bef537a 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.29 00:12} +\newcontextversion{2012.05.29 18: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 8c514cbfd..929174025 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.29 00:12} +\newcontextversion{2012.05.29 18: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 da7740427..aa5f54b0a 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 821f60efc..c236521cb 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 5923624a0..2cf8fd924 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.29 00:12} +\edef\contextversion{2012.05.29 18:43} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index f4da94ef1..426422c60 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.29 00:12} +\edef\contextversion{2012.05.29 18:43} %D For those who want to use this: diff --git a/tex/context/base/font-emp.mkvi b/tex/context/base/font-emp.mkvi index 65aa7a520..1713eda70 100644 --- a/tex/context/base/font-emp.mkvi +++ b/tex/context/base/font-emp.mkvi @@ -218,6 +218,10 @@ \unexpanded\def\emphsl{\groupedcommand{\sl\def\emphbf{\bs}\def\emphit{\it}}{}} \unexpanded\def\emphtf{\groupedcommand{\tf\def\emphbf{\bf}\def\emphit{\it}\def\emphsl{\sl}}{}} +\unexpanded\def\emph {\groupedcommand{\em}{}} + +\unexpanded\def\emphasized{\bgroup\em\let\nexttoken} + %D \startbuffer %D TEXT {\emphbf text \emphit text \emphtf text \emphsl text} TEXT %D TEXT \emphbf{text \emphit{text} \emphtf{text} \emphsl{text}} TEXT diff --git a/tex/context/base/lxml-aux.lua b/tex/context/base/lxml-aux.lua index 09411bfc0..be12659ba 100644 --- a/tex/context/base/lxml-aux.lua +++ b/tex/context/base/lxml-aux.lua @@ -22,7 +22,7 @@ local xmlfilter = xml.filter local type, setmetatable, getmetatable = type, setmetatable, getmetatable local insert, remove, fastcopy, concat = table.insert, table.remove, table.fastcopy, table.concat -local gmatch, gsub, format = string.gmatch, string.gsub, string.format +local gmatch, gsub, format, find, strip = string.gmatch, string.gsub, string.format, string.find, string.strip local utfbyte = utf.byte local function report(what,pattern,c,e) @@ -721,3 +721,48 @@ function xml.setcdata(e,str) -- also setcomment dt = { str }, } } end + +-- maybe helpers like this will move to an autoloader + +function xml.separate(x,pattern) + local collected = xmlapplylpath(x,pattern) + if collected then + for c=1,#collected do + local e = collected[c] + local d = e.dt + if d == x then + report_xml("warning: xml.separate changes root") + x = d + end + local t, n = { "\n" }, 1 + local i, nd = 1, #d + while i <= nd do + while i <= nd do + local di = d[i] + if type(di) == "string" then + if di == "\n" or find(di,"^%s+$") then -- first test is speedup + i = i + 1 + else + d[i] = strip(di) + break + end + else + break + end + end + if i > nd then + break + end + t[n+1] = "\n" + t[n+2] = d[i] + t[n+3] = "\n" + n = n + 3 + i = i + 1 + end + t[n+1] = "\n" + setmetatable(t,getmetatable(d)) + e.dt = t + end + end + return x +end diff --git a/tex/context/base/lxml-tab.lua b/tex/context/base/lxml-tab.lua index fddd55a09..b5c860787 100644 --- a/tex/context/base/lxml-tab.lua +++ b/tex/context/base/lxml-tab.lua @@ -1338,3 +1338,31 @@ function xml.makestandalone(root) end return root end + +function xml.kind(e) + local dt = e and e.dt + if dt then + local n = #dt + if n == 1 then + local d = dt[1] + if d.special then + local tg = d.tg + if tg == "@cd@" then + return "cdata" + elseif tg == "@cm" then + return "comment" + elseif tg == "@pi@" then + return "instruction" + elseif tg == "@dt@" then + return "declaration" + end + elseif type(d) == "string" then + return "text" + end + return "element" + elseif n > 0 then + return "mixed" + end + end + return "empty" +end diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index e0233d262..d9e0cb21f 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 95b9c543c..96f1ea93a 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 d17e6d463..e1f4e9966 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/29/12 00:12:55 +-- merge date : 05/29/12 18:43:34 do -- begin closure to overcome local limits and interference -- cgit v1.2.3