From 0c4e44dea8cce96b8507b1e2d7381de50b561830 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 16 Jan 2014 18:46:00 +0100 Subject: beta 2014.01.16 18:46 --- tex/context/base/back-exp.lua | 16 +++- tex/context/base/char-utf.lua | 87 ++++++++++++--------- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4086 -> 4085 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/export-example.css | 15 ++++ tex/context/base/l-lpeg.lua | 9 ++- tex/context/base/publ-ini.lua | 31 ++++---- tex/context/base/publ-ini.mkiv | 2 +- tex/context/base/status-files.pdf | Bin 24769 -> 24809 bytes tex/context/base/status-lua.pdf | Bin 229144 -> 229023 bytes tex/context/base/x-set-11.mkiv | 5 +- tex/generic/context/luatex/luatex-fonts-merged.lua | 10 ++- 13 files changed, 112 insertions(+), 67 deletions(-) (limited to 'tex') diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua index f51025cf8..d4133396b 100644 --- a/tex/context/base/back-exp.lua +++ b/tex/context/base/back-exp.lua @@ -456,16 +456,24 @@ local function checkdocument(root) local di = data[i] local tg = di.tg if tg == "noexport" then -data[i] = false --- di.element = "" --- di.data = nil -- { } + local ud = userdata[di.fulltag] + local comment = ud and ud.comment + if comment then + di.element = "comment" + di.data = { { content = comment } } + ud.comment = nil + else + data[i] = false + -- di.element = "" + -- di.data = nil + end elseif di.content then -- okay elseif tg == "ignore" then di.element = "" checkdocument(di) else -checkdocument(di) + checkdocument(di) -- new, else no noexport handling end end end diff --git a/tex/context/base/char-utf.lua b/tex/context/base/char-utf.lua index 95ed48279..d406b8bfe 100644 --- a/tex/context/base/char-utf.lua +++ b/tex/context/base/char-utf.lua @@ -357,44 +357,55 @@ function utffilters.collapse(str,filename) -- we can make high a seperate pass return str end -function utffilters.decompose(str) - if str and str ~= "" then - local nstr = #str - if nstr > 1 then - -- if initialize then -- saves a call - -- initialize() - -- end - local tokens, t, done, n = { }, 0, false, 0 - for s in utfcharacters(str) do - local dec = decomposed[s] - if dec then - if not done then - if n > 0 then - for s in utfcharacters(str) do - if n == 1 then - break - else - t = t + 1 - tokens[t] = s - n = n - 1 - end - end - end - done = true - end - t = t + 1 - tokens[t] = dec - elseif done then - t = t + 1 - tokens[t] = s - else - n = n + 1 - end - end - if done then - return concat(tokens) -- seldom called - end - end +-- function utffilters.decompose(str) +-- if str and str ~= "" then +-- local nstr = #str +-- if nstr > 1 then +-- -- if initialize then -- saves a call +-- -- initialize() +-- -- end +-- local tokens, t, done, n = { }, 0, false, 0 +-- for s in utfcharacters(str) do +-- local dec = decomposed[s] +-- if dec then +-- if not done then +-- if n > 0 then +-- for s in utfcharacters(str) do +-- if n == 0 then +-- break +-- else +-- t = t + 1 +-- tokens[t] = s +-- n = n - 1 +-- end +-- end +-- end +-- done = true +-- end +-- t = t + 1 +-- tokens[t] = dec +-- elseif done then +-- t = t + 1 +-- tokens[t] = s +-- else +-- n = n + 1 +-- end +-- end +-- if done then +-- return concat(tokens) -- seldom called +-- end +-- end +-- end +-- return str +-- end + +local tree = lpeg.utfchartabletopattern(table.keys(decomposed)) +local finder = lpeg.finder(tree,false,true) +local replacer = lpeg.replacer(tree,decomposed,false,true) + +function utffilters.decompose(str) -- 3 to 4 times faster than the above + if str and str ~= "" and #str > 1 and lpegmatch(finder,str) then + return lpegmatch(replacer,str) end return str end diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 19261b64c..8882d6b54 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{2014.01.15 18:03} +\newcontextversion{2014.01.16 18:46} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf index 7541feadb..5a9db5b1b 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.mkiv b/tex/context/base/context.mkiv index 3dd862759..5f05d3318 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -28,7 +28,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2014.01.15 18:03} +\edef\contextversion{2014.01.16 18:46} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/export-example.css b/tex/context/base/export-example.css index 06d51c587..dbecc01fe 100644 --- a/tex/context/base/export-example.css +++ b/tex/context/base/export-example.css @@ -709,3 +709,18 @@ a[href]:hover { color : rgb(50%,0%,0%) ; text-decoration : underline ; } + +/* setups */ + +setup { + display : block ; +} + +comment { + background-color : rgb(50%,75%,100%) ; + display : block ; + padding : 1em ; + margin-bottom : 1em ; + margin-top : 1em ; + font-family : "Lucida Console", "DejaVu Sans Mono", monospace ; +} diff --git a/tex/context/base/l-lpeg.lua b/tex/context/base/l-lpeg.lua index 399b3ad65..bad90efa8 100644 --- a/tex/context/base/l-lpeg.lua +++ b/tex/context/base/l-lpeg.lua @@ -469,7 +469,7 @@ end -- local pattern1 = P(1-P(pattern))^0 * P(pattern) : test for not nil -- local pattern2 = (P(pattern) * Cc(true) + P(1))^0 : test for true (could be faster, but not much) -function lpeg.finder(lst,makefunction) -- beware: slower than find with 'patternless finds' +function lpeg.finder(lst,makefunction,isutf) -- beware: slower than find with 'patternless finds' local pattern if type(lst) == "table" then pattern = P(false) @@ -485,7 +485,12 @@ function lpeg.finder(lst,makefunction) -- beware: slower than find with 'pattern else pattern = P(lst) end - pattern = (1-pattern)^0 * pattern + if isutf then +-- pattern = ((utf8char or 1)-pattern)^0 * pattern + pattern = ((utf8char or 1)-pattern)^0 * pattern + else + pattern = (1-pattern)^0 * pattern + end if makefunction then return function(str) return lpegmatch(pattern,str) diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua index a791f4726..ceaeab0ee 100644 --- a/tex/context/base/publ-ini.lua +++ b/tex/context/base/publ-ini.lua @@ -841,8 +841,7 @@ function lists.resolve(dataset,reference) -- maybe already feed it split for rest in gmatch(reference,"[^, ]+") do local blk, tag, found = block, nil, nil if block then --- tag = blk .. ":" .. rest - tag = dataset .. ":" .. blk .. ":" .. rest + tag = f_destination(dataset,blk,rest) found = subset[tag] if not found then for i=block-1,1,-1 do @@ -857,7 +856,7 @@ function lists.resolve(dataset,reference) -- maybe already feed it split end if not found then blk = "*" - tag = dataset .. ":" .. blk .. ":" .. rest + tag = f_destination(dataset,blk,rest) found = subset[tag] end if found then @@ -1022,7 +1021,7 @@ function commands.btxhandlecite(dataset,tag,mark,variant,sorttype,setup) -- vari if i > 1 then context.btxcitevariantparameter(v_middle) end - if mark then + if mark ~= false then context.dobtxmarkcitation(dataset,tag) end context.formatted.directsetup(setup) -- cite can become alternative @@ -1033,17 +1032,19 @@ function commands.btxhandlecite(dataset,tag,mark,variant,sorttype,setup) -- vari end end -function commands.btxhandlenocite(dataset,tag) - local prefix, rest = lpegmatch(splitter,tag) - if rest then - dataset = prefix - else - rest = tag - end - context.setvalue("currentbtxdataset",dataset) - local tags = settings_to_array(rest) - for i=1,#tags do - context.dobtxmarkcitation(dataset,tags[i]) +function commands.btxhandlenocite(dataset,tag,mark) + if mark ~= false then + local prefix, rest = lpegmatch(splitter,tag) + if rest then + dataset = prefix + else + rest = tag + end + context.setvalue("currentbtxdataset",dataset) + local tags = settings_to_array(rest) + for i=1,#tags do + context.dobtxmarkcitation(dataset,tags[i]) + end end end diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv index dafb0dca3..8279e2a78 100644 --- a/tex/context/base/publ-ini.mkiv +++ b/tex/context/base/publ-ini.mkiv @@ -672,7 +672,7 @@ \unexpanded\def\publ_cite_no[#1]% {\iftrialtypesetting \else - \ctxcommand{btxhandlenocite("\currentbtxdataset","#1")}% + \ctxcommand{btxhandlenocite("\currentbtxdataset","#1",true)}% \fi} %D Compatibility: diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 619c76e8a..2f68708da 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 04eb97fb9..80538ebc1 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/x-set-11.mkiv b/tex/context/base/x-set-11.mkiv index 8380c9f80..12854dc92 100644 --- a/tex/context/base/x-set-11.mkiv +++ b/tex/context/base/x-set-11.mkiv @@ -451,11 +451,12 @@ % \def\showsetupindeed#1% % {\xmlfilterlist{\loadedsetups}{/interface/command['#1' == (@type=='environment' and 'start' or '') .. @name]/command(xml:setups:typeset)}} -\setelementnature[setup][display] +% \setelementnature[setup][display] +% \setelementnature[setup][mixed] \def\showsetupindeed#1% {\startelement[setup][name=#1]% - \startelement[noexport]% + \startelement[noexport][comment={setup definition #1}] \xmlfilterlist{\loadedsetups}{/interface/command['#1' == (@type=='environment' and 'start' or '') .. @name]/command(xml:setups:typeset)}% \stopelement \stopelement} diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 6af830035..3e612d926 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 : 01/15/14 18:03:19 +-- merge date : 01/16/14 18:46:41 do -- begin closure to overcome local limits and interference @@ -395,7 +395,7 @@ function lpeg.replacer(one,two,makefunction,isutf) return pattern end end -function lpeg.finder(lst,makefunction) +function lpeg.finder(lst,makefunction,isutf) local pattern if type(lst)=="table" then pattern=P(false) @@ -411,7 +411,11 @@ function lpeg.finder(lst,makefunction) else pattern=P(lst) end - pattern=(1-pattern)^0*pattern + if isutf then + pattern=((utf8char or 1)-pattern)^0*pattern + else + pattern=(1-pattern)^0*pattern + end if makefunction then return function(str) return lpegmatch(pattern,str) -- cgit v1.2.3