diff options
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4393 -> 4392 bytes | |||
-rw-r--r-- | tex/context/base/context.mkiv | 3 | ||||
-rw-r--r-- | tex/context/base/core-sys.mkiv | 5 | ||||
-rw-r--r-- | tex/context/base/l-lpeg.lua | 16 | ||||
-rw-r--r-- | tex/context/base/lxml-aux.lua | 77 | ||||
-rw-r--r-- | tex/context/base/lxml-ini.mkiv | 10 | ||||
-rw-r--r-- | tex/context/base/lxml-tex.lua | 10 | ||||
-rw-r--r-- | tex/context/base/node-rul.mkiv | 6 | ||||
-rw-r--r-- | tex/context/base/publ-ini.lua | 17 | ||||
-rw-r--r-- | tex/context/base/spac-hor.mkiv | 25 | ||||
-rw-r--r-- | tex/context/base/spac-ver.mkiv | 15 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24691 -> 24700 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 342436 -> 342480 bytes | |||
-rw-r--r-- | tex/context/base/task-ini.lua | 2 | ||||
-rw-r--r-- | tex/context/base/typo-wrp.lua | 64 | ||||
-rw-r--r-- | tex/context/base/typo-wrp.mkiv | 69 | ||||
-rw-r--r-- | tex/context/base/x-asciimath.mkiv | 2 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 14 |
19 files changed, 257 insertions, 80 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index dcabceb93..a6dcfb992 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.11.12 11:56} +\newcontextversion{2014.11.12 18:16} %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 5c4a0262d..a733bef02 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 d625767ee..051bf6508 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.11.12 11:56} +\edef\contextversion{2014.11.12 18:16} \edef\contextkind {beta} %D For those who want to use this: @@ -391,6 +391,7 @@ \loadmarkfile{trac-jus} \loadmarkfile{typo-cln} +\loadmarkfile{typo-wrp} \loadmarkfile{typo-spa} \loadmarkfile{typo-krn} \loadmkvifile{typo-itc} diff --git a/tex/context/base/core-sys.mkiv b/tex/context/base/core-sys.mkiv index e05c23f0a..c3cc2a231 100644 --- a/tex/context/base/core-sys.mkiv +++ b/tex/context/base/core-sys.mkiv @@ -256,6 +256,11 @@ \dotaghighlight} {\dostoptagged}} +\unexpanded\def\highlight[#1]% + {\typo_highlights_indeed{#1}} + +\let\directhighlight\typo_highlights_indeed + \unexpanded\def\defineexpandable {\doifnextoptionalelse {\syst_basics_define_yes\def}% diff --git a/tex/context/base/l-lpeg.lua b/tex/context/base/l-lpeg.lua index 3e620a6ca..192e32f3c 100644 --- a/tex/context/base/l-lpeg.lua +++ b/tex/context/base/l-lpeg.lua @@ -186,10 +186,26 @@ local fullstripper = whitespace^0 * C((whitespace^0 * nonwhitespace^1)^0) ----- collapser = Cs(spacer^0/"" * ((spacer^1 * endofstring / "") + (spacer^1/" ") + P(1))^0) local collapser = Cs(spacer^0/"" * nonspacer^0 * ((spacer^0/" " * nonspacer^1)^0)) +local b_collapser = Cs( whitespace^0 /"" * (nonwhitespace^1 + whitespace^1/" ")^0) +local e_collapser = Cs((whitespace^1 * P(-1)/"" + nonwhitespace^1 + whitespace^1/" ")^0) +local m_collapser = Cs( (nonwhitespace^1 + whitespace^1/" ")^0) + +local b_stripper = Cs( spacer^0 /"" * (nonspacer^1 + spacer^1/" ")^0) +local e_stripper = Cs((spacer^1 * P(-1)/"" + nonspacer^1 + spacer^1/" ")^0) +local m_stripper = Cs( (nonspacer^1 + spacer^1/" ")^0) + patterns.stripper = stripper patterns.fullstripper = fullstripper patterns.collapser = collapser +patterns.b_collapser = b_collapser +patterns.m_collapser = m_collapser +patterns.e_collapser = e_collapser + +patterns.b_stripper = b_stripper +patterns.m_stripper = m_stripper +patterns.e_stripper = e_stripper + patterns.lowercase = lowercase patterns.uppercase = uppercase patterns.letter = patterns.lowercase + patterns.uppercase diff --git a/tex/context/base/lxml-aux.lua b/tex/context/base/lxml-aux.lua index 96f89d544..2b35c909c 100644 --- a/tex/context/base/lxml-aux.lua +++ b/tex/context/base/lxml-aux.lua @@ -463,65 +463,68 @@ function xml.inclusions(e,sorted) end end -local stripper = lpeg.patterns.stripper -local fullstripper = lpeg.patterns.fullstripper -local collapser = lpeg.patterns.collapser +local b_collapser = lpeg.patterns.b_collapser +local m_collapser = lpeg.patterns.m_collapser +local e_collapser = lpeg.patterns.e_collapser + +local b_stripper = lpeg.patterns.b_stripper +local m_stripper = lpeg.patterns.m_stripper +local e_stripper = lpeg.patterns.e_stripper local lpegmatch = lpeg.match local function stripelement(e,nolines,anywhere) local edt = e.dt if edt then - local strip = nolines and fullstripper or stripper - if anywhere then - local t, n = { }, 0 - for e=1,#edt do + local n = #edt + if n == 0 then + return e -- convenient + elseif anywhere then + local t = { } + local m = 0 + for e=1,n do local str = edt[e] if type(str) ~= "string" then - n = n + 1 - t[n] = str + m = m + 1 + t[m] = str elseif str ~= "" then - str = lpegmatch(strip,str) + if nolines then + str = lpegmatch((n == 1 and b_collapser) or (n == m and e_collapser) or m_collapser,str) + else + str = lpegmatch((n == 1 and b_stripper) or (n == m and e_stripper) or m_stripper,str) + end if str ~= "" then - n = n + 1 - t[n] = str + m = m + 1 + t[m] = str end end end e.dt = t else - -- we can assume a regular sparse xml table with no successive strings - -- otherwise we should use a while loop - if #edt > 0 then - -- strip front - local str = edt[1] - if type(str) ~= "string" then - -- nothing - elseif str == "" then + local str = edt[1] + if type(str) == "string" then + if str ~= "" then + str = lpegmatch(nolines and b_collapser or b_stripper,str) + end + if str == "" then remove(edt,1) + n = n - 1 else - str = lpegmatch(strip,str) - if str == "" then - remove(edt,1) - else - edt[1] = str - end + edt[1] = str end end - local nedt = #edt - if nedt > 0 then - -- strip end - local str = edt[nedt] - if type(str) ~= "string" then - -- nothing - elseif str == "" then - remove(edt) - else - str = lpegmatch(strip,str) + if n > 0 then + str = edt[n] + if type(str) == "string" then if str == "" then remove(edt) else - edt[nedt] = str + str = lpegmatch(nolines and e_collapser or e_stripper,str) + if str == "" then + remove(edt) + else + edt[n] = str + end end end end diff --git a/tex/context/base/lxml-ini.mkiv b/tex/context/base/lxml-ini.mkiv index d9258627c..13230eac8 100644 --- a/tex/context/base/lxml-ini.mkiv +++ b/tex/context/base/lxml-ini.mkiv @@ -74,8 +74,8 @@ \def\xmlflushcontext #1{\ctxlxml{context("#1")}} \def\xmlsnippet #1#2{\ctxlxml{snippet("#1",#2)}} \def\xmlelement #1#2{\ctxlxml{element("#1",#2)}} -\def\xmlregisterns #1#2{\ctxlua{xml.registerns("#1","#2")}} % document -\def\xmlremapname #1#2#3#4{\ctxlua{xml.remapname(lxml.id("#1"),"#2","#3","#4")}} % element +\def\xmlregisterns #1#2{\ctxlua{xml.registerns("#1","#2")}} % document +\def\xmlremapname #1#2#3#4{\ctxlua{xml.remapname(lxml.id("#1"),"#2","#3","#4")}} % element \def\xmlremapnamespace #1#2#3{\ctxlua{xml.renamespace(lxml.id("#1"),"#2","#3")}} % document \def\xmlchecknamespace #1#2#3{\ctxlua{xml.checknamespace(lxml.id("#1"),"#2","#3")}} % element \def\xmlsetfunction #1#2#3{\ctxlxml{setaction("#1",\!!bs#2\!!es,#3)}} @@ -116,7 +116,11 @@ \def\xmldoifnottext #1#2{\ctxlxml{doifnottext (\!!bs#1\!!es,\!!bs#2\!!es)}} % expandable \def\xmldoifelsetext #1#2{\ctxlxml{doifelsetext(\!!bs#1\!!es,\!!bs#2\!!es)}} % expandable -\def\xmldoifelseempty #1#2{\ctxlxml{doifelseempty("#1","#2")}} % #2, "*" or "" == self not yet implemented +\def\xmldoifempty #1#2{\ctxlxml{doifempty ("#1","#2")}} +\def\xmldoifnotempty #1#2{\ctxlxml{doifnotempty ("#1","#2")}} +\def\xmldoifelseempty #1#2{\ctxlxml{doifelseempty("#1","#2")}} +\def\xmldoifselfempty #1{\ctxlxml{doifempty ("#1")}} +\def\xmldoifnotselfempty #1{\ctxlxml{doifnotempty ("#1")}} \def\xmldoifelseselfempty #1{\ctxlxml{doifelseempty("#1")}} % \startxmlsetups xml:include diff --git a/tex/context/base/lxml-tex.lua b/tex/context/base/lxml-tex.lua index 974646be7..c33fdbc49 100644 --- a/tex/context/base/lxml-tex.lua +++ b/tex/context/base/lxml-tex.lua @@ -1670,17 +1670,21 @@ function lxml.doifelsetext (id,pattern) doifelse(not empty(getid(id),pattern)) e -- special case: "*" and "" -> self else lpath lookup -function lxml.doifelseempty(id,pattern) +local function checkedempty(id,pattern) local e = getid(id) if not pattern or pattern == "" then local dt = e.dt local nt = #dt - doifelse((nt == 0) or (nt == 1 and dt[1] == "")) + return (nt == 0) or (nt == 1 and dt[1] == "") else - doifelse(isempty(getid(id),pattern)) + return isempty(getid(id),pattern) end end +function lxml.doifempty (id,pattern) doif (checkedempty(id,pattern)) end +function lxml.doifnotempty (id,pattern) doifnot (checkedempty(id,pattern)) end +function lxml.doifelseempty(id,pattern) doifelse(checkedempty(id,pattern)) end + -- status info statistics.register("xml load time", function() diff --git a/tex/context/base/node-rul.mkiv b/tex/context/base/node-rul.mkiv index 2d2e61134..3cf91624a 100644 --- a/tex/context/base/node-rul.mkiv +++ b/tex/context/base/node-rul.mkiv @@ -132,12 +132,12 @@ \unexpanded\def\node_rules_direct#1% {\groupedcommand{\node_rules_set{#1}}\relax} -\def\node_rules_set +\unexpanded\def\node_rules_set {\ctxlua{nodes.rules.enable()}% will be moved to lua \glet\node_rules_set\node_rules_set_indeed \node_rules_set} -\def\node_rules_set_indeed#1% maybe reverse the 1000 (also maybe use more attributes instead of settings) +\unexpanded\def\node_rules_set_indeed#1% maybe reverse the 1000 (also maybe use more attributes instead of settings) {\edef\currentbar{#1}% \expandafter\let\expandafter\c_node_rules_index\csname\??barindex#1\endcsname \advance\c_node_rules_index\plusone @@ -157,6 +157,8 @@ \unexpanded\def\setbar[#1]% {\node_rules_set{#1}} +\let\directsetbar\node_rules_set + % ungrouped \newcount\c_node_rules_nesting % todo: same as colors diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua index b7f164610..a200445f4 100644 --- a/tex/context/base/publ-ini.lua +++ b/tex/context/base/publ-ini.lua @@ -719,13 +719,28 @@ do -- of the source and or style). function publications.enhancers.suffixes(dataset) - local used = usedentries[dataset.name] + + if not dataset then + -- bad news + return + else + report("analyzing previous publication run for %a",dataset.name) + end + local used = usedentries[dataset.name] + if not used then + -- probably a first run + return + end local luadata = dataset.luadata local details = dataset.details local ordered = dataset.ordered local caster = casters.author local getter = publications.directget local shorts = { } + if not luadata or not detailr or not ordered then + return + -- also bad news + end for i=1,#ordered do local entry = ordered[i] if entry then diff --git a/tex/context/base/spac-hor.mkiv b/tex/context/base/spac-hor.mkiv index e3ccc5dd6..0621af4df 100644 --- a/tex/context/base/spac-hor.mkiv +++ b/tex/context/base/spac-hor.mkiv @@ -850,31 +850,6 @@ %D In \CONTEXT\ however we save some processing time by putting %D an extra \type{\hbox} around the \type{\strutbox}. -% moved from page-lin.tex to here (due to visualization added -% in august 2003) -% -% \unexpanded \def\crlf -% {\ifhmode\unskip\else\strut\fi\ifcase\raggedstatus\hfil\fi\break} - -\unexpanded\def\crlf - {\ifhmode - \unskip - \prewordbreak\crlfplaceholder - \ifcase\raggedstatus\hfil\or\or\or\hfil\fi - \break - \else - \crlfplaceholder - \endgraf - \fi} - -\unexpanded\def\crlfplaceholder - {\strut} - -\unexpanded\def\settestcrlf - {\unexpanded\def\crlfplaceholder - {\hbox to \zeropoint - {\strut{\infofont\kern.25em}\lohi{\infofont CR}{\infofont LF}\hss}}} - %D \starttyping %D % \setuplayout[gridgrid=yes] \showgrid %D diff --git a/tex/context/base/spac-ver.mkiv b/tex/context/base/spac-ver.mkiv index 7dc00a529..96fc70ff1 100644 --- a/tex/context/base/spac-ver.mkiv +++ b/tex/context/base/spac-ver.mkiv @@ -1063,12 +1063,17 @@ \newbox\nostrutbox \setbox\nostrutbox\emptyhbox +\newtoks\everysetnostrut + \unexpanded\def\setnostrut - {\setbox\strutbox\copy\nostrutbox - \let\strut\empty - \let\endstrut\empty - \let\begstrut\empty - \let\crlfplaceholder\empty} + {\the\everysetnostrut} + +\appendtoks + \setbox\strutbox\copy\nostrutbox + \let\strut\empty + \let\endstrut\empty + \let\begstrut\empty +\to \everysetnostrut % when enabled, sigstruts will remove themselves if nothing % goes inbetween diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 4f2bb757c..c99834d6b 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 c08793164..540af65cc 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/task-ini.lua b/tex/context/base/task-ini.lua index e47d71105..71d2fec1c 100644 --- a/tex/context/base/task-ini.lua +++ b/tex/context/base/task-ini.lua @@ -24,6 +24,7 @@ local disableaction = tasks.disableaction local freezegroup = tasks.freezegroup local freezecallbacks = callbacks.freeze +appendaction("processors", "normalizers", "typesetters.wrappers.handler") -- disabled appendaction("processors", "normalizers", "typesetters.characters.handler") -- always on appendaction("processors", "normalizers", "fonts.collections.process") -- disabled appendaction("processors", "normalizers", "fonts.checkers.missing") -- disabled @@ -129,6 +130,7 @@ appendaction ("shipouts", "normalizers", "nodes.properties.delayed") -- enabl -- speedup: only kick in when used +disableaction("processors", "typesetters.wrappers.handler") disableaction("processors", "languages.replacements.handler") disableaction("processors", "typesetters.characteralign.handler") disableaction("processors", "scripts.autofontfeature.handler") diff --git a/tex/context/base/typo-wrp.lua b/tex/context/base/typo-wrp.lua new file mode 100644 index 000000000..e859d2ef2 --- /dev/null +++ b/tex/context/base/typo-wrp.lua @@ -0,0 +1,64 @@ +if not modules then modules = { } end modules ['typo-wrp'] = { + version = 1.001, + comment = "companion to typo-wrp.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local nodecodes = nodes.nodecodes + +local glue_code = nodecodes.glue +local penalty_code = nodecodes.penalty +local parfill_skip_code = nodes.gluecodes.parfillskip +local user_penalty_code = nodes.penaltycodes.userpenalty + +local nuts = nodes.nuts +local tonut = nodes.tonut +local tonode = nodes.tonode + +local findtail = nuts.tail +local getprev = nuts.getprev +local getid = nuts.getid +local getsubtype = nuts.getsubtype +local getfield = nuts.getfield +local remove = nuts.remove + +local wrappers = { } +typesetters.wrappers = wrappers + +-- we really need to pass tail too ... but then we need to check all the plugins +-- bah ... slowdown + +local function remove_dangling_crlf(head,tail) + if tail and getid(tail) == glue_code and getsubtype(tail) == parfill_skip_code then + tail = getprev(tail) + if tail and getid(tail) == penalty_code and getsubtype(tail) == user_penalty_code and getfield(tail,"penalty") == 10000 then + tail = getprev(tail) + if tail and getid(tail) == penalty_code and getsubtype(tail) == user_penalty_code and getfield(tail,"penalty") == -10000 then + if tail == head then + -- can't happen + else + remove(head,tail,true) + return head, tail, true + end + end + end + end + return head, tail, false +end + +function wrappers.handler(head) + local head = tonut(head) + if head then + local tail = findtail(head) + local done = false + head, tail, done = remove_dangling_crlf(head,tail) -- will be action chain + end + return head, true +end + +function commands.enablecrlf() + nodes.tasks.enableaction("processors","typesetters.wrappers.handler") + function commands.enablecrlf() end +end diff --git a/tex/context/base/typo-wrp.mkiv b/tex/context/base/typo-wrp.mkiv new file mode 100644 index 000000000..111e47610 --- /dev/null +++ b/tex/context/base/typo-wrp.mkiv @@ -0,0 +1,69 @@ +%D \module +%D [ file=typo-wrp, +%D version=2014.11.09, +%D title=\CONTEXT\ Typesetting Macros, +%D subtitle=Wrappers, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\writestatus{loading}{ConTeXt Typesetting Macros / Wrapping} + +\unprotect + +\registerctxluafile{typo-wrp}{1.001} + +%D This definition has moved from page-lin.tex to spac-hor.tex (due to +%D visualization added in august 2003) and now to here (november 2014) +%D due to cacthing border cases in dirty and messy \XML\ sources). + +% \unexpanded\def\crlf +% {\ifhmode +% \unskip +% \prewordbreak\crlfplaceholder +% \ifcase\raggedstatus\hfil\or\or\or\hfil\fi +% \break +% \else +% \crlfplaceholder +% \endgraf +% \fi} + +\unexpanded\def\crlf + {\ifhmode + \expandafter\spac_crlf + \fi} + +\def\spac_crlf + {\ctxcommand{enablecrlf()}% + \glet\spac_crlf\spac_crlf_indeed + \spac_crlf} + +\unexpanded\def\spac_crlf_indeed + {\unskip + \prewordbreak % here or in \spac_crlf_placeholder + \spac_crlf_placeholder + \ifcase\raggedstatus\hfil\or\or\or\hfil\fi + \break + \ignorespaces} + +\unexpanded\def\spac_crlf_placeholder + {\strut} + +\unexpanded\def\spac_crlf_placeholder_show + {\hbox to \zeropoint{\strut{\infofont\kern.25\emwidth}\lohi{\infofont CR}{\infofont LF}\hss}} + +\unexpanded\def\settestcrlf + {\let\spac_crlf_placeholder\spac_crlf_placeholder_show} + +\unexpanded\def\crlfplaceholder % for old times sake + {\spac_crlf_placeholder} + +\appendtoks + \let\spac_crlf_placeholder\empty +\to \everysetnostrut + +\protect \endinput diff --git a/tex/context/base/x-asciimath.mkiv b/tex/context/base/x-asciimath.mkiv index c24377275..b9d7de416 100644 --- a/tex/context/base/x-asciimath.mkiv +++ b/tex/context/base/x-asciimath.mkiv @@ -1,4 +1,4 @@ -%D \module +D \module %D [ file=x-asciimath, %D version=2014.06.01, % 2006.04.24, % 1999.11.06, %D title=\CONTEXT\ Modules, diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 317ab6d92..8d402ddac 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 : 11/12/14 11:56:31 +-- merge date : 11/12/14 18:16:32 do -- begin closure to overcome local limits and interference @@ -180,9 +180,21 @@ patterns.nonwhitespace=nonwhitespace local stripper=spacer^0*C((spacer^0*nonspacer^1)^0) local fullstripper=whitespace^0*C((whitespace^0*nonwhitespace^1)^0) local collapser=Cs(spacer^0/""*nonspacer^0*((spacer^0/" "*nonspacer^1)^0)) +local b_collapser=Cs(whitespace^0/""*(nonwhitespace^1+whitespace^1/" ")^0) +local e_collapser=Cs((whitespace^1*P(-1)/""+nonwhitespace^1+whitespace^1/" ")^0) +local m_collapser=Cs((nonwhitespace^1+whitespace^1/" ")^0) +local b_stripper=Cs(spacer^0/""*(nonspacer^1+spacer^1/" ")^0) +local e_stripper=Cs((spacer^1*P(-1)/""+nonspacer^1+spacer^1/" ")^0) +local m_stripper=Cs((nonspacer^1+spacer^1/" ")^0) patterns.stripper=stripper patterns.fullstripper=fullstripper patterns.collapser=collapser +patterns.b_collapser=b_collapser +patterns.m_collapser=m_collapser +patterns.e_collapser=e_collapser +patterns.b_stripper=b_stripper +patterns.m_stripper=m_stripper +patterns.e_stripper=e_stripper patterns.lowercase=lowercase patterns.uppercase=uppercase patterns.letter=patterns.lowercase+patterns.uppercase |