diff options
-rw-r--r-- | doc/context/manuals/allkind/mkiv-publications.pdf | bin | 341077 -> 341495 bytes | |||
-rw-r--r-- | scripts/context/lua/mtx-epub.lua | 182 | ||||
-rw-r--r-- | scripts/context/lua/mtxrun.lua | 15 | ||||
-rw-r--r-- | scripts/context/stubs/mswin/mtxrun.lua | 15 | ||||
-rw-r--r-- | scripts/context/stubs/unix/mtxrun | 15 | ||||
-rw-r--r-- | scripts/context/stubs/win64/mtxrun.lua | 15 | ||||
-rw-r--r-- | tex/context/base/back-exp.lua | 99 | ||||
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4432 -> 4440 bytes | |||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/core-sys.lua | 4 | ||||
-rw-r--r-- | tex/context/base/core-sys.mkiv | 26 | ||||
-rw-r--r-- | tex/context/base/publ-aut.lua | 11 | ||||
-rw-r--r-- | tex/context/base/publ-imp-author.mkvi | 28 | ||||
-rw-r--r-- | tex/context/base/publ-ini.mkiv | 18 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 25005 -> 25037 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 327119 -> 327163 bytes | |||
-rw-r--r-- | tex/context/base/trac-log.lua | 10 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 2 |
19 files changed, 313 insertions, 131 deletions
diff --git a/doc/context/manuals/allkind/mkiv-publications.pdf b/doc/context/manuals/allkind/mkiv-publications.pdf Binary files differindex b03cf0c54..ff19fc87c 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..5c6f2cf10 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,51 @@ 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 - copyone("cover.xhtml") + local function copyone(filename,alternative) + if registerone(filename) then + local target = file.join(epubpath,"OEBPS",filename) + file.copy(alternative or filename,target) + application.report("copying %s to %s",alternative or filename,target) + end + end + + 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 +if file.suffix(filename) == "xhtml" then + local alternative = file.replacesuffix(filename,"html") + if lfs.isfile(alternative) then + copyone(filename,alternative) + else + copyone(filename) + end +else copyone(filename) +end end end end @@ -307,39 +387,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 +479,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 100644 --- 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..7212f6566 100644 --- a/tex/context/base/back-exp.lua +++ b/tex/context/base/back-exp.lua @@ -2461,7 +2461,7 @@ end 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 +2472,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 @@ -2517,17 +2517,25 @@ local f_category = formatters["/* category: %s */"] 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> + <!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" > - <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> + + <!-- + + <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> + + --> + + %style% </head> @@ -2578,36 +2586,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 +2651,7 @@ local htmltemplate = [[ end end + local f_namespace = string.formatters["%s.%s"] local function remap(specification,source,target) @@ -2762,9 +2798,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, } @@ -2831,7 +2866,7 @@ local htmltemplate = [[ -- local variables = { -- style = h_styles, -- body = xml.tostring(xml.first(xmltree,"/div")), --- preamble = preamble, +-- preamble = wholepreamble(false), -- title = specification.title, -- } -- local data = utilities.templates.replace(specification.template,variables,"xml") @@ -2846,7 +2881,7 @@ local htmltemplate = [[ local variables = { style = h_styles, body = xml.tostring(xml.first(xmltree,"/div")), - preamble = preamble, + preamble = wholepreamble(false), title = specification.title, } io.savedata(resultfile,utilities.templates.replace(htmltemplate,variables,"xml")) diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 4d7bcdd36..18d91da2c 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.04 20:30} +\newcontextversion{2014.09.06 12:50} %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 64baada13..7ec9dcdb7 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 b6d117303..14c00e588 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.04 20:30} +\edef\contextversion{2014.09.06 12:50} \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.mkiv b/tex/context/base/publ-ini.mkiv index 515b80652..46fe46543 100644 --- a/tex/context/base/publ-ini.mkiv +++ b/tex/context/base/publ-ini.mkiv @@ -1143,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, @@ -1274,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={ }, @@ -1284,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] @@ -1317,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 add1bea9d..90d52accd 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 0785cf051..f329fa28e 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 dd58ecbd9..29b42d5be 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/04/14 20:30:55 +-- merge date : 09/06/14 12:50:36 do -- begin closure to overcome local limits and interference |