diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/context/lua/mtx-context.lua | 21 | ||||
-rw-r--r-- | scripts/context/lua/mtx-flac.lua | 20 |
2 files changed, 23 insertions, 18 deletions
diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua index 36e3efb6b..540f35100 100644 --- a/scripts/context/lua/mtx-context.lua +++ b/scripts/context/lua/mtx-context.lua @@ -664,13 +664,17 @@ local function analyze(filename) -- only files on current path return nil end -local function makestub(template,filename,prepname) +local function makestub(wrap,template,filename,prepname) local stubname = file.replacesuffix(file.basename(filename),'run') local f = io.open(stubname,'w') if f then - f:write("\\starttext\n") + if wrap then + f:write("\\starttext\n") + end f:write(format(template,prepname or filename),"\n") - f:write("\\stoptext\n") + if wrap then + f:write("\\stoptext\n") + end f:close() filename = stubname end @@ -775,17 +779,18 @@ function scripts.context.run(ctxdata,filename) local suffix = file.extname(filename) or "?" if scripts.context.xmlsuffixes[suffix] or environment.argument("forcexml") then if environment.argument("mkii") then - filename = makestub("\\processXMLfilegrouped{%s}",filename) + filename = makestub(true,"\\processXMLfilegrouped{%s}",filename) else - filename = makestub("\\xmlprocess{\\xmldocument}{%s}{}",filename) + filename = makestub(true,"\\xmlprocess{\\xmldocument}{%s}{}",filename) end elseif scripts.context.cldsuffixes[suffix] or environment.argument("forcecld") then - filename = makestub("\\ctxlua{context.runfile('%s')}",filename) + -- self contained cld files need to have a starttext/stoptext (less fontloading) + filename = makestub(false,"\\ctxlua{context.runfile('%s')}",filename) elseif scripts.context.luasuffixes[suffix] or environment.argument("forcelua") then - filename = makestub("\\ctxlua{dofile('%s')}",filename) + filename = makestub(true,"\\ctxlua{dofile('%s')}",filename) elseif environment.argument("prep") then -- we need to keep the original jobname - filename = makestub("\\readfile{%s}{}{}",filename,ctxrunner.preppedfile(ctxdata,filename)) + filename = makestub(true,"\\readfile{%s}{}{}",filename,ctxrunner.preppedfile(ctxdata,filename)) end -- -- todo: also other stubs diff --git a/scripts/context/lua/mtx-flac.lua b/scripts/context/lua/mtx-flac.lua index dc7f89218..0f517f3d4 100644 --- a/scripts/context/lua/mtx-flac.lua +++ b/scripts/context/lua/mtx-flac.lua @@ -133,29 +133,29 @@ function flac.savecollection(pattern,filename) nofartists = nofartists + 1 f:write("\t<artist>\n") f:write("\t\t<name>" .. artist .. "</name>\n") - f:write("\t\t\t<albums>\n") + f:write("\t\t<albums>\n") for album, data in table.sortedpairs(albums) do nofalbums = nofalbums + 1 - f:write("\t\t\t\t<album year='" .. (data.year or 0) .. "'>\n") - f:write("\t\t\t\t\t<name>" .. album .. "</name>\n") - f:write("\t\t\t\t\t<tracks>\n") + f:write("\t\t\t<album year='" .. (data.year or 0) .. "'>\n") + f:write("\t\t\t\t<name>" .. album .. "</name>\n") + f:write("\t\t\t\t<tracks>\n") local tracks = data.tracks for i=1,#tracks do local track = tracks[i] if track then noftracks = noftracks + 1 - f:write("\t\t\t\t\t\t<track length='" .. track.length .. "'>" .. track.title .. "</track>\n") + f:write("\t\t\t\t\t<track length='" .. track.length .. "'>" .. track.title .. "</track>\n") else noferrors = noferrors + 1 flac.report("error in album: %q of artist",album,artist) - f:write("\t\t\t\t\t\t<error track='" .. i .. "'/>\n") + f:write("\t\t\t\t\t<error track='" .. i .. "'/>\n") end end - f:write("\t\t\t\t\t</tracks>\n") - f:write("\t\t\t\t</album>\n") + f:write("\t\t\t\t</tracks>\n") + f:write("\t\t\t</album>\n") end - f:write("\t\t\t</albums>\n") - f:write("\t\t</artist>\n") + f:write("\t\t</albums>\n") + f:write("\t</artist>\n") end f:write("</collection>\n") end |