From e09fab77f609ec2b8083836551b2c225a351eae9 Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Sat, 6 Sep 2014 14:15:04 +0200 Subject: 2014-09-06 13:41:00 --- doc/context/manuals/allkind/mkiv-publications.pdf | Bin 341495 -> 341520 bytes scripts/context/lua/mtx-epub.lua | 33 ++-- tex/context/base/back-exp.lua | 195 +++++++++++---------- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4440 -> 4431 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/status-files.pdf | Bin 25037 -> 25034 bytes tex/context/base/status-lua.pdf | Bin 327163 -> 327163 bytes tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 9 files changed, 123 insertions(+), 111 deletions(-) diff --git a/doc/context/manuals/allkind/mkiv-publications.pdf b/doc/context/manuals/allkind/mkiv-publications.pdf index ff19fc87c..18444e4f0 100644 Binary files a/doc/context/manuals/allkind/mkiv-publications.pdf and b/doc/context/manuals/allkind/mkiv-publications.pdf differ diff --git a/scripts/context/lua/mtx-epub.lua b/scripts/context/lua/mtx-epub.lua index 5c6f2cf10..e9a4140a2 100644 --- a/scripts/context/lua/mtx-epub.lua +++ b/scripts/context/lua/mtx-epub.lua @@ -341,9 +341,10 @@ function scripts.epub.make() 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) + 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 @@ -360,16 +361,22 @@ function scripts.epub.make() 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 + 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 diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua index 7212f6566..85d6c5ef3 100644 --- a/tex/context/base/back-exp.lua +++ b/tex/context/base/back-exp.lua @@ -2456,8 +2456,6 @@ function builders.paragraphs.tag(head) return false end --- encoding="utf-8" - do local xmlpreamble = [[ @@ -2514,28 +2512,17 @@ local f_d_template = formatters [ [[ local f_category = formatters["/* category: %s */"] +-- + local htmltemplate = [[ %preamble% - - %title% - - - %style% @@ -2586,43 +2573,43 @@ 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('\ninvalid xhtml tree') --- 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,":","_") + -- 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('\ninvalid xhtml tree') + -- end + -- end local function cleanxhtmltree(xmltree) if xmltree then @@ -2710,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 @@ -2719,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 @@ -2738,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) @@ -2849,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 = wholepreamble(false), --- 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 = wholepreamble(false), - 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 18d91da2c..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.06 12:50} +\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 index 7ec9dcdb7..76ffe4c7f 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 14c00e588..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.06 12:50} +\edef\contextversion{2014.09.06 13:38} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 90d52accd..13f8e3462 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index f329fa28e..3487a0b94 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 29b42d5be..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/06/14 12:50:36 +-- merge date : 09/06/14 13:38:59 do -- begin closure to overcome local limits and interference -- cgit v1.2.3