From cd0cb59de49408633f5c06fea35b94f3cf558170 Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Wed, 27 Aug 2014 12:15:04 +0200 Subject: 2014-08-27 11:53:00 --- tex/context/base/back-exp-div.lua | 23 -- tex/context/base/back-exp-html.lua | 52 ---- tex/context/base/back-exp.lua | 137 +++++++-- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4439 -> 4438 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/export-example.css | 313 ++++++++++++--------- tex/context/base/lang-ini.lua | 21 +- tex/context/base/lxml-aux.lua | 26 +- tex/context/base/node-tsk.lua | 8 + tex/context/base/publ-ini.lua | 13 +- tex/context/base/status-files.pdf | Bin 24967 -> 25013 bytes tex/context/base/status-lua.pdf | Bin 327042 -> 327110 bytes tex/context/base/strc-tag.mkiv | 18 +- tex/context/base/util-seq.lua | 13 + tex/context/base/util-tab.lua | 11 + tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 17 files changed, 385 insertions(+), 256 deletions(-) delete mode 100644 tex/context/base/back-exp-div.lua delete mode 100644 tex/context/base/back-exp-html.lua (limited to 'tex') 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..00184dad8 100644 --- a/tex/context/base/back-exp.lua +++ b/tex/context/base/back-exp.lua @@ -2414,10 +2414,14 @@ local xmlpreamble = [[ local f_csspreamble = formatters [ [[ +]] ] +local f_cssheadlink = formatters [ [[ + ]] ] 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,31 @@ local f_d_template = formatters [ [[ display: %s ; }]] ] - local f_category = formatters["/* category: %s */"] +local f_category = formatters["/* category: %s */"] + +local htmltemplate = [[ +%preamble% + + + + + + %title% + + + + + +%style% + + + + +%body% + + + +]] local displaymapping = { inline = "inline", @@ -2539,7 +2568,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 +2606,41 @@ 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 + -- math + 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 } + for k, v in next, at do + class[#class+1] = k .. "-" .. v + end + c.at = { class = concat(class," ") } + c.tg = "div" + end + end + end end local cssfile, xhtmlfile, alternative = nil, nil, nil @@ -2632,9 +2692,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 +2716,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 +2744,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..c43cd5123 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 11:51} %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 3e7a37603..b9df67e43 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 f5a1dce60..b49c065ae 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 11:51} \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..a00b28c8f 100644 --- a/tex/context/base/export-example.css +++ b/tex/context/base/export-example.css @@ -10,62 +10,67 @@ /* 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 +78,7 @@ paragraph, p { /* break : display */ -break { +break, div.break { display : block ; margin-bottom : 0.5em ; } @@ -81,14 +86,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 +101,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 +194,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 +229,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 +267,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 +282,10 @@ descriptiontag { font-weight : bold ; } -descriptioncontent { +descriptioncontent, div.descriptioncontent { } -descriptionsymbol { +descriptionsymbol, div.descriptionsymbol { } /* verbatimblock : display */ @@ -280,7 +293,7 @@ descriptionsymbol { /* verbatimline : mixed */ /* verbatim : inline */ -verbatimblock { +verbatimblock, div.verbatimblock { background-color : rgb(50%,50%,100%) ; display : block ; padding : 1em ; @@ -289,17 +302,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 +322,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 +341,7 @@ line { /* synonym : inline */ /* sorting : inline */ -sorting, synonym { +sorting, synonym, div.sorting, div.synonym { display : inline ; font-variant : small-caps ; } @@ -342,7 +356,7 @@ sorting, synonym { /* registerpage : inline */ /* registerpagerange : mixed */ -register { +register, div.register { display: none ; } @@ -350,33 +364,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 +400,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 +444,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 +474,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 +516,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 +566,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 +609,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 +625,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 +701,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 +755,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 index df96a33dc..dae353858 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 7b82e3f2c..0f831cc0a 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ 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..e78753aa8 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 11:51:05 do -- begin closure to overcome local limits and interference -- cgit v1.2.3