From c09358a5463dec70e45144c602f7d4a67039f95d Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Wed, 8 Oct 2014 01:15:03 +0200 Subject: 2014-10-08 00:35:00 --- 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 +++++--- 5 files changed, 54 insertions(+), 14 deletions(-) (limited to 'scripts') 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 100644 --- 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 -- cgit v1.2.3