summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/back-exp.lua195
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4440 -> 4431 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/status-files.pdfbin25037 -> 25034 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin327163 -> 327163 bytes
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
7 files changed, 103 insertions, 98 deletions
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 */"]
+-- <!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.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd" >
-
--->
-
<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>
@@ -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('<?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,":","_")
+ -- 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
@@ -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
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files 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
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index f329fa28e..3487a0b94 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files 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