diff options
20 files changed, 461 insertions, 241 deletions
diff --git a/doc/context/manuals/allkind/mkiv-publications.pdf b/doc/context/manuals/allkind/mkiv-publications.pdf Binary files differindex b03cf0c54..18444e4f0 100644 --- a/doc/context/manuals/allkind/mkiv-publications.pdf +++ b/doc/context/manuals/allkind/mkiv-publications.pdf diff --git a/scripts/context/lua/mtx-epub.lua b/scripts/context/lua/mtx-epub.lua index 9eb7a5c04..e9a4140a2 100644 --- a/scripts/context/lua/mtx-epub.lua +++ b/scripts/context/lua/mtx-epub.lua @@ -18,7 +18,17 @@ if not modules then modules = { } end modules ['mtx-epub'] = { -- first we need a decent strategy to export them. More information will be -- available on the wiki. -local format, gsub = string.format, string.gsub +-- META-INF +-- container.xml +-- OEBPS +-- content.opf +-- toc.ncx +-- Images +-- Styles +-- Text +-- mimetype + +local format, gsub, find = string.format, string.gsub, string.find local concat = table.concat local replace = utilities.templates.replace @@ -71,18 +81,33 @@ local t_container = [[ </container> ]] +-- urn:uuid: + +-- <dc:identifier id="%identifier%" opf:scheme="UUID">%uuid%</dc:identifier> + local t_package = [[ <?xml version="1.0" encoding="UTF-8"?> -<package version="2.0" xmlns="http://www.idpf.org/2007/opf" unique-identifier="%identifier%"> +<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="%identifier%" version="3.0"> <metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf"> <dc:title>%title%</dc:title> <dc:language>%language%</dc:language> - <dc:identifier id="%identifier%" opf:scheme="UUID">urn:uuid:%uuid%</dc:identifier> + <dc:identifier id="%identifier%">%uuid%</dc:identifier> <dc:creator>%creator%</dc:creator> <dc:date>%date%</dc:date> + <!-- + <dc:subject>%subject%</dc:subject> + <dc:description>%description%</dc:description> + <dc:publisher>%publisher%</dc:publisher> + <dc:source>%source%</dc:source> + <dc:relation>%relation%</dc:relation> + <dc:coverage>%coverage%</dc:coverage> + <dc:rights>%rights%</dc:rights> + --> <meta name="cover" content="%firstpage%" /> + <meta name="generator" content="ConTeXt MkIV" /> + <meta property="dcterms:modified">%date%</meta> </metadata> <manifest> @@ -97,16 +122,18 @@ local t_package = [[ </package> ]] -local t_item = [[ <item id="%id%" href="%filename%" media-type="%mime%"/>]] +local t_item = [[ <item id="%id%" href="%filename%" media-type="%mime%" />]] +local t_nav = [[ <item id="%id%" href="%filename%" media-type="%mime%" properties="%properties%" />]] -local t_toc = [[ -<?xml version="1.0"?> +-- <!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN" "http://www.daisy.org/z3986/2005/ncx-2005-1.dtd"> -<!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN" "http://www.daisy.org/z3986/2005/ncx-2005-1.dtd"> +local t_toc = [[ +<?xml version="1.0" encoding="UTF-8"?> <ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1"> <head> + <meta name="generator" content="ConTeXt MkIV" /> <meta name="dtb:uid" content="%identifier%" /> <meta name="dtb:depth" content="2" /> <meta name="dtb:totalPgeCount" content="0" /> @@ -133,23 +160,48 @@ local t_toc = [[ </ncx> ]] -local t_coverxhtml = [[ +local t_navtoc = [[ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops"> + <head> + <title>navtoc</title> + </head> + <body> + <div class="navtoc"> + <!-- <nav epub:type="lot"> --> + <nav epub:type="toc" id="navtoc"> + <ol> + <li><a href="%root%">document</a></li> + </ol> + </nav> + </div> + </body> +</html> +]] + +-- <html xmlns="http://www.w3.org/1999/xhtml"> +-- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> + +local t_coverxhtml = [[ +<?xml version="1.0" encoding="UTF-8"?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> - <title>cover.xhtml</title> + <title>cover page</title> </head> <body> - <div> - <img src="%image%" alt="The cover image" style="max-width: 100%%;" /> + <div class="coverpage"> + %content% </div> </body> </html> ]] +local t_coverimg = [[ + <img src="%image%" alt="The cover image" style="max-width: 100%%;" /> +]] + -- We need to figure out what is permitted. Numbers only seem to give -- problems is some applications as do names with dashes. Also the -- optional toc is supposed to be there and although id's are by @@ -165,6 +217,7 @@ end local mimetypes = { xhtml = "application/xhtml+xml", xml = "application/xhtml+xml", + html = "application/html", css = "text/css", svg = "image/svg+xml", png = "image/png", @@ -231,26 +284,32 @@ function scripts.epub.make() local specification = lfs.isfile(specfile) and dofile(specfile) or { } local name = specification.name or file.removesuffix(filename) - local identifier = specification.identifier or os.uuid(true) + local identifier = specification.identifier or "" local files = specification.files or { file.addsuffix(filename,"xhtml") } local images = specification.images or { } local root = specification.root or files[1] local language = specification.language or "en" - local creator = specification.author or "My Self" - local title = specification.title or "My Title" + local creator = specification.author or "context" + local title = specification.title or name local firstpage = specification.firstpage or "" local lastpage = specification.lastpage or "" -- identifier = gsub(identifier,"[^a-zA-z0-9]","") - if firstpage ~= "" then + if firstpage == "" then + -- firstpage = "firstpage.jpg" -- dummy + else images[firstpage] = firstpage end - if lastpage ~= "" then + if lastpage == "" then + -- lastpage = "lastpage.jpg" -- dummy + else images[lastpage] = lastpage end - identifier = "BookId" -- weird requirement + local uuid = format("urn:uuid:%s",os.uuid(true)) -- os.uuid() + + identifier = "bookid" -- for now local epubname = name local epubpath = file.replacesuffix(name,"tree") @@ -266,30 +325,58 @@ function scripts.epub.make() local used = { } - local function copyone(filename) + local function registerone(filename) local suffix = file.suffix(filename) local mime = mimetypes[suffix] if mime then local idmaker = idmakers[suffix] or idmakers.default - local target = file.join(epubpath,"OEBPS",filename) - file.copy(filename,target) - application.report("copying %s to %s",filename,target) used[#used+1] = replace(t_item, { - id = idmaker(filename), - filename = filename, - mime = mime, + id = idmaker(filename), + filename = filename, + mime = mime, } ) + return true + end + end + + local function copyone(filename,alternative) + if registerone(filename) then + local target = file.join(epubpath,"OEBPS",file.basename(filename)) + local source = alternative or filename + file.copy(source,target) + application.report("copying %s to %s",source,target) end end - copyone("cover.xhtml") + if lfs.isfile(epubcover) then + copyone(epubcover) + epubcover = false + else + registerone(epubcover) + end + copyone("toc.ncx") local function copythem(files) for i=1,#files do local filename = files[i] if type(filename) == "string" then - copyone(filename) + local suffix = file.suffix(filename) + if suffix == "xhtml" then + local alternative = file.replacesuffix(filename,"html") + if lfs.isfile(alternative) then + copyone(filename,alternative) + else + copyone(filename) + end + elseif suffix == "css" then + if not lfs.isfile(filename) then + filename = resolvers.findfile(filename) + end + copyone(filename) + else + copyone(filename) + end end end end @@ -307,39 +394,55 @@ function scripts.epub.make() end end + used[#used+1] = replace(t_nav, { + id = "nav", + filename = "nav.xhtml", + properties = "nav", + mime = "application/xhtml+xml", + }) + + io.savedata(file.join(epubpath,"OEBPS","nav.xhtml"),replace(t_navtoc, { -- version 3.0 + root = root, + } ) ) + copythem(theimages) local idmaker = idmakers[file.suffix(root)] or idmakers.default - container = replace(t_container, { + io.savedata(file.join(epubpath,"mimetype"),mimetype) + + io.savedata(file.join(epubpath,"META-INF","container.xml"),replace(t_container, { -- version 2.0 rootfile = epubroot - } ) - package = replace(t_package, { + } ) ) + + io.savedata(file.join(epubpath,"OEBPS",epubroot),replace(t_package, { identifier = identifier, title = title, language = language, - uuid = os.uuid(), + uuid = uuid, creator = creator, date = os.date("!%Y-%m-%dT%H:%M:%SZ"), firstpage = idmaker(firstpage), manifest = concat(used,"\n"), rootfile = idmaker(root) - } ) - toc = replace(t_toc, { - identifier = identifier, + } ) ) + + -- t_toc is replaced by t_navtoc in >= 3 + + io.savedata(file.join(epubpath,"OEBPS",epubtoc), replace(t_toc, { + identifier = uuid, -- identifier, title = title, author = author, root = root, - } ) - coverxhtml = replace(t_coverxhtml, { - image = firstpage - } ) + } ) ) - io.savedata(file.join(epubpath,"mimetype"),mimetype) - io.savedata(file.join(epubpath,"META-INF","container.xml"),container) - io.savedata(file.join(epubpath,"OEBPS",epubroot),package) - io.savedata(file.join(epubpath,"OEBPS",epubtoc),toc) - io.savedata(file.join(epubpath,"OEBPS",epubcover),coverxhtml) + if epubcover then + + io.savedata(file.join(epubpath,"OEBPS",epubcover), replace(t_coverxhtml, { + content = firstpage ~= "" and replace(t_coverimg, { image = firstpage }) or "no cover page defined", + } ) ) + + end application.report("creating archive\n\n") @@ -383,3 +486,5 @@ elseif environment.argument("exporthelp") then else application.help() end + +-- java -jar d:\epubcheck\epubcheck-3.0.1.jar -v 3.0 -mode xhtml mkiv-publications.tree\mkiv-publications.epub diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index ffddc9de2..eae3060bf 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -7408,7 +7408,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 25613, stripped down to: 16617 +-- original size: 25730, stripped down to: 16725 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -7423,6 +7423,8 @@ local concat,insert,remove=table.concat,table.insert,table.remove local topattern=string.topattern local next,type,select=next,type,select local utfchar=utf.char +local datetime=os.date +local openfile=io.open local setmetatableindex=table.setmetatableindex local formatters=string.formatters local texgetcount=tex and tex.getcount @@ -7979,10 +7981,11 @@ function logs.application(t) end return t end -function logs.system(whereto,process,jobname,category,...) - local message=formatters["%s %s => %s => %s => %s\r"](os.date("%d/%m/%y %H:%m:%S"),process,jobname,category,format(...)) +local f_syslog=formatters["%s %s => %s => %s => %s\r"] +function logs.system(whereto,process,jobname,category,fmt,arg,...) + local message=f_syslog(datetime("%d/%m/%y %H:%m:%S"),process,jobname,category,arg==nil and fmt or format(fmt,arg,...)) for i=1,10 do - local f=io.open(whereto,"a") + local f=openfile(whereto,"a") if f then f:write(message) f:close() @@ -17427,8 +17430,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 : 720379 --- stripped bytes : 257438 +-- original bytes : 720496 +-- stripped bytes : 257447 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index ffddc9de2..eae3060bf 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -7408,7 +7408,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 25613, stripped down to: 16617 +-- original size: 25730, stripped down to: 16725 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -7423,6 +7423,8 @@ local concat,insert,remove=table.concat,table.insert,table.remove local topattern=string.topattern local next,type,select=next,type,select local utfchar=utf.char +local datetime=os.date +local openfile=io.open local setmetatableindex=table.setmetatableindex local formatters=string.formatters local texgetcount=tex and tex.getcount @@ -7979,10 +7981,11 @@ function logs.application(t) end return t end -function logs.system(whereto,process,jobname,category,...) - local message=formatters["%s %s => %s => %s => %s\r"](os.date("%d/%m/%y %H:%m:%S"),process,jobname,category,format(...)) +local f_syslog=formatters["%s %s => %s => %s => %s\r"] +function logs.system(whereto,process,jobname,category,fmt,arg,...) + local message=f_syslog(datetime("%d/%m/%y %H:%m:%S"),process,jobname,category,arg==nil and fmt or format(fmt,arg,...)) for i=1,10 do - local f=io.open(whereto,"a") + local f=openfile(whereto,"a") if f then f:write(message) f:close() @@ -17427,8 +17430,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 : 720379 --- stripped bytes : 257438 +-- original bytes : 720496 +-- stripped bytes : 257447 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index ffddc9de2..eae3060bf 100755 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -7408,7 +7408,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 25613, stripped down to: 16617 +-- original size: 25730, stripped down to: 16725 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -7423,6 +7423,8 @@ local concat,insert,remove=table.concat,table.insert,table.remove local topattern=string.topattern local next,type,select=next,type,select local utfchar=utf.char +local datetime=os.date +local openfile=io.open local setmetatableindex=table.setmetatableindex local formatters=string.formatters local texgetcount=tex and tex.getcount @@ -7979,10 +7981,11 @@ function logs.application(t) end return t end -function logs.system(whereto,process,jobname,category,...) - local message=formatters["%s %s => %s => %s => %s\r"](os.date("%d/%m/%y %H:%m:%S"),process,jobname,category,format(...)) +local f_syslog=formatters["%s %s => %s => %s => %s\r"] +function logs.system(whereto,process,jobname,category,fmt,arg,...) + local message=f_syslog(datetime("%d/%m/%y %H:%m:%S"),process,jobname,category,arg==nil and fmt or format(fmt,arg,...)) for i=1,10 do - local f=io.open(whereto,"a") + local f=openfile(whereto,"a") if f then f:write(message) f:close() @@ -17427,8 +17430,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 : 720379 --- stripped bytes : 257438 +-- original bytes : 720496 +-- stripped bytes : 257447 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index ffddc9de2..eae3060bf 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -7408,7 +7408,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 25613, stripped down to: 16617 +-- original size: 25730, stripped down to: 16725 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -7423,6 +7423,8 @@ local concat,insert,remove=table.concat,table.insert,table.remove local topattern=string.topattern local next,type,select=next,type,select local utfchar=utf.char +local datetime=os.date +local openfile=io.open local setmetatableindex=table.setmetatableindex local formatters=string.formatters local texgetcount=tex and tex.getcount @@ -7979,10 +7981,11 @@ function logs.application(t) end return t end -function logs.system(whereto,process,jobname,category,...) - local message=formatters["%s %s => %s => %s => %s\r"](os.date("%d/%m/%y %H:%m:%S"),process,jobname,category,format(...)) +local f_syslog=formatters["%s %s => %s => %s => %s\r"] +function logs.system(whereto,process,jobname,category,fmt,arg,...) + local message=f_syslog(datetime("%d/%m/%y %H:%m:%S"),process,jobname,category,arg==nil and fmt or format(fmt,arg,...)) for i=1,10 do - local f=io.open(whereto,"a") + local f=openfile(whereto,"a") if f then f:write(message) f:close() @@ -17427,8 +17430,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 : 720379 --- stripped bytes : 257438 +-- original bytes : 720496 +-- stripped bytes : 257447 -- end library merge diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua index 647a9a049..85d6c5ef3 100644 --- a/tex/context/base/back-exp.lua +++ b/tex/context/base/back-exp.lua @@ -2456,12 +2456,10 @@ function builders.paragraphs.tag(head) return false end --- encoding="utf-8" - do local xmlpreamble = [[ -<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> +<?xml version="1.0" encoding="UTF-8" standalone="%s" ?> <!-- input filename : %- 17s --> <!-- processing date : %- 17s --> @@ -2472,8 +2470,8 @@ local xmlpreamble = [[ local flushtree = wrapups.flushtree - local function wholepreamble() - return format(xmlpreamble,tex.jobname,os.date(),environment.version,exportversion) + local function wholepreamble(standalone) + return format(xmlpreamble,standalone and "yes" or "no",tex.jobname,os.date(),environment.version,exportversion) end @@ -2514,20 +2512,17 @@ local f_d_template = formatters [ [[ local f_category = formatters["/* category: %s */"] +-- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd" > + local htmltemplate = [[ %preamble% -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd" > - -<html> - - <title>%title%</title> - - <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:math="http://www.w3.org/1998/Math/MathML"> <head> + <title>%title%</title> + %style% </head> @@ -2578,36 +2573,63 @@ local htmltemplate = [[ -- > -- ]] + -- local function cleanxhtmltree(xmltree) + -- if xmltree then + -- local xmlwrap = xml.wrap + -- for e in xml.collected(xmltree,"/document") do + -- e.at["xmlns:xhtml"] = "http://www.w3.org/1999/xhtml" + -- break + -- end + -- -- todo: inject xhtmlpreamble (xmlns should have be enough) + -- local wrapper = { tg = "a", ns = "xhtml", at = { href = "unknown" } } + -- for e in xml.collected(xmltree,"link") do + -- local at = e.at + -- local href + -- if at.location then + -- href = "#" .. gsub(at.location,":","_") + -- elseif at.url then + -- href = at.url + -- elseif at.file then + -- href = at.file + -- end + -- if href then + -- wrapper.at.href = href + -- xmlwrap(e,wrapper) + -- end + -- end + -- local wrapper = { tg = "a", ns = "xhtml", at = { name = "unknown" } } + -- for e in xml.collected(xmltree,"!link[@location]") do + -- local location = e.at.location + -- if location then + -- wrapper.at.name = gsub(location,":","_") + -- xmlwrap(e,wrapper) + -- end + -- end + -- return xmltree + -- else + -- return xml.convert('<?xml version="1.0"?>\n<error>invalid xhtml tree</error>') + -- end + -- end + local function cleanxhtmltree(xmltree) if xmltree then - local xmlwrap = xml.wrap - for e in xml.collected(xmltree,"/document") do - e.at["xmlns:xhtml"] = "http://www.w3.org/1999/xhtml" - break - end - -- todo: inject xhtmlpreamble (xmlns should have be enough) - local wrapper = { tg = "a", ns = "xhtml", at = { href = "unknown" } } for e in xml.collected(xmltree,"link") do local at = e.at - local href if at.location then - href = "#" .. gsub(at.location,":","_") + at.href = "#" .. gsub(at.location,":","_") elseif at.url then - href = at.url + at.href = at.url elseif at.file then - href = at.file - end - if href then - wrapper.at.href = href - xmlwrap(e,wrapper) + at.href = at.file end end - local wrapper = { tg = "a", ns = "xhtml", at = { name = "unknown" } } + local done = { } for e in xml.collected(xmltree,"!link[@location]") do - local location = e.at.location - if location then - wrapper.at.name = gsub(location,":","_") - xmlwrap(e,wrapper) + local at = e.at + local location = at.location + if location and not done[location] then + done[location] = true + at.id = gsub(location,":","_") end end return xmltree @@ -2616,6 +2638,7 @@ local htmltemplate = [[ end end + local f_namespace = string.formatters["%s.%s"] local function remap(specification,source,target) @@ -2674,6 +2697,12 @@ local htmltemplate = [[ end end + local private = { + id = true, + location = true, + href = true, + } + local function remap(specification,source,target) local comment = nil -- share comments for c in xml.collected(source,"*") do @@ -2683,8 +2712,8 @@ local htmltemplate = [[ if ns == "m" then c.ns = "" c.at["xmlns:m"] = nil - elseif tg == "a" then - c.ns = "" + -- elseif tg == "a" then + -- c.ns = "" else -- if tg == "tabulatecell" or tg == "tablecell" then local dt = c.dt @@ -2702,27 +2731,63 @@ local htmltemplate = [[ local class = { tg } if tg ~= "document" then for k, v in next, at do - class[#class+1] = k .. "-" .. v + if not private[k] then + class[#class+1] = k .. "-" .. v + end + end + end + local id = at.id + local href = at.href + local class = concat(class," ") + if id then + if href then + c.at = { + class = class, + id = id, + href = href, + } + else + c.at = { + class = class, + id = id, + } + end + else + if href then + c.at = { + class = class, + href = href, + } + else + c.at = { + class = class, + } end end - c.at = { class = concat(class," ") } c.tg = "div" end end end end - local cssfile, xhtmlfile, alternative = nil, nil, nil + local cssfile, xhtmlfile = nil, nil directives.register("backend.export.css", function(v) cssfile = v end) directives.register("backend.export.xhtml", function(v) xhtmlfile = v end) - directives.register("backend.export.alternative",function(v) alternative = v end) local function stopexport(v) starttiming(treehash) -- finishexport() -- + report_export("") + if xhtmlfile then + report_export("exporting xml, xhtml and html files") + else + report_export("exporting xml file") + end + report_export("") + -- wrapups.collapsetree(tree) wrapups.indextree(tree) wrapups.checktree(tree) @@ -2762,9 +2827,8 @@ local htmltemplate = [[ local files = { } local x_styles, h_styles = allusedstylesheets(xmlfile,cssfiles,files) - local preamble = wholepreamble() local results = concat { - preamble, + wholepreamble(true), x_styles, -- adds to files result, } @@ -2814,43 +2878,19 @@ local htmltemplate = [[ report_export("saving specification in %a (mtxrun --script epub --make %s)",specificationfilename,specificationfilename) io.savedata(specificationfilename,table.serialize(specification,true)) -- bonus --- if type(alternative) == "string" then --- local filename = "back-exp-"..alternative ..".lua" --- local fullname = resolvers.findfile(filename) or "" --- if fullname == "" then --- report_export("no valid alternative %a in %a",alternative,filename) --- else --- specification = dofile(fullname) or false --- if specification then --- if not xmltree then --- xmltree = xml.convert(results) --- end --- remap(specification,xmltree) --- local resultfile = file.replacesuffix(xmlfile,specification.suffix or alternative) --- report_export("saving alternative in %a",resultfile) --- local variables = { --- style = h_styles, --- body = xml.tostring(xml.first(xmltree,"/div")), --- preamble = preamble, --- title = specification.title, --- } --- local data = utilities.templates.replace(specification.template,variables,"xml") --- io.savedata(resultfile,data) --- end --- end --- end - -- if alternative == "div" then - local resultfile = file.replacesuffix(xmlfile,"html") - report_export("saving div based alternative in %a",resultfile) - remap(specification,xmltree) - local variables = { - style = h_styles, - body = xml.tostring(xml.first(xmltree,"/div")), - preamble = preamble, - title = specification.title, - } - io.savedata(resultfile,utilities.templates.replace(htmltemplate,variables,"xml")) - -- end + local resultfile = file.replacesuffix(xmlfile,"html") + report_export("saving div based alternative in %a",resultfile) + remap(specification,xmltree) + local variables = { + style = h_styles, + body = xml.tostring(xml.first(xmltree,"/div")), + preamble = wholepreamble(false), + title = specification.title, + } + io.savedata(resultfile,utilities.templates.replace(htmltemplate,variables,"xml")) + report_export("") + report_export("create epub with: mtxrun --script epub --make %a",file.basename(resultfile)) + report_export("") end stoptiming(treehash) end diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index deaf90116..3a91d18a9 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.09.03 22:05} +\newcontextversion{2014.09.06 13:38} %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 Binary files differindex e804806be..76ffe4c7f 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index a0a38b843..f8a7f3db4 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.09.03 22:05} +\edef\contextversion{2014.09.06 13:38} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/core-sys.lua b/tex/context/base/core-sys.lua index 22b0e457c..3a3a691b0 100644 --- a/tex/context/base/core-sys.lua +++ b/tex/context/base/core-sys.lua @@ -99,3 +99,7 @@ statistics.register("result saved in file", function() return format("%s.%s",outputfilename,"dvi") -- hard to imagine end end) + +function commands.systemlog(whereto,category,text) + logs.system(whereto,"context",tex.jobname,category,text) +end diff --git a/tex/context/base/core-sys.mkiv b/tex/context/base/core-sys.mkiv index b5c630be1..e05c23f0a 100644 --- a/tex/context/base/core-sys.mkiv +++ b/tex/context/base/core-sys.mkiv @@ -401,5 +401,31 @@ % \processcommalist[#1]\docommand % \endgroup} +\unexpanded\def\syst_log_indeed#1#2#3% + {\ctxcommand{systemlog("#1","#2",\!!bs#3\!!es)}} + +\let\systemlog\syst_log_indeed + +\unexpanded\def\systemlogfirst + {\ifcase\directsystemparameter\c!n\relax + \expandafter\syst_log_indeed + \or + \expandafter\syst_log_indeed + \else + \expandafter\gobblethreearguments + \fi} + +\unexpanded\def\systemloglast + {\ifcase\directsystemparameter\c!n\relax + \expandafter\syst_log_indeed + \or + \expandafter\gobblethreearguments + \or + \expandafter\gobblethreearguments + \or + \expandafter\gobblethreearguments + \or + \expandafter\syst_log_indeed + \fi} \protect \endinput diff --git a/tex/context/base/publ-aut.lua b/tex/context/base/publ-aut.lua index 90bb4b3df..28d89f6b5 100644 --- a/tex/context/base/publ-aut.lua +++ b/tex/context/base/publ-aut.lua @@ -317,6 +317,7 @@ function commands.btxauthor(dataset,tag,field,settings) end local max = split and #split or 0 if max == 0 then + return -- error end local etallimit = tonumber(settings.etallimit) or 1000 @@ -360,13 +361,15 @@ function commands.btxauthor(dataset,tag,field,settings) if juniors and #juniors > 0 then ctx_btxsetjuniors() -- (concat(juniors," ")) end + if i == max then + local overflow = #split - max + if overflow > 0 then + ctx_btxsetoverflow(overflow) + end + end ctx_btxsetup(combiner) ctx_btxstopauthor() end - local overflow = max - #split - if overflow > 0 then - ctx_btxsetoverflow(overflow) - end end -- We can consider creating a hashtable key -> entry but I wonder if diff --git a/tex/context/base/publ-imp-author.mkvi b/tex/context/base/publ-imp-author.mkvi index 29714ec03..bfcae159a 100644 --- a/tex/context/base/publ-imp-author.mkvi +++ b/tex/context/base/publ-imp-author.mkvi @@ -42,9 +42,9 @@ \fi \stopsetups -\startsetups \s!btx:\s!cite:\s!author:etaltext +\startsetups \s!btx:\s!cite:\s!author:others \ifcase\currentbtxoverflow \else - \btxcitevariantparameter\c!etaltext + \btxcitevariantparameter\c!others \fi \stopsetups @@ -67,7 +67,7 @@ \currentbtxjuniors \fi \fi - \fastsetup{\s!btx:\s!cite:\s!author:etaltext} + \fastsetup{\s!btx:\s!cite:\s!author:others} \stopsetups \startsetups \s!btx:\s!cite:\s!author:normalshort @@ -89,7 +89,7 @@ \currentbtxjuniors \fi \fi - \fastsetup{\s!btx:\s!cite:\s!author:etaltext} + \fastsetup{\s!btx:\s!cite:\s!author:others} \stopsetups \startsetups \s!btx:\s!cite:\s!author:inverted @@ -111,7 +111,7 @@ \btxcitevariantparameter\c!surnamefirstnamesep \currentbtxfirstnames \fi - \fastsetup{\s!btx:\s!cite:\s!author:etaltext} + \fastsetup{\s!btx:\s!cite:\s!author:others} \stopsetups \startsetups \s!btx:\s!cite:\s!author:invertedshort @@ -133,7 +133,7 @@ \btxcitevariantparameter\c!surnameinitialsep \currentbtxinitials \fi - \fastsetup{\s!btx:\s!cite:\s!author:etaltext} + \fastsetup{\s!btx:\s!cite:\s!author:others} \stopsetups \startsetups \s!btx:\s!cite:\s!author:name @@ -143,7 +143,7 @@ \btxcitevariantparameter\c!vonsep \fi \currentbtxsurnames - \fastsetup{\s!btx:\s!cite:\s!author:etaltext} + \fastsetup{\s!btx:\s!cite:\s!author:others} \stopsetups % list (mostly the same) @@ -158,9 +158,9 @@ \fi \stopsetups -\startsetups \s!btx:\s!list:\s!author:etaltext +\startsetups \s!btx:\s!list:\s!author:others \ifcase\currentbtxoverflow \else - \btxlistvariantparameter\c!etaltext + \btxlistvariantparameter\c!otherstext \fi \stopsetups @@ -183,7 +183,7 @@ \currentbtxjuniors \fi \fi - \fastsetup{\s!btx:\s!list:\s!author:etaltext} + \fastsetup{\s!btx:\s!list:\s!author:others} \stopsetups \startsetups \s!btx:\s!list:\s!author:normalshort @@ -205,7 +205,7 @@ \currentbtxjuniors \fi \fi - \fastsetup{\s!btx:\s!list:\s!author:etaltext} + \fastsetup{\s!btx:\s!list:\s!author:others} \stopsetups \startsetups \s!btx:\s!list:\s!author:inverted @@ -227,7 +227,7 @@ \btxlistvariantparameter\c!surnamefirstnamesep \currentbtxfirstnames \fi - \fastsetup{\s!btx:\s!list:\s!author:etaltext} + \fastsetup{\s!btx:\s!list:\s!author:others} \stopsetups \startsetups \s!btx:\s!list:\s!author:invertedshort @@ -249,7 +249,7 @@ \btxlistvariantparameter\c!surnameinitialsep \currentbtxinitials \fi - \fastsetup{\s!btx:\s!list:\s!author:etaltext} + \fastsetup{\s!btx:\s!list:\s!author:others} \stopsetups \startsetups \s!btx:\s!list:\s!author:name @@ -259,7 +259,7 @@ \btxlistvariantparameter\c!vonsep \fi \currentbtxsurnames - \fastsetup{\s!btx:\s!list:\s!author:etaltext} + \fastsetup{\s!btx:\s!list:\s!author:others} \stopsetups \protect diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua index fb1c01f97..63da84576 100644 --- a/tex/context/base/publ-ini.lua +++ b/tex/context/base/publ-ini.lua @@ -1420,10 +1420,10 @@ function lists.flushentries(dataset) else -- nothing end - local u = li[4] - if u then - local l = u.btxltx - local r = u.btxrtx + local userdata = li[4] + if userdata then + local l = userdata.btxltx + local r = userdata.btxrtx if l then ctx_btxsetlefttext (l) end @@ -1431,10 +1431,41 @@ function lists.flushentries(dataset) ctx_btxsetrighttext(r) end end + rendering.userdata = userdata ctx_btxhandlelistentry() end end +local function getuserdata(dataset,key) + local rendering = renderings[dataset] + if rendering then + local userdata = rendering.userdata + if userdata then + local value = userdata[key] + if value and value ~= "" then + return value + end + end + end +end + +lists.uservariable = getuserdata + +function commands.btxuservariable(dataset,key) + local value = getuserdata(dataset,key) + if value then + context(value) + end +end + +function commands.btxdoifelseuservariable(dataset,key) + if getuserdata(dataset,key) then + ctx_firstoftwoarguments() + else + ctx_secondoftwoarguments() + end +end + function lists.filterall(dataset) local r = renderings[dataset] local list = r.list @@ -1652,8 +1683,8 @@ local function processcite(dataset,reference,mark,compress,setup,internal,getter source[i] = data end - local function flush(i,n,entry,tag) - local tag = tag or entry.tag + local function flush(i,n,entry,last) + local tag = entry.tag local currentcitation = markcite(dataset,tag) ctx_btxstartcite() ctx_btxsettag(tag) @@ -1670,7 +1701,7 @@ local function processcite(dataset,reference,mark,compress,setup,internal,getter if language then ctx_btxsetlanguage(language) end - if not setter(entry,entry.last) then + if not setter(entry,last) then ctx_btxsetfirst(f_missing(tag)) end ctx_btxsetconcat(concatstate(i,n)) @@ -1688,7 +1719,7 @@ local function processcite(dataset,reference,mark,compress,setup,internal,getter local entry = target[i] local first = entry.first if first then - flush(i,nofcollected,first,list[1]) -- somewhat messy as we can be sorted so this needs checking! might be wrong + flush(i,nofcollected,first,entry.last) else flush(i,nofcollected,entry) end @@ -1821,7 +1852,6 @@ local function setter(dataset,tag,entry,internal) local entries = entry.entries local text = entries and entries.text or "?" return { - dataset = dataset, tag = tag, internal = internal, num = text, @@ -1835,22 +1865,11 @@ end function citevariants.num(dataset,reference,mark,compress,variant,internal) processcite(dataset,reference,mark,compress,"num",internal,setter,getter) +-- processcite(dataset,reference,mark,false,"num",internal,setter,getter) end -- year --- local function setter(dataset,tag,entry,internal) --- local year = getfield(dataset,tag,"year") --- return { --- dataset = dataset, --- tag = tag, --- internal = internal, --- year = year, --- sortkey = year, --- sortfld = "year", --- } --- end - local function setter(dataset,tag,entry,internal) return { dataset = dataset, @@ -2005,30 +2024,19 @@ local function authorconcat(target,key,setup) ctx_btxsetinternal(bl and bl.references.internal or "") if first then ctx_btxsetfirst(first[key] or f_missing(first.tag)) --- third ? of gewoon getfield? local suffix = entry.suffix local value = entry.last[key] --- if suffix then --- ctx_btxsetsecond(value .. converters.characters(suffix)) --- else --- ctx_btxsetsecond(value) --- end -ctx_btxsetsecond(value) -if suffix then - ctx_btxsetthird(suffix) -end + ctx_btxsetsecond(value) + if suffix then + ctx_btxsetthird(suffix) + end else local suffix = entry.suffix local value = entry[key] or f_missing(tag) --- if suffix then --- ctx_btxsetfirst(value .. converters.characters(suffix)) --- else --- ctx_btxsetfirst(value) --- end -ctx_btxsetfirst(value) -if suffix then - ctx_btxsetthird(suffix) -end + ctx_btxsetfirst(value) + if suffix then + ctx_btxsetthird(suffix) + end end ctx_btxsetconcat(concatstate(i,nofcollected)) ctx_btxcitesetup(setup) diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv index 6e680e790..46fe46543 100644 --- a/tex/context/base/publ-ini.mkiv +++ b/tex/context/base/publ-ini.mkiv @@ -318,6 +318,11 @@ % \let\btxsetdataset\setbtxdataset % \let\btxsetentry \setbtxentry +% todo: no need for the currents as we can keep them at the lua end so we will haqve +% +% \btxfield : current +% \btxspecificfield : dataset,tag,key + \def\btxfield #1{\ctxcommand{btxfield("\currentbtxdataset","\currentbtxtag","#1")}} \def\btxdetail #1{\ctxcommand{btxdetail("\currentbtxdataset","\currentbtxtag","#1")}} \def\btxauthorfield#1{\ctxcommand{btxauthorfield(\number\currentbtxauthorindex,"#1")}} @@ -326,7 +331,6 @@ \def\btxdoif #1{\ctxcommand{btxdoif("\currentbtxdataset","\currentbtxtag","#1")}} \def\btxdoifnot #1{\ctxcommand{btxdoifnot("\currentbtxdataset","\currentbtxtag","#1")}} - \let\btxsetup\fastsetup %D How complex will we go? Can we assume that e.g. an apa style will not be mixed @@ -509,7 +513,7 @@ \fi \ifx\currentbtxrighttext\empty\else \fastsetup{\s!btx:\currentbtxalternative:righttext}% - \fi}% + \fi} \def\btx_entry_inject_nop {\tttf \getmessage\m!publications{12}{\currentbtxsetup}} @@ -697,13 +701,17 @@ \def\btx_cite_reference_inject_indeed {\btx_trace_list_cross\currentbtxbacklink\empty - \normalexpanded{\writedatatolist% + \normalexpanded{\writedatatolist [\s!btx]% [\s!btxset=\currentbtxdataset,% \s!btxref=\currentbtxtag,% \ifx\p_publ_cite_lefttext \empty\else\s!btxltx={\p_publ_cite_lefttext },\fi% \ifx\p_publ_cite_righttext\empty\else\s!btxrtx={\p_publ_cite_righttext},\fi% - \s!btxint=\number\currentbtxbacklink]}}% % \c!location=\v!here + \s!btxint=\number\currentbtxbacklink + \ifx\currentbtxciteuservariables\empty\else,\currentbtxciteuservariables\fi]}} + +\def\currentbtxuservariable #1{\ctxcommand{btxuservariable("\currentbtxdataset","#1")}} +\def\btxdoifelseuservariable#1{\ctxcommand{btxdoifelseuservariable("\currentbtxdataset","#1")}} \let\btxcitereference\btx_cite_reference_inject @@ -878,8 +886,8 @@ % these need to be sort of protected: -\let\p_publ_cite_before \empty -\let\p_publ_cite_after \empty +%let\p_publ_cite_before \empty +%let\p_publ_cite_after \empty \let\p_publ_cite_lefttext \empty \let\p_publ_cite_righttext\empty @@ -898,23 +906,32 @@ \let\publ_citation_tags_indeed\publ_cite_tags_indeed +\let\currentbtxciteuservariables\empty + \unexpanded\def\publ_cite_tags_options[#1]% {\strictdoifnextoptionalelse{\publ_cite_tags_options_indeed{#1}}{\publ_cite_tags_indeed{#1}}} -\unexpanded\def\publ_cite_tags_options_indeed#1[#2]% - {\edef\currentbtxcitetag{#2}% - \doifassignmentelse{#1}\publ_cite_tags_settings_indeed\publ_cite_tags_variants_indeed{#1}} +\unexpanded\def\publ_cite_tags_options_indeed#1% + {\doifassignmentelse{#1}\publ_cite_tags_settings_indeed\publ_cite_tags_variants_indeed{#1}} -\def\publ_cite_tags_settings_indeed#1% +\def\publ_cite_tags_settings_indeed#1[#2]% {\letinteractionparameter\c!style\empty %\letinteractionparameter\c!color\empty - \letdummyparameter\c!before \empty - \letdummyparameter\c!after \empty + \letdummyparameter\c!reference \empty \letdummyparameter\c!extras \empty \letdummyparameter\c!alternative\empty + %letdummyparameter\c!before \empty + %letdummyparameter\c!after \empty \letdummyparameter\c!lefttext \empty \letdummyparameter\c!righttext \empty \getdummyparameters[#1]% + \edef\p_reference{\dummyparameter\c!reference}% + \ifx\p_reference\empty + \edef\currentbtxcitetag{#2}% + \else + \let\currentbtxcitetag\p_reference + \edef\currentbtxciteuservariables{#2}% + \fi \edef\p_alternative{\dummyparameter\c!alternative}% \ifx\p_alternative\empty \edef\currentbtxcitevariant{\btxcitevariantparameter\c!alternative}% @@ -929,25 +946,26 @@ \setexpandedbtxcitevariantparameter\p_right{\p_extras\p_right}% \fi \fi - \edef\p_publ_cite_before {\dummyparameter\c!before}% - \edef\p_publ_cite_after {\dummyparameter\c!after}% + %edef\p_publ_cite_before {\dummyparameter\c!before}% + %edef\p_publ_cite_after {\dummyparameter\c!after}% \edef\p_publ_cite_lefttext {\dummyparameter\c!lefttext}% \edef\p_publ_cite_righttext{\dummyparameter\c!righttext}% \the\everysetupbtxciteplacement - \ifx\p_publ_cite_before\empty \else - \p_publ_cite_before - \space - \fi + %ifx\p_publ_cite_before\empty \else + % \p_publ_cite_before + % \space + %fi \publ_cite_variant - \ifx\p_publ_cite_after\empty \else - \optionalspace - \p_publ_cite_after - \fi + %ifx\p_publ_cite_after\empty \else + % \optionalspace + % \p_publ_cite_after + %fi \endgroup} -\def\publ_cite_tags_variants_indeed#1% +\def\publ_cite_tags_variants_indeed#1[#2]% {\letinteractionparameter\c!style\empty \edef\currentbtxcitevariant{#1}% + \edef\currentbtxcitetag{#2}% \the\everysetupbtxciteplacement \publ_cite_variant \endgroup} @@ -1125,11 +1143,11 @@ % \c!setups=btx:cite:initialize, \c!alternative=num, \c!authorconversion=\v!normal, - \c!andtext={ \btxlabeltext{and} }, - \c!otherstext={ \btxlabeltext{others}}, + \c!andtext={ \btxlabeltext{\currentbtxalternative:and} }, + \c!otherstext={ \btxlabeltext{\currentbtxalternative:others}}, \c!pubsep={, }, - \c!lastpubsep={ \btxlabeltext{and} }, - \c!finalpubsep={ \btxlabeltext{and} }, + \c!lastpubsep={ \btxlabeltext{\currentbtxalternative:and} }, + \c!finalpubsep={ \btxlabeltext{\currentbtxalternative:and} }, \c!compress=\v!no, \c!inbetween={ }, \c!range=\endash, @@ -1256,9 +1274,10 @@ \setupbtxlistvariant [\c!namesep={, }, - \c!lastnamesep={ \btxlabeltext{and} }, - \c!finalnamesep={ \btxlabeltext{and} }, + \c!lastnamesep={ \btxlabeltext{\currentbtxalternative:and} }, + \c!finalnamesep={ \btxlabeltext{\currentbtxalternative:and} }, \c!firstnamesep={ }, + \c!otherstext={ \btxlabeltext{\currentbtxalternative:others}}, \c!juniorsep={ }, \c!vonsep={ }, \c!initialsep={ }, @@ -1266,8 +1285,7 @@ \c!surnameinitialsep={, }, \c!surnamefirstnamesep={, }, \c!etallimit=5, - \c!etaldisplay=5, - \c!etaltext={ \btxlabeltext{others}}, + \c!etaldisplay=\btxlistvariantparameter\c!etallimit, %c!journalconversion=\v!normal, \c!monthconversion=\v!number, \c!authorconversion=\v!normal] @@ -1299,7 +1317,7 @@ \c!surnamefirstnamesep=\btxlistvariantparameter\c!surnamefirstnamesep, \c!etallimit=\btxlistvariantparameter\c!etallimit, \c!etaldisplay=\btxlistvariantparameter\c!etaldisplay, - \c!etaltext=\btxlistvariantparameter\c!etaltext, + \c!otherstext=\btxlistvariantparameter\c!otherstext, \c!monthconversion=\btxlistvariantparameter\c!monthconversion, \c!authorconversion=\v!name] diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 69f385a5b..13f8e3462 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 86c7ece91..3487a0b94 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/trac-log.lua b/tex/context/base/trac-log.lua index 72f271d9c..8e83bbafa 100644 --- a/tex/context/base/trac-log.lua +++ b/tex/context/base/trac-log.lua @@ -73,6 +73,8 @@ local concat, insert, remove = table.concat, table.insert, table.remove local topattern = string.topattern local next, type, select = next, type, select local utfchar = utf.char +local datetime = os.date +local openfile = io.open local setmetatableindex = table.setmetatableindex local formatters = string.formatters @@ -845,10 +847,12 @@ end -- logs.system(syslogname,"context","test","fonts","font %s recached due to newer version (%s)","blabla","123") -- end -function logs.system(whereto,process,jobname,category,...) - local message = formatters["%s %s => %s => %s => %s\r"](os.date("%d/%m/%y %H:%m:%S"),process,jobname,category,format(...)) +local f_syslog = formatters["%s %s => %s => %s => %s\r"] + +function logs.system(whereto,process,jobname,category,fmt,arg,...) + local message = f_syslog(datetime("%d/%m/%y %H:%m:%S"),process,jobname,category,arg == nil and fmt or format(fmt,arg,...)) for i=1,10 do - local f = io.open(whereto,"a") -- we can consider keeping the file open + local f = openfile(whereto,"a") -- we can consider keeping the file open if f then f:write(message) f:close() diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 9d3fbbdc5..523febd78 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 : 09/03/14 22:05:34 +-- merge date : 09/06/14 13:38:59 do -- begin closure to overcome local limits and interference |