From 27b09a1e98b71c28d193f8141cab3077584541c1 Mon Sep 17 00:00:00 2001 From: Context Git Mirror Bot Date: Sat, 6 Sep 2014 21:15:05 +0200 Subject: 2014-09-06 21:02:00 --- doc/context/manuals/allkind/mkiv-publications.pdf | Bin 341061 -> 341600 bytes scripts/context/lua/mtx-epub.lua | 14 +- tex/context/base/back-exp.lua | 252 +++++++++++---------- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4435 -> 4441 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/export-example.css | 14 +- tex/context/base/status-files.pdf | Bin 25024 -> 25043 bytes tex/context/base/status-lua.pdf | Bin 327163 -> 327160 bytes tex/context/base/strc-not.mkvi | 2 +- tex/context/base/strc-tag.lua | 4 +- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 12 files changed, 153 insertions(+), 139 deletions(-) diff --git a/doc/context/manuals/allkind/mkiv-publications.pdf b/doc/context/manuals/allkind/mkiv-publications.pdf index 8134fd2d3..81b9537d9 100644 Binary files a/doc/context/manuals/allkind/mkiv-publications.pdf and b/doc/context/manuals/allkind/mkiv-publications.pdf differ diff --git a/scripts/context/lua/mtx-epub.lua b/scripts/context/lua/mtx-epub.lua index 2af21990d..a15058e4d 100644 --- a/scripts/context/lua/mtx-epub.lua +++ b/scripts/context/lua/mtx-epub.lua @@ -133,6 +133,8 @@ local t_toc = [[ + + @@ -165,6 +167,7 @@ local t_navtoc = [[ + navtoc @@ -188,6 +191,7 @@ local t_coverxhtml = [[ + cover page @@ -489,8 +493,16 @@ function scripts.epub.make() lfs.chdir("..") + local treefile = file.join(epubpath,epubfile) + + os.remove(epubfile) + file.copy(treefile,epubfile) + if lfs.isfile(epubfile) then + os.remove(treefile) + end + if done then - application.report("epub archive made using %s: %s",done,file.join(epubpath,epubfile)) + application.report("epub archive made using %s: %s",done,epubfile) else local list = { } for i=1,#zippers do diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua index 364949a1a..223f492c1 100644 --- a/tex/context/base/back-exp.lua +++ b/tex/context/base/back-exp.lua @@ -643,6 +643,8 @@ end do + -- is this referencing still needed? + local descriptions = { } local symbols = { } local linked = { } @@ -755,8 +757,21 @@ end -- quite some code deals with exporting references -- +-- links: +-- +-- url : +-- file : +-- internal : automatic location +-- location : named reference + +-- references: +-- +-- implicit : automatic reference +-- explicit : named reference + local evaluators = { } local specials = { } +local explicits = { } evaluators.inner = function(result,var) local inner = var.inner @@ -800,10 +815,15 @@ do evaluators["special operation"] = evaluators.special evaluators["special operation with arguments"] = evaluators.special - local f_location = formatters[' location="aut:%s"'] local f_prefix = formatters[' prefix="%s"'] - local f_destination = formatters[' destination="%s"'] local f_reference = formatters[' reference="%s"'] + local f_destination = formatters[' destination="%s"'] + + local f_implicit = formatters[' implicit="%s"'] -- automatic (internal) reference + local f_explicit = formatters[' explicit="%s"'] -- user given reference + + local f_internal = formatters[' internal="%s"'] -- links to implicit + local f_location = formatters[' location="%s"'] -- links to explicit local f_url = formatters[' url="%s"'] local f_file = formatters[' file="%s"'] @@ -857,6 +877,26 @@ do end end + local function addimplicit(result,references) + if references then + local internal = references.internal + if internal then + result[#result+1] = f_implicit(internal) + end + end + end + + local function addinternal(result,references) + if references then + local internal = references.internal + if internal then + result[#result+1] = f_internal(internal) + end + end + end + + local p_firstpart = lpeg.Cs((1-lpeg.P(","))^0) + local function addreference(result,references) if references then local reference = references.reference @@ -866,10 +906,11 @@ do result[#result+1] = f_prefix(prefix) end result[#result+1] = f_reference(lpegmatch(p_escaped,reference)) + result[#result+1] = f_explicit(lpegmatch(p_escaped,lpegmatch(p_firstpart,reference))) end local internal = references.internal if internal and internal ~= "" then - result[#result+1] = f_location(internal) + result[#result+1] = f_implicit(internal) end end end @@ -896,8 +937,12 @@ do end end + extras.addimplicit = addimplicit + extras.addinternal = addinternal + extras.adddestination = adddestination extras.addreference = addreference + extras.link = link end @@ -1312,7 +1357,7 @@ do function extras.listitem(result,element,detail,n,fulltag,di) local data = referencehash[fulltag] if data then - extras.addreference(result,data.references) + extras.addinternal(result,data.references) return true end end @@ -1333,7 +1378,7 @@ do function extras.registerlocation(result,element,detail,n,fulltag,di) local data = referencehash[fulltag] if data then - extras.addreference(result,data.references) + extras.addinternal(result,data.references) return true end end @@ -2097,7 +2142,7 @@ local function pushcontent(oldparagraph,newparagraph) if oldparagraph then pushentry(makebreaklist(currentnesting)) if trace_export then - report_export("%w",currentdepth,oldparagraph,newparagraph) + report_export("%w",currentdepth,oldparagraph,newparagraph) end end end @@ -2521,6 +2566,8 @@ local htmltemplate = [[ + + %title% %style% @@ -2573,136 +2620,91 @@ local htmltemplate = [[ -- > -- ]] - -- local function cleanxhtmltree(xmltree) - -- if xmltree then - -- local xmlwrap = xml.wrap - -- for e in xml.collected(xmltree,"/document") do - -- e.at["xmlns:xhtml"] = "http://www.w3.org/1999/xhtml" - -- break - -- end - -- -- todo: inject xhtmlpreamble (xmlns should have be enough) - -- local wrapper = { tg = "a", ns = "xhtml", at = { href = "unknown" } } - -- for e in xml.collected(xmltree,"link") do - -- local at = e.at - -- local href - -- if at.location then - -- href = "#" .. gsub(at.location,":","_") - -- elseif at.url then - -- href = at.url - -- elseif at.file then - -- href = at.file - -- end - -- if href then - -- wrapper.at.href = href - -- xmlwrap(e,wrapper) - -- end - -- end - -- local wrapper = { tg = "a", ns = "xhtml", at = { name = "unknown" } } - -- for e in xml.collected(xmltree,"!link[@location]") do - -- local location = e.at.location - -- if location then - -- wrapper.at.name = gsub(location,":","_") - -- xmlwrap(e,wrapper) - -- end - -- end - -- return xmltree - -- else - -- return xml.convert('\ninvalid xhtml tree') - -- end - -- end - local function cleanxhtmltree(xmltree) if xmltree then - for e in xml.collected(xmltree,"link") do + local implicits = { } + local explicits = { } + local overloads = { } + for e in xml.collected(xmltree,"*") do local at = e.at - if at.location then - at.href = "#" .. gsub(at.location,":","_") - elseif at.url then - at.href = at.url - elseif at.file then - at.href = at.file + if at then + local explicit = at.explicit + local implicit = at.implicit + if explicit then + if not explicits[explicit] then + explicits[explicit] = true + at.id = explicit + if implicit then + overloads[implicit] = explicit + end + end + else + if implicit and not implicits[implicit] then + implicits[implicit] = true + at.id = "aut:" .. implicit + end + end end end - local done = { } - for e in xml.collected(xmltree,"!link[@location]") do + for e in xml.collected(xmltree,"*") do local at = e.at - local location = at.location - if location and not done[location] then - done[location] = true - at.id = gsub(location,":","_") - end - end - return xmltree - else - return xml.convert('\ninvalid xhtml tree') - end - end - - - local f_namespace = string.formatters["%s.%s"] - - local function remap(specification,source,target) - -- local specification = specification or require(specname) - -- if not specification then - -- return - -- end - -- if type(source) == "string" then - -- source = xml.load(source) - -- end - -- if type(source) ~= "table" then - -- return - -- end - local remapping = specification.remapping - if not remapping then - return - end - for i=1,#remapping do - local remap = remapping[i] - local element = remap.element - local class = remap.class - local extras = remap.extras - local namespace = extras and extras.namespace - for c in xml.collected(source,remap.pattern) do - if not c.special then - local tg = c.tg - local at = c.at - local class = { - class or (at and at.detail) or tg - } - if extras and at then - for k, v in next, extras do - local a = at[k] - if a then - local va = v[a] - if va then - if namespace then - class[#class+1] = f_namespace(tg,va) - else - class[#class+1] = va - end - end + if at then + local internal = at.internal + local location = at.location + if internal then + if location then + local explicit = overloads[location] + if explicit then + at.href = "#" .. explicit + else + at.href = "#aut:" .. internal end + else + at.href = "#aut:" .. internal end - end - if #class > 0 then - c.at = { class = concat(class," ") } else - c.at = { } - end - if element then - c.tg = element + if location then + at.href = "#" .. location + else + local url = at.url + if url then + at.href = url + else + local file = at.file + if file then + at.href = file + end + end + end end end end + return xmltree + else + return xml.convert('\ninvalid xhtml tree') end end local private = { - id = true, - location = true, - href = true, + destination = true, + prefix = true, + reference = true, + -- + id = true, + href = true, + -- + implicit = true, + explicit = true, + -- + url = true, + file = true, + internal = true, + location = true, } + local addclicks = true + local f_onclick = formatters[ [[location.href='%s']] ] + local function remap(specification,source,target) local comment = nil -- share comments for c in xml.collected(source,"*") do @@ -2735,6 +2737,8 @@ local htmltemplate = [[ class[#class+1] = k .. "-" .. v end end + else + at.href = nil end local id = at.id local href = at.href @@ -2742,9 +2746,10 @@ local htmltemplate = [[ if id then if href then c.at = { - class = class, - id = id, - href = href, + class = class, + id = id, + href = href, + onclick = addclicks and f_onclick(href) or nil, } else c.at = { @@ -2755,8 +2760,9 @@ local htmltemplate = [[ else if href then c.at = { - class = class, - href = href, + class = class, + href = href, + onclick = addclicks and f_onclick(href) or nil, } else c.at = { diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 4e786749f..5b27eb60b 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 15:41} +\newcontextversion{2014.09.06 20:59} %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 b6841d7f4..e6d7ad599 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 878d9d2a7..79b273b0a 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 15:41} +\edef\contextversion{2014.09.06 20:59} \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 2dfadb701..10db21982 100644 --- a/tex/context/base/export-example.css +++ b/tex/context/base/export-example.css @@ -298,6 +298,7 @@ descriptioncontent, div.descriptioncontent { } descriptionsymbol, div.descriptionsymbol { + display : inline ; } /* verbatimblock : display */ @@ -755,16 +756,11 @@ subsup>sub, div.subsup div.sub { vertical-align : bottom ; } -/* xhtml ... not used any more */ - -a[href] { - text-decoration : none ; - color : inherit ; -} +/* links */ -a[href]:hover { - color : rgb(50%,0%,0%) ; - text-decoration : underline ; +div[href]:hover { + color : rgb(50%,0%,0%) ; + background-color : rgb(85%,85%,85%) ; } /* setups */ diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 78277fcf4..e75a657d3 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 e49b9a37d..564b9ee68 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-not.mkvi b/tex/context/base/strc-not.mkvi index 60ab66c98..c97cf00ef 100644 --- a/tex/context/base/strc-not.mkvi +++ b/tex/context/base/strc-not.mkvi @@ -660,7 +660,7 @@ \dostoptagged \egroup \endgroup - \dostoptagged % check +% \dostoptagged % check \globallet\lastnotesymbol\relax} \unexpanded\def\strc_notes_inject_dummy % temp hack diff --git a/tex/context/base/strc-tag.lua b/tex/context/base/strc-tag.lua index 8835786bf..f51c9d5d0 100644 --- a/tex/context/base/strc-tag.lua +++ b/tex/context/base/strc-tag.lua @@ -302,9 +302,9 @@ function tags.stop() end local t = stack[nstack] if not t then - if trace_tags then + -- if trace_tags then report_tags("ignoring end tag, previous chain: %s",nstack > 0 and concat(chain[nstack],"",1,nstack) or "none") - end + -- end t = unsetvalue end texattribute[a_tagged] = t diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index c3863daf3..5f4d5c1dd 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 15:41:01 +-- merge date : 09/06/14 20:59:58 do -- begin closure to overcome local limits and interference -- cgit v1.2.3