diff options
24 files changed, 593 insertions, 345 deletions
diff --git a/doc/context/manuals/allkind/mkiv-publications.pdf b/doc/context/manuals/allkind/mkiv-publications.pdf Binary files differindex 984d19be7..b03cf0c54 100644 --- a/doc/context/manuals/allkind/mkiv-publications.pdf +++ b/doc/context/manuals/allkind/mkiv-publications.pdf diff --git a/metapost/context/base/mp-mlib.mpiv b/metapost/context/base/mp-mlib.mpiv index cc19b6805..157e2d0b1 100644 --- a/metapost/context/base/mp-mlib.mpiv +++ b/metapost/context/base/mp-mlib.mpiv @@ -76,27 +76,20 @@ def multitonecolor(expr name, fractions, components, value) = withprescript "sp_value=" & value enddef ; -% def transparent(expr alternative, transparency)(text c) = -% 1 % this permits withcolor x intoshade y -% withprescript "tr_alternative=" & decimal transparency_alternative_to_number(alternative) -% withprescript "tr_transparency=" & decimal transparency -% withcolor c -% enddef ; - -let transparency = pair ; - -def transparent(expr t)(text c) = +def transparent(expr a, t)(text c) = 1 % this permits withcolor x intoshade y - withprescript "tr_alternative=" & decimal transparency_alternative_to_number(xpart t) - withprescript "tr_transparency=" & decimal ypart t + withprescript "tr_alternative=" & decimal transparency_alternative_to_number(a) + withprescript "tr_transparency=" & decimal t withcolor c enddef ; -% def withtransparency(expr alternative, transparency) = -% withprescript "tr_alternative=" & decimal transparency_alternative_to_number(alternative) -% withprescript "tr_transparency=" & decimal transparency +% def withtransparency(expr a, t) = +% withprescript "tr_alternative=" & decimal transparency_alternative_to_number(a) +% withprescript "tr_transparency=" & decimal t % enddef ; +let transparency = pair ; + def withtransparency expr t = withprescript "tr_alternative=" & decimal transparency_alternative_to_number(xpart t) withprescript "tr_transparency=" & decimal ypart t diff --git a/scripts/context/lua/mtx-epub.lua b/scripts/context/lua/mtx-epub.lua index 11f0a2024..9eb7a5c04 100644 --- a/scripts/context/lua/mtx-epub.lua +++ b/scripts/context/lua/mtx-epub.lua @@ -20,6 +20,7 @@ if not modules then modules = { } end modules ['mtx-epub'] = { local format, gsub = string.format, string.gsub local concat = table.concat +local replace = utilities.templates.replace local helpinfo = [[ <?xml version="1.0"?> @@ -60,45 +61,45 @@ scripts.epub = scripts.epub or { } local mimetype = "application/epub+zip" -local container = [[ +local t_container = [[ <?xml version="1.0" encoding="UTF-8"?> <container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> <rootfiles> - <rootfile full-path="OEBPS/%s" media-type="application/oebps-package+xml"/> + <rootfile full-path="OEBPS/%rootfile%" media-type="application/oebps-package+xml"/> </rootfiles> </container> ]] -local package = [[ +local t_package = [[ <?xml version="1.0" encoding="UTF-8"?> -<package version="2.0" xmlns="http://www.idpf.org/2007/opf" unique-identifier="%s"> +<package version="2.0" xmlns="http://www.idpf.org/2007/opf" unique-identifier="%identifier%"> <metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf"> - <dc:title>%s</dc:title> - <dc:language>%s</dc:language> - <dc:identifier id="%s" opf:scheme="UUID">urn:uuid:%s</dc:identifier> - <dc:creator>%s</dc:creator> - <dc:date>%s</dc:date> - <meta name="cover" content="%s" /> + <dc:title>%title%</dc:title> + <dc:language>%language%</dc:language> + <dc:identifier id="%identifier%" opf:scheme="UUID">urn:uuid:%uuid%</dc:identifier> + <dc:creator>%creator%</dc:creator> + <dc:date>%date%</dc:date> + <meta name="cover" content="%firstpage%" /> </metadata> <manifest> -%s +%manifest% </manifest> <spine toc="ncx"> <itemref idref="cover-xhtml" /> - <itemref idref="%s" /> + <itemref idref="%rootfile%" /> </spine> </package> ]] -local item = [[ <item id="%s" href="%s" media-type="%s"/>]] +local t_item = [[ <item id="%id%" href="%filename%" media-type="%mime%"/>]] -local toc = [[ +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"> @@ -106,29 +107,33 @@ local toc = [[ <ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1"> <head> - <meta name="dtb:uid" content="%s" /> + <meta name="dtb:uid" content="%identifier%" /> <meta name="dtb:depth" content="2" /> <meta name="dtb:totalPgeCount" content="0" /> <meta name="dtb:maxPageNumber" content="0" /> </head> <docTitle> - <text>%s</text> + <text>%title%</text> </docTitle> + <docAuthor> + <text>%author%</text> + </docAuthor> + <navMap> <navPoint id="np-1" playOrder="1"> <navLabel> <text>start</text> </navLabel> - <content src="%s"/> + <content src="%root%"/> </navPoint> </navMap> </ncx> ]] -local coverxhtml = [[ +local t_coverxhtml = [[ <?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"> @@ -139,7 +144,7 @@ local coverxhtml = [[ </head> <body> <div> - <img src="%s" alt="The cover image" style="max-width: 100%%;" /> + <img src="%image%" alt="The cover image" style="max-width: 100%%;" /> </div> </body> </html> @@ -225,8 +230,6 @@ function scripts.epub.make() local specfile = file.replacesuffix(filename,"specification") local specification = lfs.isfile(specfile) and dofile(specfile) or { } --- inspect(specification) - local name = specification.name or file.removesuffix(filename) local identifier = specification.identifier or os.uuid(true) local files = specification.files or { file.addsuffix(filename,"xhtml") } @@ -271,7 +274,11 @@ function scripts.epub.make() local target = file.join(epubpath,"OEBPS",filename) file.copy(filename,target) application.report("copying %s to %s",filename,target) - used[#used+1] = format(item,idmaker(filename),filename,mime) + used[#used+1] = replace(t_item, { + id = idmaker(filename), + filename = filename, + mime = mime, + } ) end end @@ -304,29 +311,29 @@ function scripts.epub.make() local idmaker = idmakers[file.suffix(root)] or idmakers.default - container = format(container, - epubroot - ) - package = format(package, - identifier, - title, - language, - identifier, - os.uuid(), - creator, - os.date("!%Y-%m-%dT%H:%M:%SZ"), - idmaker(firstpage), - concat(used,"\n"), - idmaker(root) - ) - toc = format(toc, - identifier, - title, - root - ) - coverxhtml = format(coverxhtml, - firstpage - ) + container = replace(t_container, { + rootfile = epubroot + } ) + package = replace(t_package, { + identifier = identifier, + title = title, + language = language, + uuid = os.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, + 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) diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 470123046..095147e47 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -5740,7 +5740,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-tab"] = package.loaded["util-tab"] or true --- original size: 23985, stripped down to: 16069 +-- original size: 24247, stripped down to: 16248 if not modules then modules={} end modules ['util-tab']={ version=1.001, @@ -5830,6 +5830,15 @@ function tables.removevalue(t,value) end end end +function tables.replacevalue(t,oldvalue,newvalue) + if oldvalue and newvalue then + for i=1,#t do + if t[i]==oldvalue then + t[i]=newvalue + end + end + end +end function tables.insertbeforevalue(t,value,extra) for i=1,#t do if t[i]==extra then @@ -11373,7 +11382,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true --- original size: 25695, stripped down to: 18281 +-- original size: 26026, stripped down to: 18535 if not modules then modules={} end modules ['lxml-aux']={ version=1.001, @@ -12021,8 +12030,8 @@ function xml.finalizers.xml.cdata(collected) end return "" end -function xml.insertcomment(e,str,n) - table.insert(e.dt,n or 1,{ +function xml.insertcomment(e,str,n) + insert(e.dt,n or 1,{ tg="@cm@", ns="", special=true, @@ -12030,7 +12039,25 @@ function xml.insertcomment(e,str,n) dt={ str }, }) end -function xml.setcdata(e,str) +function xml.insertcdata(e,str,n) + insert(e.dt,n or 1,{ + tg="@cd@", + ns="", + special=true, + at={}, + dt={ str }, + }) +end +function xml.setcomment(e,str,n) + e.dt={ { + tg="@cm@", + ns="", + special=true, + at={}, + dt={ str }, + } } +end +function xml.setcdata(e,str) e.dt={ { tg="@cd@", ns="", @@ -17389,8 +17416,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 : 719054 --- stripped bytes : 257008 +-- original bytes : 719647 +-- stripped bytes : 257168 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 470123046..095147e47 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -5740,7 +5740,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-tab"] = package.loaded["util-tab"] or true --- original size: 23985, stripped down to: 16069 +-- original size: 24247, stripped down to: 16248 if not modules then modules={} end modules ['util-tab']={ version=1.001, @@ -5830,6 +5830,15 @@ function tables.removevalue(t,value) end end end +function tables.replacevalue(t,oldvalue,newvalue) + if oldvalue and newvalue then + for i=1,#t do + if t[i]==oldvalue then + t[i]=newvalue + end + end + end +end function tables.insertbeforevalue(t,value,extra) for i=1,#t do if t[i]==extra then @@ -11373,7 +11382,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true --- original size: 25695, stripped down to: 18281 +-- original size: 26026, stripped down to: 18535 if not modules then modules={} end modules ['lxml-aux']={ version=1.001, @@ -12021,8 +12030,8 @@ function xml.finalizers.xml.cdata(collected) end return "" end -function xml.insertcomment(e,str,n) - table.insert(e.dt,n or 1,{ +function xml.insertcomment(e,str,n) + insert(e.dt,n or 1,{ tg="@cm@", ns="", special=true, @@ -12030,7 +12039,25 @@ function xml.insertcomment(e,str,n) dt={ str }, }) end -function xml.setcdata(e,str) +function xml.insertcdata(e,str,n) + insert(e.dt,n or 1,{ + tg="@cd@", + ns="", + special=true, + at={}, + dt={ str }, + }) +end +function xml.setcomment(e,str,n) + e.dt={ { + tg="@cm@", + ns="", + special=true, + at={}, + dt={ str }, + } } +end +function xml.setcdata(e,str) e.dt={ { tg="@cd@", ns="", @@ -17389,8 +17416,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 : 719054 --- stripped bytes : 257008 +-- original bytes : 719647 +-- stripped bytes : 257168 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 470123046..095147e47 100755 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -5740,7 +5740,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-tab"] = package.loaded["util-tab"] or true --- original size: 23985, stripped down to: 16069 +-- original size: 24247, stripped down to: 16248 if not modules then modules={} end modules ['util-tab']={ version=1.001, @@ -5830,6 +5830,15 @@ function tables.removevalue(t,value) end end end +function tables.replacevalue(t,oldvalue,newvalue) + if oldvalue and newvalue then + for i=1,#t do + if t[i]==oldvalue then + t[i]=newvalue + end + end + end +end function tables.insertbeforevalue(t,value,extra) for i=1,#t do if t[i]==extra then @@ -11373,7 +11382,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true --- original size: 25695, stripped down to: 18281 +-- original size: 26026, stripped down to: 18535 if not modules then modules={} end modules ['lxml-aux']={ version=1.001, @@ -12021,8 +12030,8 @@ function xml.finalizers.xml.cdata(collected) end return "" end -function xml.insertcomment(e,str,n) - table.insert(e.dt,n or 1,{ +function xml.insertcomment(e,str,n) + insert(e.dt,n or 1,{ tg="@cm@", ns="", special=true, @@ -12030,7 +12039,25 @@ function xml.insertcomment(e,str,n) dt={ str }, }) end -function xml.setcdata(e,str) +function xml.insertcdata(e,str,n) + insert(e.dt,n or 1,{ + tg="@cd@", + ns="", + special=true, + at={}, + dt={ str }, + }) +end +function xml.setcomment(e,str,n) + e.dt={ { + tg="@cm@", + ns="", + special=true, + at={}, + dt={ str }, + } } +end +function xml.setcdata(e,str) e.dt={ { tg="@cd@", ns="", @@ -17389,8 +17416,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 : 719054 --- stripped bytes : 257008 +-- original bytes : 719647 +-- stripped bytes : 257168 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index 470123046..095147e47 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -5740,7 +5740,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-tab"] = package.loaded["util-tab"] or true --- original size: 23985, stripped down to: 16069 +-- original size: 24247, stripped down to: 16248 if not modules then modules={} end modules ['util-tab']={ version=1.001, @@ -5830,6 +5830,15 @@ function tables.removevalue(t,value) end end end +function tables.replacevalue(t,oldvalue,newvalue) + if oldvalue and newvalue then + for i=1,#t do + if t[i]==oldvalue then + t[i]=newvalue + end + end + end +end function tables.insertbeforevalue(t,value,extra) for i=1,#t do if t[i]==extra then @@ -11373,7 +11382,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-aux"] = package.loaded["lxml-aux"] or true --- original size: 25695, stripped down to: 18281 +-- original size: 26026, stripped down to: 18535 if not modules then modules={} end modules ['lxml-aux']={ version=1.001, @@ -12021,8 +12030,8 @@ function xml.finalizers.xml.cdata(collected) end return "" end -function xml.insertcomment(e,str,n) - table.insert(e.dt,n or 1,{ +function xml.insertcomment(e,str,n) + insert(e.dt,n or 1,{ tg="@cm@", ns="", special=true, @@ -12030,7 +12039,25 @@ function xml.insertcomment(e,str,n) dt={ str }, }) end -function xml.setcdata(e,str) +function xml.insertcdata(e,str,n) + insert(e.dt,n or 1,{ + tg="@cd@", + ns="", + special=true, + at={}, + dt={ str }, + }) +end +function xml.setcomment(e,str,n) + e.dt={ { + tg="@cm@", + ns="", + special=true, + at={}, + dt={ str }, + } } +end +function xml.setcdata(e,str) e.dt={ { tg="@cd@", ns="", @@ -17389,8 +17416,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 : 719054 --- stripped bytes : 257008 +-- original bytes : 719647 +-- stripped bytes : 257168 -- end library merge diff --git a/tex/context/base/back-exp-div.lua b/tex/context/base/back-exp-div.lua deleted file mode 100644 index 3a7b49cd4..000000000 --- a/tex/context/base/back-exp-div.lua +++ /dev/null @@ -1,23 +0,0 @@ -return { - name = "html export", - version = "1.00", - comment = "Experimental feature.", - author = "Hans Hagen", - copyright = "ConTeXt development team", - suffix = "html", - remapping = { - { - pattern = "!m:*", - element = "div", - extras = { - namespace = true, -- okay as we have no attributes with that name - align = { - flushleft = "left", - flushright = "right", - middle = "center", - } - } - }, - } -} - diff --git a/tex/context/base/back-exp-html.lua b/tex/context/base/back-exp-html.lua deleted file mode 100644 index e284c42dd..000000000 --- a/tex/context/base/back-exp-html.lua +++ /dev/null @@ -1,52 +0,0 @@ -return { - name = "html export", - version = "1.00", - comment = "Experimental feature.", - author = "Hans Hagen", - copyright = "ConTeXt development team", - suffix = "html", - remapping = { - { - pattern = "tabulate", - element = "table", - class = "tabulate", - }, - { - pattern = "tabulaterow", - element = "tr", - class = "tabulate.tr", - }, - { - pattern = "tabulatecell", - element = "td", - class = "tabulate.td", - extras = { - align = { - flushleft = "tabulate.td.left", - flushright = "tabulate.td.right", - middle = "tabulate.td.center", - } - } - }, - { - pattern = "break", - element = "br", - }, - { - pattern = "section", - element = "div", - }, - { - pattern = "verbatimblock", - element = "pre", - }, - { - pattern = "verbatimlines|verbatimline", - element = "div", - }, - { - pattern = "!(div|table|td|tr|pre)", - element = "div", - }, - } -} diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua index 12fec5e40..8c102c20a 100644 --- a/tex/context/base/back-exp.lua +++ b/tex/context/base/back-exp.lua @@ -140,7 +140,7 @@ local stoptiming = statistics.stoptiming -- todo: more locals (and optimize) -local exportversion = "0.31" +local exportversion = "0.32" local mathmlns = "http://www.w3.org/1998/Math/MathML" local nofcurrentcontent = 0 -- so we don't free (less garbage collection) @@ -2415,9 +2415,13 @@ local xmlpreamble = [[ local f_csspreamble = formatters [ [[ <?xml-stylesheet type="text/css" href="%s"?> ]] ] +local f_cssheadlink = formatters [ [[ +<link type="text/css" rel="stylesheet" href="%s"/> +]] ] local function allusedstylesheets(xmlfile,cssfiles,files) local result = { } + local extras = { } for i=1,#cssfiles do local cssfile = cssfiles[i] if type(cssfile) ~= "string" or cssfile == v_yes or cssfile == "" or cssfile == xmlfile then @@ -2428,8 +2432,9 @@ local f_csspreamble = formatters [ [[ files[#files+1] = cssfile report_export("adding css reference '%s'",cssfile) result[#result+1] = f_csspreamble(cssfile) + extras[#extras+1] = f_cssheadlink(cssfile) end - return concat(result) + return concat(result), concat(extras) end local f_e_template = formatters [ [[ @@ -2442,7 +2447,32 @@ local f_d_template = formatters [ [[ display: %s ; }]] ] - local f_category = formatters["/* category: %s */"] +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> + + <title>%title%</title> + + <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> + + <head> + +%style% + + </head> + <body> + +%body% + + </body> +</html> +]] local displaymapping = { inline = "inline", @@ -2539,7 +2569,7 @@ local f_d_template = formatters [ [[ return end for i=1,#remapping do - local remap = remapping[i] + local remap = remapping[i] local element = remap.element local class = remap.class local extras = remap.extras @@ -2577,10 +2607,44 @@ local f_d_template = formatters [ [[ end end end - -- if target then - -- xml.save(source,target) - -- end - -- return source + end + + local function remap(specification,source,target) + local comment = nil -- share comments + for c in xml.collected(source,"*") do + if not c.special then + local tg = c.tg + local ns = c.ns + if ns == "m" then + c.ns = "" + c.at["xmlns:m"] = nil + elseif tg == "a" then + c.ns = "" + else + -- if tg == "tabulatecell" or tg == "tablecell" then + local dt = c.dt + local nt = #dt + if nt == 0 or (nt == 1 and dt[1] == "") then + if comment then + c.dt = comment + else + xml.setcomment(c,"empty") + comment = c.dt + end + end + -- end + local at = c.at + local class = { tg } + if tg ~= "document" then + for k, v in next, at do + class[#class+1] = k .. "-" .. v + end + end + c.at = { class = concat(class," ") } + c.tg = "div" + end + end + end end local cssfile, xhtmlfile, alternative = nil, nil, nil @@ -2632,9 +2696,11 @@ local f_d_template = formatters [ [[ -- local files = { } + local x_styles, h_styles = allusedstylesheets(xmlfile,cssfiles,files) + local preamble = wholepreamble() local results = concat { - wholepreamble(), - allusedstylesheets(xmlfile,cssfiles,files), -- ads to files + preamble, + x_styles, -- adds to files result, } -- @@ -2654,6 +2720,7 @@ local f_d_template = formatters [ [[ -- local xmltree = nil if xhtmlfile then + -- basic if type(v) ~= "string" or xhtmlfile == true or xhtmlfile == v_yes or xhtmlfile == "" or xhtmlfile == xmlfile then xhtmlfile = file.replacesuffix(xmlfile,"xhtml") else @@ -2681,24 +2748,44 @@ local f_d_template = formatters [ [[ } report_export("saving specification in %a (mtxrun --script epub --make %s)",specificationfilename,specificationfilename) io.savedata(specificationfilename,table.serialize(specification,true)) - end - 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) - xml.save(xmltree,resultfile) - end - end + -- 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 end stoptiming(treehash) end diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index b8f942ea2..3e511f65a 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.08.21 09:56} +\newcontextversion{2014.08.27 12:34} %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 3e7a37603..3355cc71c 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 f5a1dce60..ec540ee32 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.08.21 09:56} +\edef\contextversion{2014.08.27 12:34} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/export-example.css b/tex/context/base/export-example.css index dbecc01fe..41b262ac4 100644 --- a/tex/context/base/export-example.css +++ b/tex/context/base/export-example.css @@ -7,65 +7,77 @@ */ +/* + + Because empty div elements are not seen we put a comment in them + so that empty table cells etc work ok. + +*/ + /* ignore : mixed */ /* metadata: display */ -ignore { +ignore, div.ignore { display : none ; } -xmetadata { +xmetadata, div.xmetadata { display : none ; } -xmetavariable { +xmetavariable, div.xmetavariable { display : none ; } /* document : display */ -document:before { +document:before, div.document:before { content : attr(title) ; font-size : 44pt ; font-weight : bold ; margin-bottom : 1em ; } -document { +document, div.document { font-family : "DejaVu Serif", "Lucida Bright", serif ; font-size : 12pt ; max-width : 50em ; padding : 1em ; /* text-align : justify ; */ + text-align : justify ; /* hyphens : manual ; */ /* text-justify : inter-word ; */ } -document>metadata { +document>metadata, div.document div.metadata { font-family : "Lucida Console", "DejaVu Sans Mono", monospace ; margin-bottom : 2em ; } -document>metadata>metavariable[name="title"]:before { +document>metadata>metavariable[name="title"]:before, + div.document div.metadata div.metavariable.name-title:before { content : "title\00A0\00A0\00A0:\00A0" ; } -document>metadata>metavariable[name="author"]:before { - content : "author\00A0\00A0:\00A0" ; +document>metadata>metavariable[name="author"]:before, + div.document div.metadata div.metavariable.name-author:before { + content : "author\00A0\00A0:\00A0" ; } -document>metadata>metavariable[name="version"]:before { +document>metadata>metavariable[name="version"]:before, + div.document div.metadata div.metavariable.name-version:before { content : "version\00A0:\00A0" ; } -document>metadata>metavariable[name="title"], document>metadata>metavariable[name="author"], document>metadata>metavariable[name="version"] { +document>metadata>metavariable[name="title"], document>metadata>metavariable[name="author"], document>metadata>metavariable[name="version"], + div.document div.metadata div.metavariable.name-title, div.document div.metadata div.metavariable.name-author, div.document div.metadata div.metavariable.name-version { display : block ; } /* paragraph : mixed */ /* p : mixed */ -paragraph, p { +paragraph, p, div.paragraph, div.p { display : block ; margin-top : 0.5em ; margin-bottom : 0.5em ; @@ -73,7 +85,7 @@ paragraph, p { /* break : display */ -break { +break, div.break { display : block ; margin-bottom : 0.5em ; } @@ -81,14 +93,14 @@ break { /* construct : inline */ /* highlight : inline */ -construct { +construct, div.construct { } -construct[detail="important"] { +construct[detail="important"], div.construct.detail-important { font-weight : bold ; } -highlight { /* todo: style and color */ +highlight, div.highlight { /* todo: style and color */ } /* section : display */ @@ -96,76 +108,90 @@ highlight { /* todo: style and color */ /* sectionnumber : mixed */ /* sectioncontent : display */ -section { +section, div.section { display : block ; } -sectioncontent { +sectioncontent, div.sectioncontent { display : block ; margin-top : 1em ; margin-bottom : 1em ; } -section[detail="chapter"], section[detail="title"] { +section[detail="chapter"], section[detail="title"], + div.section.detail-chapter, div.section.detail-title { margin-top : 3em ; margin-bottom : 2em ; } -section[detail="section"], section[detail="subject"] { +section[detail="section"], section[detail="subject"], + div.section.detail-section, div.section.detail-subject { margin-top : 2.5em ; margin-bottom : 2.5em ; } -section[detail="subsection"], section[detail="subsubject"] { +section[detail="subsection"], section[detail="subsubject"], + div.section.detail-subsection, div.section.detail-subsubject { margin-top : 2em ; margin-bottom : 2em ; } -section[detail="subsubsection"], section[detail="subsubsubject"] { +section[detail="subsubsection"], section[detail="subsubsubject"], + div.section.detail-subsubsection, div.section.detail-subsubsubject { margin-top : 1em ; margin-bottom : 0em ; } -section[detail="summary"], section[detail="subsummary"] { +section[detail="summary"], section[detail="subsummary"], + div.section.detail-summary, div.section.detail-subsummary { margin-top : 1em ; margin-bottom : 1em ; } -section[detail="chapter"]>sectionnumber { +section[detail="chapter"]>sectionnumber, + div.section.detail-chapter div.sectionnumber { display : inline-block ; margin-right : 1em ; font-size : 3em ; font-weight : bold ; } -section[detail="chapter"]>sectiontitle, section[detail="title"]>sectiontitle { +section[detail="chapter"]>sectiontitle, section[detail="title"]>sectiontitle, + div.section.detail-chapter div.sectiontitle, div.section.detail-title div.sectiontitle { + display : inline-block ; font-size : 3em ; font-weight : bold ; } -section[detail="section"]>sectiontitle, section[detail="subject"]>sectiontitle { +section[detail="section"]>sectiontitle, section[detail="subject"]>sectiontitle, + div.section.detail-section div.sectiontitle, div.section.detail-subject div.sectiontitle { + display : inline-block ; font-size : 2.5em ; font-weight : bold ; } -section[detail="subsection"]>sectiontitle, section[detail="subsubject"]>sectiontitle{ +section[detail="subsection"]>sectiontitle, section[detail="subsubject"]>sectiontitle, + div.section.detail-subsection div.sectiontitle, div.section.detail-subsubject div.sectiontitle { + display : inline-block ; font-size : 2em ; font-weight : bold ; } -section[detail="subsubsection"]>sectiontitle, section[detail="subsubsubject"]>sectiontitle{ +section[detail="subsubsection"]>sectiontitle, section[detail="subsubsubject"]>sectiontitle, + div.section.detail-subsubsection div.sectiontitle, div.section.detail-subsubsubject div.sectiontitle { + display : inline-block ; font-size : 1em ; font-weight : bold ; } -section[detail="section"]>sectionnumber { +section[detail="section"]>sectionnumber, div.section.detail-section div.sectionnumber { display : inline-block ; margin-right : 1em ; font-size : 2.5em ; font-weight : bold ; } -section[detail="summary"]>sectiontitle { +section[detail="summary"]>sectiontitle, div.section.detail-summary div.sectiontitle { display : block ; margin-top : 1em ; margin-bottom : 1em ; @@ -175,21 +201,14 @@ section[detail="summary"]>sectiontitle { border-width : .15em; } -section[detail="subsection"]>sectionnumber { - display : inline-block ; - margin-right : 1em ; - font-size : 2em ; - font-weight : bold ; -} - -section[detail="subsection"]>sectionnumber { +section[detail="subsection"]>sectionnumber, div.section.detail-subsection div.sectionnumber { display : inline-block ; margin-right : 1em ; font-size : 1em ; font-weight : bold ; } -section[detail="subsummary"]>sectiontitle { +section[detail="subsummary"]>sectiontitle, div.section.detail-subsummary div.sectiontitle { display : block ; margin-top : 1em ; margin-bottom : 1em ; @@ -217,37 +236,37 @@ section[detail="subsummary"]>sectiontitle { glyphs : 'Α' 'B' 'Γ' 'Δ' 'Ε' 'Ζ' 'Η' 'Θ' 'Ι' 'Κ' 'Λ' 'Μ' 'Ν' 'Ξ' 'Ο' 'Π' 'Ρ' 'Σ' 'Τ' 'Υ' 'Φ' 'Χ' 'Ψ' 'Ω' ; } -itemgroup { +itemgroup, div.itemgroup { display : block ; margin-bottom : 0.5em ; margin-top : 0.5em ; } -itemgroup[symbol="1"] { list-style-type : disc ; } -itemgroup[symbol="2"] { list-style-type : square ; } -itemgroup[symbol="3"] { list-style-type : square ; } -itemgroup[symbol="4"] { list-style-type : square ; } -itemgroup[symbol="5"] { list-style-type : circ ; } -itemgroup[symbol="a"] { list-style-type : lower-alpha ; } -itemgroup[symbol="A"] { list-style-type : alpha ; } -itemgroup[symbol="r"] { list-style-type : lower-roman ; } -itemgroup[symbol="R"] { list-style-type : upper-roman ; } -itemgroup[symbol="n"] { list-style-type : decimal ; } -itemgroup[symbol="g"] { list-style-type : lower-greek ; } -itemgroup[symbol="G"] { list-style-type : upper-greek ; } - -item { +itemgroup[symbol="1"], div.itemgroup.symbol-1 { list-style-type : disc ; } +itemgroup[symbol="2"], div.itemgroup.symbol-2 { list-style-type : square ; } +itemgroup[symbol="3"], div.itemgroup.symbol-3 { list-style-type : square ; } +itemgroup[symbol="4"], div.itemgroup.symbol-4 { list-style-type : square ; } +itemgroup[symbol="5"], div.itemgroup.symbol-5 { list-style-type : circ ; } +itemgroup[symbol="a"], div.itemgroup.symbol-a { list-style-type : lower-alpha ; } +itemgroup[symbol="A"], div.itemgroup.symbol-A { list-style-type : alpha ; } +itemgroup[symbol="r"], div.itemgroup.symbol-r { list-style-type : lower-roman ; } +itemgroup[symbol="R"], div.itemgroup.symbol-R { list-style-type : upper-roman ; } +itemgroup[symbol="n"], div.itemgroup.symbol-n { list-style-type : decimal ; } +itemgroup[symbol="g"], div.itemgroup.symbol-g { list-style-type : lower-greek ; } +itemgroup[symbol="G"], div.itemgroup.symbol-G { list-style-type : upper-greek ; } + +item, div.item { display : list-item ; margin-left : 1em ; margin-bottom : 0.5em ; margin-top : 0.5em ; } -itemtag { +itemtag, div.item { display: none ; } -itemcontent { +itemcontent, div.itemcontent { } /* description : display */ @@ -255,13 +274,14 @@ itemcontent { /* descriptioncontent : mixed */ /* descriptionsymbol : inline */ -description { +description, div.description { display : block ; margin-bottom : 1em ; margin-top : 1em ; } -descriptiontag { +descriptiontag, div.descriptiontag { + display : inline ; float : left ; clear : left ; margin-right : 1em ; @@ -269,10 +289,10 @@ descriptiontag { font-weight : bold ; } -descriptioncontent { +descriptioncontent, div.descriptioncontent { } -descriptionsymbol { +descriptionsymbol, div.descriptionsymbol { } /* verbatimblock : display */ @@ -280,7 +300,7 @@ descriptionsymbol { /* verbatimline : mixed */ /* verbatim : inline */ -verbatimblock { +verbatimblock, div.verbatimblock { background-color : rgb(50%,50%,100%) ; display : block ; padding : 1em ; @@ -289,17 +309,18 @@ verbatimblock { font-family : "Lucida Console", "DejaVu Sans Mono", monospace ; } -verbatimlines+verbatimlines { +verbatimlines+verbatimlines, div.verbatimlines+div.verbatimlines { display : block ; margin-top : 1em ; } -verbatimline { +verbatimline, div.verbatimline { display : block ; white-space : pre-wrap ; } -verbatim { +verbatim, div.verbatim { + display : inline ; white-space : pre-wrap ; color : rgb(60%,60%,0%) ; font-family : "Lucida Console", "DejaVu Sans Mono", monospace ; @@ -308,18 +329,18 @@ verbatim { /* lines : display */ /* line : mixed */ -lines { +lines, div.lines { display : block ; margin-bottom : 1em ; margin-top : 1em ; } -lines+lines { +lines+lines, div.lines+div.lines { display : block ; margin-top : 1em ; } -line { +line, div.line { display : block ; white-space : pre-wrap ; } @@ -327,7 +348,7 @@ line { /* synonym : inline */ /* sorting : inline */ -sorting, synonym { +sorting, synonym, div.sorting, div.synonym { display : inline ; font-variant : small-caps ; } @@ -342,7 +363,7 @@ sorting, synonym { /* registerpage : inline */ /* registerpagerange : mixed */ -register { +register, div.register { display: none ; } @@ -350,33 +371,33 @@ register { /* tablerow : display */ /* tablecell : mixed */ -table { +table, div.table { display : table ; } -tablerow { +tablerow, div.tablerow { display : table-row ; } -tablecell[align="middle"] { +tablecell[align="middle"], div.tablecell.align-middle { display : table-cell ; text-align : center ; padding : .1em ; } -tablecell[align="flushleft"] { +tablecell[align="flushleft"], div.tablecell.align-flushleft { display : table-cell ; text-align : left ; padding : .1em ; } -tablecell[align="flushright"] { +tablecell[align="flushright"], div.tablecell.align-flushright { display : table-cell ; text-align : right ; padding : .1em ; } -tablecell { +tablecell, div.tablecell { display : table-cell ; text-align : left ; padding : .1em ; @@ -386,36 +407,40 @@ tablecell { /* tabulaterow : display */ /* tabulatecell : mixed */ -tabulate { +tabulate, div.tabulate { display : table ; margin-top : 1em ; margin-bottom : 1em ; margin-left : 2.5em ; } -tabulaterow { +floatcontent>tabulate, div.floatcontent div.tabulate { + margin-left : 0em ; +} + +tabulaterow, div.tabulaterow { display : table-row ; } -tabulatecell[align="middle"] { +tabulatecell[align="middle"], div.tabulatecell.align-middle { display : table-cell ; text-align : center ; padding-right : 1em ; } -tabulatecell[align="flushleft"] { +tabulatecell[align="flushleft"], div.tabulatecell.align-flushleft { display : table-cell ; text-align : left ; padding-right : 1em ; } -tabulatecell[align="flushright"] { +tabulatecell[align="flushright"], div.tabulatecell.align-flushright { display : table-cell ; text-align : right ; padding-right : 1em ; } -tabulatecell { +tabulatecell, div.tabulatecell { display : table-cell ; text-align : left ; padding-right : 1em ; @@ -426,23 +451,23 @@ tabulatecell { /* combinationcontent : mixed */ /* combinationcaption : mixed */ -combination { +combination, div.combination { display : table ; margin-top : 0em ; margin-bottom : 0em ; } -combinationpair { +combinationpair, div.combinaitonpair { display : table-cell ; padding-right : 1em ; } -combinationcontent { +combinationcontent, div.combinationcontent { display : table-row ; text-align : center ; } -combinationcaption { +combinationcaption, div.combinationcaption { display : table-row ; padding-top : 1ex ; text-align : center ; @@ -456,36 +481,39 @@ combinationcaption { /* listdata : mixed */ /* listpage : mixed */ -list { +list, div.list { display : block ; } -listitem[detail="chapter"] { +listitem[detail="chapter"], div.listitem.detail-chapter { display : block ; margin-top : 1em ; font-weight : bold ; } -listitem[detail="section"] { +listitem[detail="section"], div.listitem.detail-section { display : block ; } -listitem[detail="subsection"] { +listitem[detail="subsection"], div.listitem.detail-subsection { display : block ; + display : inline-block ; } -listtag { +listtag, div.listtag { display : inline-block ; width : 5em ; } -listcontent { +listcontent, div.listcontent { + display : inline-block ; } -listdata { +listdata, div.listdata { + display : inline-block ; } -listpage { +listpage, div.listpage { display : none ; } @@ -495,35 +523,43 @@ listpage { /* :lang(en) */ -delimited[detail="quotation"]:before, delimitedblock[detail="quotation"]:before { - content : "\201C" ; +delimited[detail="quotation"]:before, delimitedblock[detail="quotation"]:before, + div.delimited.detail-quotation:before, div.delimitedblock.detail-quotation:before { + /* content : "\201C" ; */ + font-style : italic ; } -delimited[detail="quotation"]:after, delimitedblock[detail="quotation"]:after { - content : "\201D" ; +delimited[detail="quotation"]:after, delimitedblock[detail="quotation"]:after, + div.delimited.detail-quotation:after, div.delimitedblock.detail-quotation:after { + /* content : "\201D" ; */ + font-style : italic ; } -delimited[detail="quote"]:before, delimitedblock[detail="quote"]:before { - content : "\2018" ; +delimited[detail="quote"]:before, delimitedblock[detail="quote"]:before, + div.delimited.detail-quote:before, div.delimitedblock.detail-quote:before { + /* content : "\2018" ; */ + font-style : italic ; } -delimited[detail="quote"]:after, delimitedblock[detail="quote"]:after { - content : "\2019" ; +delimited[detail="quote"]:after, delimitedblock[detail="quote"]:after, + div.delimited.detail-quote:after, div.delimitedblock.detail-quote:after { + /* content : "\2019" ; */ + font-style : italic ; } -delimited { +delimited, div.delimited { display : inline } -delimitedblock { +delimitedblock, div.delimitedblock { display : block } -subsentence:before, subsentence:after { +subsentence:before, subsentence:after, div.subsentence:before, div.subsentence:after { content : "\2014" ; } -subsentence { +subsentence, div.subsentence { display : inline } @@ -537,32 +573,36 @@ subsentence { /* floattext : mixed */ /* floatcontent : mixed */ -float { +float, div.float { display : block ; margin-top : 1em ; margin-bottom : 1em ; margin-left : 2.5em ; } -floatcaption { +floatcaption, div.floatcaption { display : block ; margin-top : 0.5em ; color : rgb(60%,60%,0%) ; } -floatlabel { +floatlabel, div.floatlabel { + display : inline-block ; font-weight : bold ; - margin-right : 1em ; + margin-right : 0.25em ; } -floatnumber { - font-weight : bold ; +floatnumber, div.floatnumber { + display : inline ; + font-weight : bold ; + margin-right : 0.25em ; } -floattext { +floattext, div.floattext { + display : inline ; } -floatcontent { +floatcontent, div.floatcontent { } /* image : mixed */ @@ -576,11 +616,11 @@ floatcontent { height : 5.994cm ; } */ -mpgraphic:before { /* does not work with empty element */ +mpgraphic:before, div.mpgraphic:before { /* does not work with empty element */ content : "[runtime metapost graphic]" ; } -mpgraphic { +mpgraphic, div.mpgraphic { display : inline ; } @@ -592,47 +632,51 @@ mpgraphic { /* formulanumber : mixed */ /* formulacontent : display */ -formula { +formula, div.formula { display : block ; margin-top : 1em ; margin-bottom : 1em ; margin-left : 2.5em ; } -subformula { /* todo */ +subformula, div.subformula { /* todo */ display : block ; margin-top : 1em ; margin-bottom : 1em ; margin-left : 2.5em ; } -formulaset { /* todo */ +formulaset, div.formulaset { /* todo */ display : block ; margin-top : 1em ; margin-bottom : 1em ; margin-left : 2.5em ; } -formulacaption { /* todo */ +formulacaption, div.formulacaption { /* todo */ display : block ; margin-top : 0.5em ; color : rgb(60%,60%,0%) ; } -formulalabel { +formulalabel, div.formulalabel { + display : inline ; font-weight : bold ; - margin-right : 1em ; + margin-right : .25em ; } -formulanumber { +formulanumber, div.formulanumber { + display : inline ; font-weight : bold ; } -formulacontent { +formulacontent, div.formulacontent { display : block ; } -/* link : inline */ +link, div.link { + display : inline ; +} /* margintextblock : inline */ /* margintext : inline */ @@ -664,37 +708,43 @@ formulacontent { /* unit : inline */ /* number : inline */ -quantity { +quantity, div.quantity { + display : inline ; } -quantity>unit { +quantity>unit, div.quantity div.unit { + display : inline ; } -quantity>number { +quantity>number, div.quantity div.number { + display : inline ; } /* sub : inline */ /* sup : inline */ /* subsup : inline */ -sup { +sup, div.sup { + display : inline ; font-size : xx-small ; line-height : 0 ; vertical-align : top ; } -sub { +sub, div.sub { + display : inline ; font-size : xx-small ; line-height : 0 ; vertical-align : bottom ; } - -subsup>sup { +subsup>sup, div.subsup div.sup { + display : inline ; vertical-align : top ; } -subsup>sub { +subsup>sub, div.subsup div.sub { + display : inline ; vertical-align : bottom ; } @@ -712,11 +762,11 @@ a[href]:hover { /* setups */ -setup { - display : block ; +setup, div.setup { + display : block ; } -comment { +comment, div.comment { background-color : rgb(50%,75%,100%) ; display : block ; padding : 1em ; diff --git a/tex/context/base/lang-ini.lua b/tex/context/base/lang-ini.lua index a9f428caa..49eff4949 100644 --- a/tex/context/base/lang-ini.lua +++ b/tex/context/base/lang-ini.lua @@ -85,6 +85,14 @@ local function tolang(what) -- returns lang object end end +function languages.getdata(tag) -- or number + if tag then + return registered[tag] or registered[numbers[tag]] + else + return registered[numbers[tex.language]] + end +end + -- languages.tolang = tolang -- patterns=en @@ -137,13 +145,14 @@ local function loaddefinitions(tag,specification) report_initialization("loading definition %a for language %a from %a",definition,tag,fullname) end local suffix, gzipped = gzip.suffix(fullname) - local defs = table.load(fullname,gzipped and gzip.load) - if defs then -- todo: version test + local resources = table.load(fullname,gzipped and gzip.load) + if resources then -- todo: version test ok, nofloaded = true, nofloaded + 1 - -- instance:patterns (defs.patterns and defs.patterns .data or "") - -- instance:hyphenation(defs.exceptions and defs.exceptions.data or "") - instance:patterns (validdata(defs.patterns, "patterns", tag) or "") - instance:hyphenation(validdata(defs.exceptions,"exceptions",tag) or "") + -- instance:patterns (resources.patterns and resources.patterns .data or "") + -- instance:hyphenation(resources.exceptions and resources.exceptions.data or "") + instance:patterns (validdata(resources.patterns, "patterns", tag) or "") + instance:hyphenation(validdata(resources.exceptions,"exceptions",tag) or "") +data.resources = resources -- so we can use them otherwise else report_initialization("invalid definition %a for language %a in %a",definition,tag,filename) end diff --git a/tex/context/base/lxml-aux.lua b/tex/context/base/lxml-aux.lua index ba8a7ef47..2352f0756 100644 --- a/tex/context/base/lxml-aux.lua +++ b/tex/context/base/lxml-aux.lua @@ -762,8 +762,8 @@ function xml.finalizers.xml.cdata(collected) return "" end -function xml.insertcomment(e,str,n) -- also insertcdata - table.insert(e.dt,n or 1,{ +function xml.insertcomment(e,str,n) + insert(e.dt,n or 1,{ tg = "@cm@", ns = "", special = true, @@ -772,7 +772,27 @@ function xml.insertcomment(e,str,n) -- also insertcdata }) end -function xml.setcdata(e,str) -- also setcomment +function xml.insertcdata(e,str,n) + insert(e.dt,n or 1,{ + tg = "@cd@", + ns = "", + special = true, + at = { }, + dt = { str }, + }) +end + +function xml.setcomment(e,str,n) + e.dt = { { + tg = "@cm@", + ns = "", + special = true, + at = { }, + dt = { str }, + } } +end + +function xml.setcdata(e,str) e.dt = { { tg = "@cd@", ns = "", diff --git a/tex/context/base/node-tsk.lua b/tex/context/base/node-tsk.lua index dfa570b24..56a4b18ef 100644 --- a/tex/context/base/node-tsk.lua +++ b/tex/context/base/node-tsk.lua @@ -117,6 +117,14 @@ function tasks.disableaction(name,action) end end +function tasks.replaceaction(name,group,oldaction,newaction) + local data = valid(name) + if data then + sequencers.replaceaction(data.list,group,oldaction,newaction) + data.runner = false + end +end + function tasks.setaction(name,action,value) if value then tasks.enableaction(name,action) diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua index 35988cc58..fb1c01f97 100644 --- a/tex/context/base/publ-ini.lua +++ b/tex/context/base/publ-ini.lua @@ -222,9 +222,9 @@ local function finalizer() os.remove(username) username = nil end - local loaded = dataset.loaded + local loaded = dataset.loaded local sources = dataset.sources - local used = { } + local used = { } for i=1,#sources do local source = sources[i] -- if loaded[source.filename] ~= "previous" then -- needs checking @@ -336,6 +336,11 @@ setmetatableindex(usedentries,function(t,k) -- weird end end + -- to be sure +-- setmetatableindex(usedentries,"table") +-- setmetatableindex(citetolist,"table") +-- setmetatableindex(listtocite,"table") + -- return usedentries[k] end end) @@ -599,12 +604,12 @@ end function publications.enhance(dataset) -- for the moment split runs (maybe publications.enhancers) statistics.starttiming(publications) - local used = usedentries[dataset] if type(dataset) == "string" then dataset = datasets[dataset] else - -- message + -- assume table, otherwise maybe issue an error end + local used = usedentries[dataset.name] or { } local luadata = dataset.luadata local details = dataset.details local ordered = dataset.ordered diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex df96a33dc..cc2a125a9 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 7b82e3f2c..2f19ea76a 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-tag.mkiv b/tex/context/base/strc-tag.mkiv index 83eb3c142..a1cdac592 100644 --- a/tex/context/base/strc-tag.mkiv +++ b/tex/context/base/strc-tag.mkiv @@ -374,12 +374,24 @@ \let\startpar\startparagraph \let\stoppar \stopparagraph +\def\strc_tags_document_start_indeed + {\glet\strc_tags_document_start_indeed\relax + \dostarttagged\t!document\empty} + +\def\strc_tags_document_stop_indeed + {\glet\strc_tags_document_stop_indeed\relax + \dostoptagged} + \appendtoks - \dostarttagged\t!document\empty -\to \everystarttext + \strc_tags_document_start_indeed % here because otherwise products don't get a root (starttext before env) +\to \everyenableelements + +% \appendtoks +% \strc_tags_document_start_indeed +% \to \everystarttext \appendtoks - \dostoptagged + \strc_tags_document_stop_indeed \to \everystoptext \appendtoks diff --git a/tex/context/base/util-seq.lua b/tex/context/base/util-seq.lua index 35e693285..4dd9ddc33 100644 --- a/tex/context/base/util-seq.lua +++ b/tex/context/base/util-seq.lua @@ -31,6 +31,7 @@ local functions = allocate() sequencers.functions = functions local removevalue = tables.removevalue +local replacevalue = tables.replacevalue local insertaftervalue = tables.insertaftervalue local insertbeforevalue = tables.insertbeforevalue @@ -189,6 +190,18 @@ function sequencers.removeaction(t,group,action,force) end end +function sequencers.replaceaction(t,group,oldaction,newaction,force) + t = known[t] + if t then + local g = t.list[group] + if g and (force or validaction(oldaction)) then + replacevalue(g,oldaction,newaction) + t.dirty = true + t.runner = nil + end + end +end + local function localize(str) return (gsub(str,"[%.: ]+","_")) end diff --git a/tex/context/base/util-tab.lua b/tex/context/base/util-tab.lua index f9e9b318d..077c90643 100644 --- a/tex/context/base/util-tab.lua +++ b/tex/context/base/util-tab.lua @@ -98,6 +98,17 @@ function tables.removevalue(t,value) -- todo: n end end +function tables.replacevalue(t,oldvalue,newvalue) + if oldvalue and newvalue then + for i=1,#t do + if t[i] == oldvalue then + t[i] = newvalue + -- replace all, so no: return + end + end + end +end + function tables.insertbeforevalue(t,value,extra) for i=1,#t do if t[i] == extra then diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 0dfbe4b49..8f6709c1d 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 : 08/21/14 09:56:44 +-- merge date : 08/27/14 12:34:38 do -- begin closure to overcome local limits and interference |