From 4d782ec7e30ef87dcfd0be14904ab5217e564320 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Wed, 8 Oct 2014 00:33:00 +0530 Subject: beta 2014.10.08 00:33 --- scripts/context/lua/mtx-epub.lua | 36 +++++++++++++++++-- scripts/context/lua/mtxrun.lua | 8 +++-- scripts/context/stubs/mswin/mtxrun.lua | 8 +++-- scripts/context/stubs/unix/mtxrun | 8 +++-- scripts/context/stubs/win64/mtxrun.lua | 8 +++-- tex/context/base/back-exp.lua | 25 +++++++++++--- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4388 -> 4387 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/export-example.css | 31 +++++++++++------ tex/context/base/l-unicode.lua | 4 +-- tex/context/base/lpdf-epd.lua | 38 ++++++++++++++++++--- tex/context/base/lpdf-ini.lua | 2 +- tex/context/base/status-files.pdf | Bin 24694 -> 24729 bytes tex/context/base/status-lua.pdf | Bin 333462 -> 333492 bytes tex/context/base/strc-ren.mkiv | 2 +- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 17 files changed, 136 insertions(+), 40 deletions(-) diff --git a/scripts/context/lua/mtx-epub.lua b/scripts/context/lua/mtx-epub.lua index 6d8dfa63f..7b3ba2ebd 100644 --- a/scripts/context/lua/mtx-epub.lua +++ b/scripts/context/lua/mtx-epub.lua @@ -43,6 +43,7 @@ local replacetemplate = utilities.templates.replace local addsuffix = file.addsuffix local nameonly = file.nameonly local basename = file.basename +local pathpart = file.pathpart local joinfile = file.join local suffix = file.suffix local addsuffix = file.addsuffix @@ -639,19 +640,29 @@ function scripts.epub.make(purge,rename,svgmath,svgstyle) end end - local function registerandcopyfile(check,path,name,sourcepath,targetpath,newname) + local function registerandcopyfile(check,path,name,sourcepath,targetpath,newname,image) + + if name == "" then + report("ignoring unknown image") + return + end + if newname then newname = replacesuffix(newname,suffix(name)) else newname = name end + local source = joinfile(sourcepath,name) local target = joinfile(targetpath,newname) local mathml = false + if suffix(source) == "xhtml" then if find(io.loaddata(source),"MathML") then mathml = true -- inbelievable: the property is only valid when there is mathml end + else + report("checking image %a -> %a",source,target) end if registerone(path,newname,mathml) then if not check or needsupdating(source,target) or mathml and svgmath then @@ -678,8 +689,28 @@ function scripts.epub.make(purge,rename,svgmath,svgstyle) end end + -- local nofdummies = 0 + -- local dummyname = formatters["dummy-figure-%03i"] + -- local makedummy = formatters["context --extra=dummies --noconsole --once --result=%s"] + -- + -- local function registerandcopydummy(targetpath,name) + -- nofdummies = nofdummies + 1 + -- local newname = dummyname(nofdummies) + -- local target = joinfile(targetpath,newname) + -- if not isfile(target) then + -- pushdir(targetpath) + -- report("generating dummy %a for %a",newname,name or "unknown") + -- os.execute(makedummy(newname)) + -- popdir() + -- end + -- return newname + -- end + for image, data in sortedhash(images) do - registerandcopyfile(true,imagepath,data.newname,imagesource,imagetarget,rename and image) + -- if data.used == "" then + -- data.newname = registerandcopydummy(imagetarget,data.name) + -- end + registerandcopyfile(true,imagepath,data.newname,imagesource,imagetarget,rename and image,true) end for i=1,#styles do registerandcopyfile(false,stylepath,styles[i],stylesource,styletarget) @@ -688,6 +719,7 @@ function scripts.epub.make(purge,rename,svgmath,svgstyle) registerandcopyfile(false,false,htmlfiles[i],htmlsource,htmltarget) end + relocateimages(images,oldimagespecification,oldimagespecification,imagepath,rename) relocateimages(images,oldimagespecification,newimagespecification,imagepath,rename) report("%s files registered, %s updated, %s kept",updated + notupdated,updated,notupdated) diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 33a8912df..3668cd498 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -4461,7 +4461,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-unicode"] = package.loaded["l-unicode"] or true --- original size: 37111, stripped down to: 15630 +-- original size: 37185, stripped down to: 15660 if not modules then modules={} end modules ['l-unicode']={ version=1.001, @@ -4799,6 +4799,7 @@ local p_utf16_to_utf8_be=C(1)*C(1)/function(left,right) return utfchar(now) elseif now>=0xD800 and now<=0xDBFF then more=now + return "" else return utfchar(now) end @@ -4811,6 +4812,7 @@ local p_utf16_to_utf8_le=C(1)*C(1)/function(right,left) return utfchar(now) elseif now>=0xD800 and now<=0xDBFF then more=now + return "" else return utfchar(now) end @@ -17640,8 +17642,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 728320 --- stripped bytes : 259616 +-- original bytes : 728394 +-- stripped bytes : 259660 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 33a8912df..3668cd498 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -4461,7 +4461,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-unicode"] = package.loaded["l-unicode"] or true --- original size: 37111, stripped down to: 15630 +-- original size: 37185, stripped down to: 15660 if not modules then modules={} end modules ['l-unicode']={ version=1.001, @@ -4799,6 +4799,7 @@ local p_utf16_to_utf8_be=C(1)*C(1)/function(left,right) return utfchar(now) elseif now>=0xD800 and now<=0xDBFF then more=now + return "" else return utfchar(now) end @@ -4811,6 +4812,7 @@ local p_utf16_to_utf8_le=C(1)*C(1)/function(right,left) return utfchar(now) elseif now>=0xD800 and now<=0xDBFF then more=now + return "" else return utfchar(now) end @@ -17640,8 +17642,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 728320 --- stripped bytes : 259616 +-- original bytes : 728394 +-- stripped bytes : 259660 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 33a8912df..3668cd498 100755 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -4461,7 +4461,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-unicode"] = package.loaded["l-unicode"] or true --- original size: 37111, stripped down to: 15630 +-- original size: 37185, stripped down to: 15660 if not modules then modules={} end modules ['l-unicode']={ version=1.001, @@ -4799,6 +4799,7 @@ local p_utf16_to_utf8_be=C(1)*C(1)/function(left,right) return utfchar(now) elseif now>=0xD800 and now<=0xDBFF then more=now + return "" else return utfchar(now) end @@ -4811,6 +4812,7 @@ local p_utf16_to_utf8_le=C(1)*C(1)/function(right,left) return utfchar(now) elseif now>=0xD800 and now<=0xDBFF then more=now + return "" else return utfchar(now) end @@ -17640,8 +17642,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 728320 --- stripped bytes : 259616 +-- original bytes : 728394 +-- stripped bytes : 259660 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index 33a8912df..3668cd498 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -4461,7 +4461,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-unicode"] = package.loaded["l-unicode"] or true --- original size: 37111, stripped down to: 15630 +-- original size: 37185, stripped down to: 15660 if not modules then modules={} end modules ['l-unicode']={ version=1.001, @@ -4799,6 +4799,7 @@ local p_utf16_to_utf8_be=C(1)*C(1)/function(left,right) return utfchar(now) elseif now>=0xD800 and now<=0xDBFF then more=now + return "" else return utfchar(now) end @@ -4811,6 +4812,7 @@ local p_utf16_to_utf8_le=C(1)*C(1)/function(right,left) return utfchar(now) elseif now>=0xD800 and now<=0xDBFF then more=now + return "" else return utfchar(now) end @@ -17640,8 +17642,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 728320 --- stripped bytes : 259616 +-- original bytes : 728394 +-- stripped bytes : 259660 -- end library merge diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua index 5fa765b79..7350d927f 100644 --- a/tex/context/base/back-exp.lua +++ b/tex/context/base/back-exp.lua @@ -1301,9 +1301,13 @@ do checkmath(di) i = i + 1 elseif tg == "mroot" then - if #di.data == 1 then + local data = di.data + local size = #data + if size == 1 then -- else firefox complains di.element = "msqrt" + elseif size == 2 then + data[1], data[2] = data[2], data[1] end checkmath(di) i = i + 1 @@ -1550,6 +1554,13 @@ do extras.msup = extras.msub +-- function extras.mroot(result,element,detail,n,fulltag,di) +-- local data = di.data +-- if size == #data then +-- data[1], data[2] = data[2], data[1] +-- end +-- end + end do @@ -3206,9 +3217,15 @@ end local list = table.unique(settings_to_array(cssfile)) for i=1,#list do local source = file.addsuffix(list[i],"css") - local target = source - cssfiles[#cssfiles+1] = target - -- todo: warning if no file yet + local target = file.join(stylepath,file.basename(source)) + cssfiles[#cssfiles+1] = source + if not lfs.isfile(source) then + source = file.join("../",source) + end + if lfs.isfile(source) then + report_export("copying %s",source) + file.copy(source,target) + end end end diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index c58ec05bd..2da1fb0f6 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.10.07 11:14} +\newcontextversion{2014.10.08 00:33} %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 68d39a739..d7d03f969 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 08aaa01c0..8e9d95fa3 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.10.07 11:14} +\edef\contextversion{2014.10.08 00:33} \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 2962a790f..fb48e9426 100644 --- a/tex/context/base/export-example.css +++ b/tex/context/base/export-example.css @@ -373,6 +373,19 @@ register, div.register { display: none ; } +registerlocation, div.registerlocation { + display: inline ; +} + +registerlocation:after, div.registerlocation:after { + content : "\25B6\00A0\00A0" ; + color : rgb(40%,40%,40%) ; + font-size : x-small ; + line-height : 0 ; + padding-top : 0.5ex ; + vertical-align : top ; +} + /* table : display */ /* tablerow : display */ /* tablecell : mixed */ @@ -463,7 +476,7 @@ combination, div.combination { margin-bottom : 0em ; } -combinationpair, div.combinaitonpair { +combinationpair, div.combinationpair { display : table-cell ; padding-right : 1em ; } @@ -740,11 +753,11 @@ quantity, div.quantity { display : inline ; } -quantity>unit, div.quantity div.unit { +quantity>unit, div.quantity>div.unit { display : inline ; } -quantity>number, div.quantity div.number { +quantity>number, div.quantity>div.number { display : inline ; } @@ -755,25 +768,21 @@ quantity>number, div.quantity div.number { sup, div.sup { display : inline-block ; font-size : xx-small ; - line-height : 0 ; - padding-top : 0.5ex ; - vertical-align : top ; + vertical-align : super ; } sub, div.sub { display : inline-block ; font-size : xx-small ; - line-height : 0 ; - padding-bottom : 0.5ex ; - vertical-align : bottom ; + vertical-align : sub ; } -subsup>sup, div.subsup div.sup { +subsup>sup, div.subsup>div.sup { display : inline ; vertical-align : top ; } -subsup>sub, div.subsup div.sub { +subsup>sub, div.subsup>div.sub { display : inline ; vertical-align : bottom ; } diff --git a/tex/context/base/l-unicode.lua b/tex/context/base/l-unicode.lua index b3a4c35e6..53a23260a 100644 --- a/tex/context/base/l-unicode.lua +++ b/tex/context/base/l-unicode.lua @@ -883,7 +883,7 @@ local p_utf16_to_utf8_be = C(1) * C(1) /function(left,right) return utfchar(now) elseif now >= 0xD800 and now <= 0xDBFF then more = now - -- return "" + return "" -- else the c's end up in the stream else return utfchar(now) end @@ -897,7 +897,7 @@ local p_utf16_to_utf8_le = C(1) * C(1) /function(right,left) return utfchar(now) elseif now >= 0xD800 and now <= 0xDBFF then more = now - -- return "" + return "" -- else the c's end up in the stream else return utfchar(now) end diff --git a/tex/context/base/lpdf-epd.lua b/tex/context/base/lpdf-epd.lua index 44e1a04c2..1d1d62cb6 100644 --- a/tex/context/base/lpdf-epd.lua +++ b/tex/context/base/lpdf-epd.lua @@ -39,7 +39,7 @@ local concat = table.concat local toutf, toeight, utfchar = string.toutf, utf.toeight, utf.char local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns -local P, C, S, R, Ct, Cc, V, Carg, Cs = lpeg.P, lpeg.C, lpeg.S, lpeg.R, lpeg.Ct, lpeg.Cc, lpeg.V, lpeg.Carg, lpeg.Cs +local P, C, S, R, Ct, Cc, V, Carg, Cs, Cf, Cg = lpeg.P, lpeg.C, lpeg.S, lpeg.R, lpeg.Ct, lpeg.Cc, lpeg.V, lpeg.Carg, lpeg.Cs, lpeg.Cf, lpeg.Cg local epdf = epdf lpdf = lpdf or { } @@ -606,13 +606,16 @@ local hexdigit = R("09","AF") local numchar = ( P("\\") * ( (R("09")^3/tonumber) + C(1) ) ) + C(1) local number = lpegpatterns.number / tonumber local spaces = lpegpatterns.whitespace^1 +local optspaces = lpegpatterns.whitespace^0 local keyword = P("/") * C(R("AZ","az","09")^1) local operator = C((R("AZ","az")+P("'")+P('"'))^1) local grammar = P { "start", start = (keyword + number + V("dictionary") + V("unicode") + V("string") + V("unicode")+ V("array") + spaces)^1, + -- keyvalue = (keyword * spaces * V("start") + spaces)^1, + keyvalue = optspaces * Cf(Ct("") * Cg(keyword * optspaces * V("start") * optspaces)^1,rawset), array = P("[") * Ct(V("start")^1) * P("]"), - dictionary = P("<<") * Ct(V("start")^1) * P(">>"), + dictionary = P("<<") * V("keyvalue") * P(">>"), unicode = P("<") * Ct(Cc("hex") * C((1-P(">"))^1)) * P(">"), string = P("(") * Ct(Cc("dec") * C((V("string")+numchar)^1)) * P(")"), -- untested } @@ -742,9 +745,9 @@ function lpdf.epdf.getpagecontent(document,pagenumber) elseif operator == "Tj" or operator == "'" or operator == '"' then -- { string, Tj } { string, ' } { n, m, string, " } local list = entry[size-1] if list[1] == "hex" then - list[2] = lpegmatch(p_hex_to_utf,li[2],1,unic) + list[2] = lpegmatch(p_hex_to_utf,li[2]) else - list[2] = lpegmatch(p_dec_to_utf,li[2],1,unic) + list[2] = lpegmatch(p_dec_to_utf,li[2]) end end end @@ -809,6 +812,33 @@ function lpdf.epdf.contenttotext(document,list) -- maybe signal fonts return concat(text) end +function lpdf.epdf.getstructure(document,list) -- just a test + local depth = 0 + for i=1,#list do + local entry = list[i] + local size = #entry + local operator = entry[size] + if operator == "BDC" then + report_epdf("%w%s : %s",depth,entry[1] or "?",entry[2].MCID or "?") + depth = depth + 1 + elseif operator == "EMC" then + depth = depth - 1 + elseif operator == "TJ" then + local list = entry[1] + for i=1,#list do + local li = list[i] + if type(li) == "string" then + report_epdf("%w > %s",depth,li) + elseif li < -50 then + report_epdf("%w >",depth,li) + end + end + elseif operator == "Tj" then + report_epdf("%w > %s",depth,entry[size-1]) + end + end +end + -- document.Catalog.StructTreeRoot.ParentTree.Nums[2][1].A.P[1]) -- helpers diff --git a/tex/context/base/lpdf-ini.lua b/tex/context/base/lpdf-ini.lua index 76fa5cbb2..033895cdc 100644 --- a/tex/context/base/lpdf-ini.lua +++ b/tex/context/base/lpdf-ini.lua @@ -254,7 +254,7 @@ local pattern = C(4) / function(s) -- needs checking ! return utfchar(now) elseif now >= 0xD800 and now <= 0xDBFF then more = now - -- return "" + return "" -- else the c's end up in the stream else return utfchar(now) end diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index f4d86b843..b77dd85a1 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 9ee869ef6..ac68be555 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-ren.mkiv b/tex/context/base/strc-ren.mkiv index baeb3ab04..3ff144e81 100644 --- a/tex/context/base/strc-ren.mkiv +++ b/tex/context/base/strc-ren.mkiv @@ -673,7 +673,7 @@ \strut \headnumbercontent \par - else + \else \fakeheadnumbercontent % will also be done in the other ones (force consistency with numbered) \fi \begstrut diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 45b6f024a..e1d1c59a7 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 : 10/07/14 11:14:05 +-- merge date : 10/08/14 00:33:41 do -- begin closure to overcome local limits and interference -- cgit v1.2.3