diff options
author | Hans Hagen <pragma@wxs.nl> | 2018-07-06 20:02:14 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2018-07-06 20:02:14 +0200 |
commit | f58860178fcd1497d52acaa3cb2ceda7531e46ac (patch) | |
tree | fc9d7d0bd694eca619699a986f74f1f95490c37a | |
parent | d6dece4edc2ef86889f99f3dbe5a6d6ed3b68b02 (diff) | |
download | context-f58860178fcd1497d52acaa3cb2ceda7531e46ac.tar.gz |
2018-07-06 19:15:00
29 files changed, 462 insertions, 364 deletions
diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf Binary files differindex 85a803a53..1380998c0 100644 --- a/doc/context/documents/general/qrcs/setup-cs.pdf +++ b/doc/context/documents/general/qrcs/setup-cs.pdf diff --git a/doc/context/documents/general/qrcs/setup-de.pdf b/doc/context/documents/general/qrcs/setup-de.pdf Binary files differindex 94231ea0d..ffda60e11 100644 --- a/doc/context/documents/general/qrcs/setup-de.pdf +++ b/doc/context/documents/general/qrcs/setup-de.pdf diff --git a/doc/context/documents/general/qrcs/setup-en.pdf b/doc/context/documents/general/qrcs/setup-en.pdf Binary files differindex c0cfd1900..c92ba194a 100644 --- a/doc/context/documents/general/qrcs/setup-en.pdf +++ b/doc/context/documents/general/qrcs/setup-en.pdf diff --git a/doc/context/documents/general/qrcs/setup-fr.pdf b/doc/context/documents/general/qrcs/setup-fr.pdf Binary files differindex 123d2c510..e7ae18eda 100644 --- a/doc/context/documents/general/qrcs/setup-fr.pdf +++ b/doc/context/documents/general/qrcs/setup-fr.pdf diff --git a/doc/context/documents/general/qrcs/setup-it.pdf b/doc/context/documents/general/qrcs/setup-it.pdf Binary files differindex 02a68bb40..c44b7defc 100644 --- a/doc/context/documents/general/qrcs/setup-it.pdf +++ b/doc/context/documents/general/qrcs/setup-it.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf Binary files differindex ffaf5d675..ffd8d2127 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-de.pdf b/doc/context/documents/general/qrcs/setup-mapping-de.pdf Binary files differindex d3e165ce0..d4e801f0a 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-de.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-de.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-en.pdf b/doc/context/documents/general/qrcs/setup-mapping-en.pdf Binary files differindex 06a617a8e..81eb49286 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-en.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-en.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf Binary files differindex 8d1c9fb59..1f7e467f5 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-it.pdf b/doc/context/documents/general/qrcs/setup-mapping-it.pdf Binary files differindex f98c14e03..7b13337ce 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-it.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-it.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf Binary files differindex 49279d9ef..90177e867 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf Binary files differindex 1a0d75b6a..f4c443e86 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf diff --git a/doc/context/documents/general/qrcs/setup-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf Binary files differindex 151503a08..14f885db1 100644 --- a/doc/context/documents/general/qrcs/setup-nl.pdf +++ b/doc/context/documents/general/qrcs/setup-nl.pdf diff --git a/doc/context/documents/general/qrcs/setup-ro.pdf b/doc/context/documents/general/qrcs/setup-ro.pdf Binary files differindex 70649f3d0..a8f773569 100644 --- a/doc/context/documents/general/qrcs/setup-ro.pdf +++ b/doc/context/documents/general/qrcs/setup-ro.pdf diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 848071dcb..7e089de90 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2018.07.05 23:06} +\newcontextversion{2018.07.06 19:07} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index acdcfcaa2..09be8b091 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2018.07.05 23:06} +\edef\contextversion{2018.07.06 19:07} %D For those who want to use this: diff --git a/tex/context/base/mkiv/back-exp.lua b/tex/context/base/mkiv/back-exp.lua index 693ec0118..94f33791f 100644 --- a/tex/context/base/mkiv/back-exp.lua +++ b/tex/context/base/mkiv/back-exp.lua @@ -37,7 +37,7 @@ local next, type, tonumber = next, type, tonumber local sub, gsub = string.sub, string.gsub local validstring = string.valid local lpegmatch = lpeg.match -local utfchar, utfvalues = utf.char, utf.values +local utfchar, utfvalues, utflen = utf.char, utf.values, utf.len local concat, insert, remove, merge, sort = table.concat, table.insert, table.remove, table.merge, table.sort local sortedhash, sortedkeys = table.sortedhash, table.sortedkeys local formatters = string.formatters @@ -82,56 +82,8 @@ local fontchar = fonts.hashes.characters local fontquads = fonts.hashes.quads local languagenames = languages.numbers -local nodecodes = nodes.nodecodes -local skipcodes = nodes.skipcodes -local listcodes = nodes.listcodes - -local hlist_code = nodecodes.hlist -local vlist_code = nodecodes.vlist -local glyph_code = nodecodes.glyph -local glue_code = nodecodes.glue -local kern_code = nodecodes.kern -local disc_code = nodecodes.disc - -local userskip_code = skipcodes.userskip -local rightskip_code = skipcodes.rightskip -local parfillskip_code = skipcodes.parfillskip -local spaceskip_code = skipcodes.spaceskip -local xspaceskip_code = skipcodes.xspaceskip - -local line_code = listcodes.line - local texgetcount = tex.getcount -local privateattribute = attributes.private -local a_characters = privateattribute('characters') -local a_exportstatus = privateattribute('exportstatus') -local a_tagged = privateattribute('tagged') -local a_taggedpar = privateattribute("taggedpar") -local a_image = privateattribute('image') -local a_reference = privateattribute('reference') -local a_textblock = privateattribute("textblock") - -local nuts = nodes.nuts -local tonut = nuts.tonut - -local getnext = nuts.getnext -local getsubtype = nuts.getsubtype -local getfont = nuts.getfont -local getchar = nuts.getchar -local getdisc = nuts.getdisc -local getcomponents = nuts.getcomponents -local getlist = nuts.getlist -local getid = nuts.getid -local getattr = nuts.getattr -local setattr = nuts.setattr -- maybe use properties -local isglyph = nuts.isglyph -local getkern = nuts.getkern -local getwidth = nuts.getwidth - -local nexthlist = nuts.traversers.hlist -local nextnode = nuts.traversers.node - local references = structures.references local structurestags = structures.tags local taglist = structurestags.taglist @@ -941,7 +893,8 @@ evaluators.special = function(di,var) end end -local referencehash = { } +local referencehash = { } +local destinationhash = { } do @@ -1059,10 +1012,37 @@ do end end + local function reference(di,element,n,fulltag) + local destination = destinationhash[fulltag] + if destination then + local d = structures.references.internals[destination] + if d then + addreference(di,d.references) + return true + else + return false + end + else + local data = di.data + if data then + for i=1,#data do + local di = data[i] + if di then + local fulltag = di.fulltag + if fulltag and reference(di,element,n,fulltag) then + return true + end + end + end + end + end + end + extras.adddestination = adddestination extras.addreference = addreference extras.link = link + extras.reference = reference end @@ -1262,22 +1242,21 @@ do } end if ndata == 0 then -root.skip = "comment" -- get rid of weird artefacts -root.nota = "weird" + root.skip = "comment" -- get rid of weird artefacts + root.nota = "weird" return elseif ndata == 1 then local d = data[1] if not d or d == "" then -root.skip = "comment" + root.skip = "comment" return elseif d.content then return else -- if ndata == 1 then local tg = d.tg --- if automathrows and roottg == "mrow" then -if automathrows and (roottg == "mrow" or roottg == "mtext") then + if automathrows and (roottg == "mrow" or roottg == "mtext") then -- maybe just always ! check spec first --- or we can have chesks.* for each as we then can flatten + -- or we can have chesks.* for each as we then can flatten if no_mrow[tg] then root.skip = "comment" end @@ -1689,10 +1668,10 @@ if automathrows and (roottg == "mrow" or roottg == "mtext") then end function checks.mrow(di) --- local d = di.data --- if d then --- checked(d) --- end + -- local d = di.data + -- if d then + -- checked(d) + -- end end -- we can move more checks here @@ -2720,7 +2699,7 @@ local function pushcontent(oldparagraph,newparagraph) local nd = #td td[nd+1] = { parnumber = oldparagraph or currentparagraph, content = content } if trace_export then - report_export("%w<!-- start content with length %s -->",currentdepth,#content) + report_export("%w<!-- start content with length %s -->",currentdepth,utflen(content)) report_export("%w%s",currentdepth,(gsub(content,"\n","\\n"))) report_export("%w<!-- stop content -->",currentdepth) end @@ -2765,96 +2744,157 @@ end -- inserts ? -local function collectresults(head,list,pat,pap) -- is last used (we also have currentattribute) - local p - for n, id in nextnode, head do - if id == glyph_code then - local c = getchar(n) - local at = getattr(n,a_tagged) or pat - if not at then - -- we need to tag the pagebody stuff as being valid skippable - -- - -- report_export("skipping character: %C (no attribute)",n.char) - else - -- we could add tonunicodes for ligatures (todo) - local components = getcomponents(n) - if components and (not characterdata[c] or overloads[c]) then -- we loose data - collectresults(components,nil,at) -- this assumes that components have the same attribute as the glyph ... we should be more tolerant (see math) +local collectresults do -- too many locals otherwise + + local nodecodes = nodes.nodecodes + local skipcodes = nodes.skipcodes + local listcodes = nodes.listcodes + + local hlist_code = nodecodes.hlist + local vlist_code = nodecodes.vlist + local glyph_code = nodecodes.glyph + local glue_code = nodecodes.glue + local kern_code = nodecodes.kern + local disc_code = nodecodes.disc + + local userskip_code = skipcodes.userskip + local rightskip_code = skipcodes.rightskip + local parfillskip_code = skipcodes.parfillskip + local spaceskip_code = skipcodes.spaceskip + local xspaceskip_code = skipcodes.xspaceskip + + local line_code = listcodes.line + + local privateattribute = attributes.private + local a_image = privateattribute('image') + local a_reference = privateattribute('reference') + local a_destination = privateattribute('destination') + local a_characters = privateattribute('characters') + local a_exportstatus = privateattribute('exportstatus') + local a_tagged = privateattribute('tagged') + local a_taggedpar = privateattribute("taggedpar") + local a_textblock = privateattribute("textblock") + + local nuts = nodes.nuts + + local getnext = nuts.getnext + local getsubtype = nuts.getsubtype + local getfont = nuts.getfont + local getchar = nuts.getchar + local getdisc = nuts.getdisc + local getcomponents = nuts.getcomponents + local getlist = nuts.getlist + local getid = nuts.getid + local getattr = nuts.getattr + local setattr = nuts.setattr -- maybe use properties + local isglyph = nuts.isglyph + local getkern = nuts.getkern + local getwidth = nuts.getwidth + + local nexthlist = nuts.traversers.hlist + local nextnode = nuts.traversers.node + + local function collectresults(head,list,pat,pap) -- is last used (we also have currentattribute) + local p + for n, id in nextnode, head do + if id == glyph_code then + local c = getchar(n) + local at = getattr(n,a_tagged) or pat + if not at then + -- we need to tag the pagebody stuff as being valid skippable + -- + -- report_export("skipping character: %C (no attribute)",n.char) else - if last ~= at then - local tl = taglist[at] - pushcontent() - currentnesting = tl - currentparagraph = getattr(n,a_taggedpar) or pap - currentattribute = at - last = at - pushentry(currentnesting) - if trace_export then - report_export("%w<!-- processing glyph %C tagged %a -->",currentdepth,c,at) - end - -- We need to intercept this here; maybe I will also move this - -- to a regular setter at the tex end. - local r = getattr(n,a_reference) - if r then - local t = tl.taglist - referencehash[t[#t]] = r -- fulltag - end - -- - elseif last then - -- we can consider tagging the pars (lines) in the parbuilder but then we loose some - -- information unless we inject a special node (but even then we can run into nesting - -- issues) - local ap = getattr(n,a_taggedpar) or pap - if ap ~= currentparagraph then - pushcontent(currentparagraph,ap) - pushentry(currentnesting) - currentattribute = last - currentparagraph = ap - end - if trace_export then - report_export("%w<!-- processing glyph %C tagged %a) -->",currentdepth,c,last) - end + -- we could add tonunicodes for ligatures (todo) + local components = getcomponents(n) + if components and (not characterdata[c] or overloads[c]) then -- we loose data + collectresults(components,nil,at) -- this assumes that components have the same attribute as the glyph ... we should be more tolerant (see math) else - if trace_export then - report_export("%w<!-- processing glyph %C tagged %a) -->",currentdepth,c,at) + if last ~= at then + local tl = taglist[at] + pushcontent() + currentnesting = tl + currentparagraph = getattr(n,a_taggedpar) or pap + currentattribute = at + last = at + pushentry(currentnesting) + if trace_export then + report_export("%w<!-- processing glyph %C tagged %a -->",currentdepth,c,at) + end + -- We need to intercept this here; maybe I will also move this + -- to a regular setter at the tex end. + local r = getattr(n,a_reference) + if r then + local t = tl.taglist + referencehash[t[#t]] = r -- fulltag + end + local d = getattr(n,a_destination) + if d then + local t = tl.taglist + destinationhash[t[#t]] = d -- fulltag + end + -- + elseif last then + -- we can consider tagging the pars (lines) in the parbuilder but then we loose some + -- information unless we inject a special node (but even then we can run into nesting + -- issues) + local ap = getattr(n,a_taggedpar) or pap + if ap ~= currentparagraph then + pushcontent(currentparagraph,ap) + pushentry(currentnesting) + currentattribute = last + currentparagraph = ap + end + if trace_export then + report_export("%w<!-- processing glyph %C tagged %a) -->",currentdepth,c,last) + end + else + if trace_export then + report_export("%w<!-- processing glyph %C tagged %a) -->",currentdepth,c,at) + end end - end - local s = getattr(n,a_exportstatus) - if s then - c = s - end - if c == 0 then - if trace_export then - report_export("%w<!-- skipping last glyph -->",currentdepth) + local s = getattr(n,a_exportstatus) + if s then + c = s end - elseif c == 0x20 then - local a = getattr(n,a_characters) - nofcurrentcontent = nofcurrentcontent + 1 - if a then + if c == 0 then if trace_export then - report_export("%w<!-- turning last space into special space %U -->",currentdepth,a) + report_export("%w<!-- skipping last glyph -->",currentdepth) + end + elseif c == 0x20 then + local a = getattr(n,a_characters) + nofcurrentcontent = nofcurrentcontent + 1 + if a then + if trace_export then + report_export("%w<!-- turning last space into special space %U -->",currentdepth,a) + end + currentcontent[nofcurrentcontent] = specialspaces[a] -- special space + else + currentcontent[nofcurrentcontent] = " " end - currentcontent[nofcurrentcontent] = specialspaces[a] -- special space else - currentcontent[nofcurrentcontent] = " " - end - else - local fc = fontchar[getfont(n)] - if fc then - fc = fc and fc[c] + local fc = fontchar[getfont(n)] if fc then - local u = fc.unicode - if not u then - nofcurrentcontent = nofcurrentcontent + 1 - currentcontent[nofcurrentcontent] = utfchar(c) - elseif type(u) == "table" then - for i=1,#u do + fc = fc and fc[c] + if fc then + local u = fc.unicode + if not u then + nofcurrentcontent = nofcurrentcontent + 1 + currentcontent[nofcurrentcontent] = utfchar(c) + elseif type(u) == "table" then + for i=1,#u do + nofcurrentcontent = nofcurrentcontent + 1 + currentcontent[nofcurrentcontent] = utfchar(u[i]) + end + else nofcurrentcontent = nofcurrentcontent + 1 - currentcontent[nofcurrentcontent] = utfchar(u[i]) + currentcontent[nofcurrentcontent] = utfchar(u) end - else + elseif c > 0 then nofcurrentcontent = nofcurrentcontent + 1 - currentcontent[nofcurrentcontent] = utfchar(u) + currentcontent[nofcurrentcontent] = utfchar(c) + else + -- we can have -1 as side effect of an explicit hyphen (unless we expand) end elseif c > 0 then nofcurrentcontent = nofcurrentcontent + 1 @@ -2862,139 +2902,104 @@ local function collectresults(head,list,pat,pap) -- is last used (we also have c else -- we can have -1 as side effect of an explicit hyphen (unless we expand) end - elseif c > 0 then - nofcurrentcontent = nofcurrentcontent + 1 - currentcontent[nofcurrentcontent] = utfchar(c) - else - -- we can have -1 as side effect of an explicit hyphen (unless we expand) end end end - end - elseif id == disc_code then -- probably too late - local pre, post, replace = getdisc(n) - if keephyphens then - if pre and not getnext(pre) and isglyph(pre) == 0xAD then -- hyphencode then - nofcurrentcontent = nofcurrentcontent + 1 - currentcontent[nofcurrentcontent] = hyphen - end - end - if replace then - collectresults(replace,nil) - end - elseif id == glue_code then - -- we need to distinguish between hskips and vskips - local ca = getattr(n,a_characters) - if ca == 0 then - -- skip this one ... already converted special character (node-acc) - elseif ca then - local a = getattr(n,a_tagged) or pat - if a then - local c = specialspaces[ca] - if last ~= a then - local tl = taglist[a] - if trace_export then - report_export("%w<!-- processing space glyph %U tagged %a case 1 -->",currentdepth,ca,a) - end - pushcontent() - currentnesting = tl - currentparagraph = getattr(n,a_taggedpar) or pap - currentattribute = a - last = a - pushentry(currentnesting) - -- no reference check (see above) - elseif last then - local ap = getattr(n,a_taggedpar) or pap - if ap ~= currentparagraph then - pushcontent(currentparagraph,ap) - pushentry(currentnesting) - currentattribute = last - currentparagraph = ap - end - if trace_export then - report_export("%w<!-- processing space glyph %U tagged %a case 2 -->",currentdepth,ca,last) - end + elseif id == disc_code then -- probably too late + local pre, post, replace = getdisc(n) + if keephyphens then + if pre and not getnext(pre) and isglyph(pre) == 0xAD then -- hyphencode then + nofcurrentcontent = nofcurrentcontent + 1 + currentcontent[nofcurrentcontent] = hyphen end - -- if somespace[currentcontent[nofcurrentcontent]] then - -- if trace_export then - -- report_export("%w<!-- removing space -->",currentdepth) - -- end - -- nofcurrentcontent = nofcurrentcontent - 1 - -- end - nofcurrentcontent = nofcurrentcontent + 1 - currentcontent[nofcurrentcontent] = c end - else - local subtype = getsubtype(n) - if subtype == userskip_code then - if getwidth(n) > threshold then - if last and not somespace[currentcontent[nofcurrentcontent]] then - local a = getattr(n,a_tagged) or pat - if a == last then - if trace_export then - report_export("%w<!-- injecting spacing 5a -->",currentdepth) - end - nofcurrentcontent = nofcurrentcontent + 1 - currentcontent[nofcurrentcontent] = " " - elseif a then - -- e.g LOGO<space>LOGO - if trace_export then - report_export("%w<!-- processing glue > threshold tagged %s becomes %s -->",currentdepth,last,a) - end - pushcontent() - if trace_export then - report_export("%w<!-- injecting spacing 5b -->",currentdepth) - end - last = a - nofcurrentcontent = nofcurrentcontent + 1 - currentcontent[nofcurrentcontent] = " " - currentnesting = taglist[last] + if replace then + collectresults(replace,nil) + end + elseif id == glue_code then + -- we need to distinguish between hskips and vskips + local ca = getattr(n,a_characters) + if ca == 0 then + -- skip this one ... already converted special character (node-acc) + elseif ca then + local a = getattr(n,a_tagged) or pat + if a then + local c = specialspaces[ca] + if last ~= a then + local tl = taglist[a] + if trace_export then + report_export("%w<!-- processing space glyph %U tagged %a case 1 -->",currentdepth,ca,a) + end + pushcontent() + currentnesting = tl + currentparagraph = getattr(n,a_taggedpar) or pap + currentattribute = a + last = a + pushentry(currentnesting) + -- no reference check (see above) + elseif last then + local ap = getattr(n,a_taggedpar) or pap + if ap ~= currentparagraph then + pushcontent(currentparagraph,ap) pushentry(currentnesting) currentattribute = last + currentparagraph = ap end - end - end - elseif subtype == spaceskip_code or subtype == xspaceskip_code then - if not somespace[currentcontent[nofcurrentcontent]] then - local a = getattr(n,a_tagged) or pat - if a == last then - if trace_export then - report_export("%w<!-- injecting spacing 7 (stay in element) -->",currentdepth) - end - nofcurrentcontent = nofcurrentcontent + 1 - currentcontent[nofcurrentcontent] = " " - else if trace_export then - report_export("%w<!-- injecting spacing 7 (end of element) -->",currentdepth) + report_export("%w<!-- processing space glyph %U tagged %a case 2 -->",currentdepth,ca,last) end - last = a - pushcontent() - nofcurrentcontent = nofcurrentcontent + 1 - currentcontent[nofcurrentcontent] = " " - currentnesting = taglist[last] - pushentry(currentnesting) - currentattribute = last end + -- if somespace[currentcontent[nofcurrentcontent]] then + -- if trace_export then + -- report_export("%w<!-- removing space -->",currentdepth) + -- end + -- nofcurrentcontent = nofcurrentcontent - 1 + -- end + nofcurrentcontent = nofcurrentcontent + 1 + currentcontent[nofcurrentcontent] = c end - elseif subtype == rightskip_code then - -- a line - if nofcurrentcontent > 0 then - local r = currentcontent[nofcurrentcontent] - if r == hyphen then - if not keephyphens then - nofcurrentcontent = nofcurrentcontent - 1 + else + local subtype = getsubtype(n) + if subtype == userskip_code then + if getwidth(n) > threshold then + if last and not somespace[currentcontent[nofcurrentcontent]] then + local a = getattr(n,a_tagged) or pat + if a == last then + if trace_export then + report_export("%w<!-- injecting spacing 5a -->",currentdepth) + end + nofcurrentcontent = nofcurrentcontent + 1 + currentcontent[nofcurrentcontent] = " " + elseif a then + -- e.g LOGO<space>LOGO + if trace_export then + report_export("%w<!-- processing glue > threshold tagged %s becomes %s -->",currentdepth,last,a) + end + pushcontent() + if trace_export then + report_export("%w<!-- injecting spacing 5b -->",currentdepth) + end + last = a + nofcurrentcontent = nofcurrentcontent + 1 + currentcontent[nofcurrentcontent] = " " + currentnesting = taglist[last] + pushentry(currentnesting) + currentattribute = last + end end - elseif not somespace[r] then + end + elseif subtype == spaceskip_code or subtype == xspaceskip_code then + if not somespace[currentcontent[nofcurrentcontent]] then local a = getattr(n,a_tagged) or pat if a == last then if trace_export then - report_export("%w<!-- injecting spacing 1 (end of line, stay in element) -->",currentdepth) + report_export("%w<!-- injecting spacing 7 (stay in element) -->",currentdepth) end nofcurrentcontent = nofcurrentcontent + 1 currentcontent[nofcurrentcontent] = " " else if trace_export then - report_export("%w<!-- injecting spacing 1 (end of line, end of element) -->",currentdepth) + report_export("%w<!-- injecting spacing 7 (end of element) -->",currentdepth) end last = a pushcontent() @@ -3005,110 +3010,125 @@ local function collectresults(head,list,pat,pap) -- is last used (we also have c currentattribute = last end end + elseif subtype == rightskip_code then + -- a line + if nofcurrentcontent > 0 then + local r = currentcontent[nofcurrentcontent] + if r == hyphen then + if not keephyphens then + nofcurrentcontent = nofcurrentcontent - 1 + end + elseif not somespace[r] then + local a = getattr(n,a_tagged) or pat + if a == last then + if trace_export then + report_export("%w<!-- injecting spacing 1 (end of line, stay in element) -->",currentdepth) + end + nofcurrentcontent = nofcurrentcontent + 1 + currentcontent[nofcurrentcontent] = " " + else + if trace_export then + report_export("%w<!-- injecting spacing 1 (end of line, end of element) -->",currentdepth) + end + last = a + pushcontent() + nofcurrentcontent = nofcurrentcontent + 1 + currentcontent[nofcurrentcontent] = " " + currentnesting = taglist[last] + pushentry(currentnesting) + currentattribute = last + end + end + end + elseif subtype == parfillskip_code then + -- deal with paragaph endings (crossings) elsewhere and we quit here + -- as we don't want the rightskip space addition + return end - elseif subtype == parfillskip_code then - -- deal with paragaph endings (crossings) elsewhere and we quit here - -- as we don't want the rightskip space addition - return - end - end - elseif id == hlist_code or id == vlist_code then - local ai = getattr(n,a_image) - if ai then - local at = getattr(n,a_tagged) or pat - if nofcurrentcontent > 0 then - pushcontent() - pushentry(currentnesting) -- ?? - end - pushentry(taglist[at]) -- has an index, todo: flag empty element - if trace_export then - report_export("%w<!-- processing image tagged %a",currentdepth,last) end - last = nil - currentparagraph = nil - else - -- we need to determine an end-of-line - local list = getlist(n) - if list then + elseif id == hlist_code or id == vlist_code then + local ai = getattr(n,a_image) + if ai then local at = getattr(n,a_tagged) or pat - collectresults(list,n,at) - end - end - elseif id == kern_code then - local kern = getkern(n) - if kern > 0 then - local limit = threshold - if p and getid(p) == glyph_code then - limit = fontquads[getfont(p)] / 4 + if nofcurrentcontent > 0 then + pushcontent() + pushentry(currentnesting) -- ?? + end + pushentry(taglist[at]) -- has an index, todo: flag empty element + if trace_export then + report_export("%w<!-- processing image tagged %a",currentdepth,last) + end + last = nil + currentparagraph = nil + else + -- we need to determine an end-of-line + local list = getlist(n) + if list then + local at = getattr(n,a_tagged) or pat + collectresults(list,n,at) + end end - if kern > limit then - if last and not somespace[currentcontent[nofcurrentcontent]] then - local a = getattr(n,a_tagged) or pat - if a == last then - if not somespace[currentcontent[nofcurrentcontent]] then + elseif id == kern_code then + local kern = getkern(n) + if kern > 0 then + local limit = threshold + if p and getid(p) == glyph_code then + limit = fontquads[getfont(p)] / 4 + end + if kern > limit then + if last and not somespace[currentcontent[nofcurrentcontent]] then + local a = getattr(n,a_tagged) or pat + if a == last then + if not somespace[currentcontent[nofcurrentcontent]] then + if trace_export then + report_export("%w<!-- injecting spacing 8 (kern %p) -->",currentdepth,kern) + end + nofcurrentcontent = nofcurrentcontent + 1 + currentcontent[nofcurrentcontent] = " " + end + elseif a then + -- e.g LOGO<space>LOGO if trace_export then - report_export("%w<!-- injecting spacing 8 (kern %p) -->",currentdepth,kern) + report_export("%w<!-- processing kern, threshold %p, tag %s => %s -->",currentdepth,limit,last,a) + end + last = a + pushcontent() + if trace_export then + report_export("%w<!-- injecting spacing 9 (kern %p) -->",currentdepth,kern) end nofcurrentcontent = nofcurrentcontent + 1 currentcontent[nofcurrentcontent] = " " + currentnesting = taglist[last] + pushentry(currentnesting) + currentattribute = last end - elseif a then - -- e.g LOGO<space>LOGO - if trace_export then - report_export("%w<!-- processing kern, threshold %p, tag %s => %s -->",currentdepth,limit,last,a) - end - last = a - pushcontent() - if trace_export then - report_export("%w<!-- injecting spacing 9 (kern %p) -->",currentdepth,kern) - end - nofcurrentcontent = nofcurrentcontent + 1 - currentcontent[nofcurrentcontent] = " " - currentnesting = taglist[last] - pushentry(currentnesting) - currentattribute = last end end end end + p = n end - p = n - end -end - -function nodes.handlers.export(head) -- hooks into the page builder - starttiming(treehash) - if trace_export then - report_export("%w<!-- start flushing page -->",currentdepth) - end - -- continueexport() - restart = true - collectresults(head) - if trace_export then - report_export("%w<!-- stop flushing page -->",currentdepth) end - stoptiming(treehash) - return head -end -function builders.paragraphs.tag(head) -- traverse_list - noftextblocks = noftextblocks + 1 - for n in nexthlist, head do - local subtype = getsubtype(n) - if subtype == line_code then - setattr(n,a_textblock,noftextblocks) - elseif subtype == glue_code or subtype == kern_code then -- no need to set fontkerns - setattr(n,a_textblock,0) + function nodes.handlers.export(head) -- hooks into the page builder + starttiming(treehash) + if trace_export then + report_export("%w<!-- start flushing page -->",currentdepth) end + -- continueexport() + restart = true + collectresults(head) + if trace_export then + report_export("%w<!-- stop flushing page -->",currentdepth) + end + stoptiming(treehash) + return head end - return false -end - -if LUATEXVERSION >= 1.090 then function builders.paragraphs.tag(head) -- traverse_list noftextblocks = noftextblocks + 1 - for n, subtype in nexthlist, head do + for n in nexthlist, head do + local subtype = getsubtype(n) if subtype == line_code then setattr(n,a_textblock,noftextblocks) elseif subtype == glue_code or subtype == kern_code then -- no need to set fontkerns @@ -3118,6 +3138,22 @@ if LUATEXVERSION >= 1.090 then return false end + if LUATEXVERSION >= 1.090 then + + function builders.paragraphs.tag(head) -- traverse_list + noftextblocks = noftextblocks + 1 + for n, subtype in nexthlist, head do + if subtype == line_code then + setattr(n,a_textblock,noftextblocks) + elseif subtype == glue_code or subtype == kern_code then -- no need to set fontkerns + setattr(n,a_textblock,0) + end + end + return false + end + + end + end do diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index f15615b0e..277666af1 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2018.07.05 23:06} +\newcontextversion{2018.07.06 19:07} %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/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index d50b42f29..523af7cde 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -42,7 +42,7 @@ %D has to match \type {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2018.07.05 23:06} +\edef\contextversion{2018.07.06 19:07} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/publ-dat.lua b/tex/context/base/mkiv/publ-dat.lua index 570e0a0b0..bf134a56e 100644 --- a/tex/context/base/mkiv/publ-dat.lua +++ b/tex/context/base/mkiv/publ-dat.lua @@ -1099,8 +1099,8 @@ do local f_start = formatters["@%s{%s,\n"] local f_field = formatters[" %s = {%s},\n"] local s_stop = "}\n\n" - local result = { s_preamble } - local n, r = 0, 1 + local result = { } + local n, r = 0, 0 for tag, data in sortedhash(tobesaved) do r = r + 1 ; result[r] = f_start(data.category or "article",tag) for key, value in sortedhash(data) do @@ -1111,8 +1111,16 @@ do r = r + 1 ; result[r] = s_stop n = n + 1 end - report("%s entries from dataset %a saved in %a",n,dataset,filename) - io.savedata(filename,concat(result)) + result = concat(result) + if find(result,"\\btxcmd") then + result = s_preamble .. result + end + if filename then + report("%s entries from dataset %a saved in %a",n,dataset,filename) + io.savedata(filename,result) + else + return result + end end function savers.lua(dataset,filename,tobesaved) @@ -1180,6 +1188,8 @@ do return dataset end + publications.savers = savers + if implement then implement { @@ -1195,6 +1205,21 @@ do } } + implement { + name = "btxentrytobuffer", + arguments = "3 strings", + actions = function(dataset,tag,target) + local d = publications.datasets[dataset] + if d then + d = d.luadata[tag] + end + if d then + d = string.fullstrip(savers.bib(dataset,false,{ [tag] = d })) + end + buffers.assign(target,d or "") + end + } + end end diff --git a/tex/context/base/mkiv/publ-ini.mkiv b/tex/context/base/mkiv/publ-ini.mkiv index 39e9308e9..a3f345360 100644 --- a/tex/context/base/mkiv/publ-ini.mkiv +++ b/tex/context/base/mkiv/publ-ini.mkiv @@ -2013,4 +2013,17 @@ \def\publ_shortcut[#1]#2% {\clf_btxshortcut{\iffirstargument#1\else\s!default\fi}{#2}} +%D Let's see when Alan finds out about this one: + +\definesymbol[btxattachment][{\infofont bib}] + +\unexpanded\def\btxattachrecord + {\iflocation + \clf_btxentrytobuffer{\currentbtxdataset}{\currentbtxtag}{temp-bib-export}% + \attachment + [\c!symbol=btxattachment,% + \c!buffer=temp-bib-export,% + \c!name={\currentbtxtag.bib}]% + \fi} + \protect diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 2cb1e6fa2..d94a27382 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 5081fb91f..78ada2867 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/strc-ref.mkvi b/tex/context/base/mkiv/strc-ref.mkvi index 0cef07780..8b887754c 100644 --- a/tex/context/base/mkiv/strc-ref.mkvi +++ b/tex/context/base/mkiv/strc-ref.mkvi @@ -165,6 +165,32 @@ \unhbox\b_strc_destination_nodes \fi} +\def\strc_references_placeholder + {\ifx\dotaggedplaceholder\empty\else + \attribute\destinationattribute\lastdestinationattribute + \dotaggedplaceholder + \fi} + +\unexpanded\def\strc_references_destination_point_yes + {\strc_references_inject_before % new + \dostarttagged\t!reference\empty + \dontleavehmode\hbox attr \destinationattribute\lastdestinationattribute\bgroup + \strc_references_flush_destination_nodes + \strc_references_placeholder + \egroup + \dostoptagged + \strc_references_inject_after} + +\unexpanded\def\strc_references_destination_point_nop + {\strc_references_inject_before % new + \dostarttagged\t!reference\empty + \dontleavehmode\hbox \bgroup + \strc_references_flush_destination_nodes + \strc_references_placeholder + \egroup + \dostoptagged + \strc_references_inject_after} + \unexpanded\def\strc_references_start_destination_nodes % messy but we need the delay {\setbox\b_strc_destination_nodes\hbox\bgroup} % also sets lastdestinationattribute @@ -238,17 +264,9 @@ \xdef\currentdestinationattribute{\number\lastdestinationattribute}% % will become an option: \ifnum\lastdestinationattribute>\zerocount - \strc_references_inject_before % new - \dontleavehmode\hbox attr \destinationattribute\lastdestinationattribute\bgroup - \strc_references_flush_destination_nodes - \egroup - \strc_references_inject_after % new + \strc_references_destination_point_yes \else\ifvoid\b_strc_destination_nodes\else - \strc_references_inject_before % new - \dontleavehmode\hbox \bgroup - \strc_references_flush_destination_nodes - \egroup - \strc_references_inject_after % new + \strc_references_destination_point_nop \fi\fi} \def\strc_references_set_page_only_destination_attribute#labels% could in fact be fully expandable @@ -322,17 +340,9 @@ \xdef\currentdestinationattribute{\number\lastdestinationattribute}% % will become an option: \ifnum\lastdestinationattribute>\zerocount - \strc_references_inject_before % new - \dontleavehmode\hbox attr \destinationattribute\lastdestinationattribute\bgroup - \strc_references_flush_destination_nodes - \egroup - \strc_references_inject_after % new + \strc_references_destination_point_yes \else\ifvoid\b_strc_destination_nodes\else - \strc_references_inject_before % new - \dontleavehmode\hbox \bgroup - \strc_references_flush_destination_nodes - \egroup - \strc_references_inject_after % new + \strc_references_destination_point_nop \fi\fi} \unexpanded\def\strc_references_direct_full diff --git a/tex/context/base/mkiv/strc-tag.lua b/tex/context/base/mkiv/strc-tag.lua index 649465a6a..e5b1403ae 100644 --- a/tex/context/base/mkiv/strc-tag.lua +++ b/tex/context/base/mkiv/strc-tag.lua @@ -157,6 +157,7 @@ local properties = allocate { -- todo: more "record = true" to improve forma subformula = { pdf = "Div", nature = "display" }, link = { pdf = "Link", nature = "inline" }, + reference = { pdf = "Span", nature = "inline" }, margintextblock = { pdf = "Span", nature = "inline" }, margintext = { pdf = "Span", nature = "inline" }, diff --git a/tex/context/base/mkiv/strc-tag.mkiv b/tex/context/base/mkiv/strc-tag.mkiv index 6d05135b5..737cb4aea 100644 --- a/tex/context/base/mkiv/strc-tag.mkiv +++ b/tex/context/base/mkiv/strc-tag.mkiv @@ -136,6 +136,7 @@ \def\t!subformula {subformula} % Div \def\t!link {link} % Link +\def\t!reference {reference} % Span \def\t!margintext {margintext} % Span \def\t!margintextblock {margintextblock} % Div @@ -298,10 +299,15 @@ \newconditional\c_strc_tags_enabled +\let\dotaggedplaceholder\empty + +\chardef\strc_tags_placeholder_char\zerocount % "FFFC + \unexpanded\def\strc_tags_enable {% once enable one is toast \global\settrue\c_strc_tags_enabled % and gets: + \let\dotaggedplaceholder \strc_tags_placeholder_char \let\dostarttagged \strc_tags_enabled_start_detail \let\dostarttaggednodetail\strc_tags_enabled_start_no_detail \let\dostarttaggedchained \strc_tags_enabled_start_chained @@ -312,12 +318,14 @@ \unexpanded\def\strc_tags_disable {\ifconditional\c_strc_tags_enabled % so now all are artifacts + \let\dotaggedplaceholder \strc_tags_placeholder_char \let\dostarttagged \strc_tags_start_nop_detail \let\dostarttaggednodetail\strc_tags_start_nop_no_detail \let\dostarttaggedchained \strc_tags_start_nop_chained \let\dostoptagged \strc_tags_stop_nop_ignore \else % initial + \let\dotaggedplaceholder \empty \let\dostarttagged \strc_tags_start_nop_detail \let\dostarttaggednodetail\strc_tags_start_nop_no_detail \let\dostarttaggedchained \strc_tags_start_nop_chained diff --git a/tex/context/fonts/mkiv/type-imp-opendyslexic.mkiv b/tex/context/fonts/mkiv/type-imp-opendyslexic.mkiv index 770d43c6c..c3b8a3ef2 100644 --- a/tex/context/fonts/mkiv/type-imp-opendyslexic.mkiv +++ b/tex/context/fonts/mkiv/type-imp-opendyslexic.mkiv @@ -29,10 +29,15 @@ \definefontsynonym [\s!SansBoldItalic] [\s!file:opendyslexicalta-bolditalic.otf] [\s!features=\s!default] \stoptypescript + \starttypescript [\s!mono] [opendyslexic] [\s!name] + \setups[\s!font:\s!fallback:\s!mono] + \definefontsynonym [\s!Mono] [\s!file:opendyslexicmono-regular.otf] [\s!features=\s!none] + \stoptypescript + \starttypescript[opendyslexic] \definetypeface [opendyslexic] [\s!rm] [\s!serif] [opendyslexic] [\s!default] \definetypeface [opendyslexic] [\s!ss] [\s!sans] [opendyslexic] [\s!default] - \definetypeface [opendyslexic] [\s!tt] [\s!mono] [dejavu] [\s!default]% [rscale=1.065] + \definetypeface [opendyslexic] [\s!tt] [\s!mono] [opendyslexic] [\s!default]% [rscale=1.065] \definetypeface [opendyslexic] [\s!mm] [\s!math] [xits] [\s!default]% [rscale=1.020] \stoptypescript diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex c0cfd1900..c92ba194a 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex ee2bcebcf..04f5a960f 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf |