diff options
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4378 -> 4388 bytes | |||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/publ-fnd.lua | 69 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24710 -> 24721 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 333933 -> 333941 bytes | |||
-rw-r--r-- | tex/context/base/x-asciimath.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/x-mathml-basics.mkiv | 194 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 2 |
9 files changed, 250 insertions, 21 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index afbd1292a..d85391c91 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.10.16 17:26} +\newcontextversion{2014.10.17 11:55} %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 edd049408..588cb7645 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 3b9dc48c5..6573f9f08 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.10.16 17:26} +\edef\contextversion{2014.10.17 11:55} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/publ-fnd.lua b/tex/context/base/publ-fnd.lua index ba60bdca0..739ca9d29 100644 --- a/tex/context/base/publ-fnd.lua +++ b/tex/context/base/publ-fnd.lua @@ -20,6 +20,8 @@ if not publications then end local tonumber, next, type = tonumber, next, type +local find = string.find +local lower = characters.lower local P, R, C, Cs, Cp, Cc, Carg = lpeg.P, lpeg.R, lpeg.C, lpeg.Cs, lpeg.Cp, lpeg.Cc, lpeg.Carg local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns local concat = table.concat @@ -29,16 +31,19 @@ local lowercase = characters.lower local report = logs.reporter("publications","match") -local colon = P(":") -local dash = P("-") -local lparent = P("(") -local rparent = P(")") -local space = lpegpatterns.whitespace -local valid = 1 - colon - space - lparent - rparent ------ key = C(valid^1) -local key = C(R("az","AZ")^1) -local word = Cs(lpegpatterns.unquoted + lpegpatterns.argument + valid^1) -local number = C(valid^1) +local colon = P(":") +local dash = P("-") +local lparent = P("(") +local rparent = P(")") +local space = lpegpatterns.whitespace +local utf8char = lpegpatterns.utf8character +local valid = 1 - colon - space - lparent - rparent +----- key = C(valid^1) +local key = C(R("az","AZ")^1) +local wildcard = C("*") +local word = Cs(lpegpatterns.unquoted + lpegpatterns.argument + valid^1) +local simple = C(valid^1) +local number = C(valid^1) ----- f_string_key = formatters[" local s_%s = entry[%q]"] local f_string_key = formatters[" local s_%s = entry[%q] if s_%s then s_%s = lower(s_%s) end "] @@ -50,10 +55,21 @@ local f_string_match = formatters["(s_%s and find(s_%s,%q))"] local f_number_match = formatters["(n_%s and n_%s >= %s and n_%s <= %s)"] local f_field_match = formatters["f_%s"] -local match = key * (colon/"") * word * Carg(1) / function(key,_,word,keys) - -- keys[key] = f_string_key(key,key) - keys[key] = f_string_key(key,key,key,key,key) - return f_string_match(key,key,lowercase(word)) +local f_all_match = formatters["anywhere(entry,%q)"] + +local match = ( (key + wildcard) * (colon/"") ) * word * Carg(1) / function(key,_,word,keys) + if key == "*" or key == "any" then + keys.anywhere = true + return f_all_match(lowercase(word)) + else + keys[key] = f_string_key(key,key,key,key,key) + return f_string_match(key,key,lowercase(word)) + end +end + +local default = simple * Carg(1) / function(word,keys) + keys.anywhere = true + return f_all_match(lowercase(word)) end local range = key * (colon/"") * number * (dash/"") * number * Carg(1) / function(key,_,first,_,last,keys) @@ -72,7 +88,10 @@ end local b_match = lparent local e_match = rparent * space^0 * (#P(-1) + P(",")/" or ") -- maybe also + -> and -local p_match = b_match * ((field + range + match + space + P(1))-e_match)^1 * e_match +local f_match = ((field + range + match + space + P(1))-e_match)^1 +local p_match = b_match * default * e_match + +b_match * f_match * e_match + local pattern = Cs(Cc("(") * (P("match")/"" * space^0 * p_match)^1 * Cc(")")) -- -- -- -- -- -- -- -- -- -- -- -- -- @@ -92,9 +111,18 @@ local pattern = Cs(Cc("(") * (P("match")/"" * space^0 * p_match)^1 * Cc(")")) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +function publications.anywhere(entry,str) -- helpers + for k, v in next, entry do + if find(lower(v),str) then + return true + end + end +end + local f_template = string.formatters[ [[ local find = string.find local lower = characters.lower +local anywhere = publications.anywhere return function(entry) %s return %s and true or false @@ -110,10 +138,15 @@ local function compile(expr) report("compiling expression: %s",expr) end local definitions = { } + local anywhere = false for k, v in next, keys do - definitions[#definitions+1] = v + if k == "anywhere" then + anywhere = true + else + definitions[#definitions+1] = v + end end - if #definitions == 0 then + if not anywhere and #definitions == 0 then report("invalid expression: %s",expr) elseif trace_match then for i=1,#definitions do @@ -184,7 +217,7 @@ function publications.search(dataset,expression) end return target else - return { source[expression] } + return { } -- { dataset.luadata[expression] } -- ? end end diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 26846b17c..5b24ba2ad 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 e6b431709..0c0895ff7 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/x-asciimath.mkiv b/tex/context/base/x-asciimath.mkiv index cbc28e820..c24377275 100644 --- a/tex/context/base/x-asciimath.mkiv +++ b/tex/context/base/x-asciimath.mkiv @@ -127,6 +127,8 @@ %D 3: \asciimath{x + stackrel{yyyyyyyy}{\utfchar{"23DE}} = y} \blank %D 4: \asciimath{x + stackrel{"comment"}{stackrel{\utfchar{"23DE}}{yyyyyyyy}} = y} \blank +\usemodule[mathml-basics] + \unprotect \writestatus{asciimath}{beware, this is an experimental (m4all only) module} diff --git a/tex/context/base/x-mathml-basics.mkiv b/tex/context/base/x-mathml-basics.mkiv new file mode 100644 index 000000000..3bd164c7c --- /dev/null +++ b/tex/context/base/x-mathml-basics.mkiv @@ -0,0 +1,194 @@ +% makes sense (but rel vs op ...): + +% \unexpanded\def\stackrel#1#2{\mathematics{\mathop{\let\limits\relax\mover{#2}{#1}}}} + +% this can become a core helper + +\unexpanded\def\mexecuteifdefined#1% + {\ifx#1\empty + \expandafter\secondoftwoarguments + \else\ifcsname#1\endcsname + \doubleexpandafter\firstoftwoarguments + \else + \doubleexpandafter\secondoftwoarguments + \fi\fi + {\csname#1\endcsname}} + +% mrow + +\let\mrow\mathematics + +% msub msup msubsup + +\starttexdefinition msub #1#2 + \mathematics { + #1_{#2} + } +\stoptexdefinition + +\starttexdefinition msup #1#2 + \mathematics { + #1^{#2} + } +\stoptexdefinition + +\starttexdefinition msubsup #1#2#3 + \mathematics { + #1_{#2}^{#3} + } +\stoptexdefinition + +% mn mo mi + +\let\mn\mathematics +\let\mo\mathematics +\let\mi\mathematics + +% ms mtext + +\starttexdefinition ms #1 + \text { + "#1" + } +\stoptexdefinition + +\starttexdefinition mtext #1 + \text { + #1 + } +\stoptexdefinition + +% mover + +\starttexdefinition unexpanded moverabove #1 + \edef\movercommand{\utfmathfiller\movertoken} + \mexecuteifdefined\movercommand {#1} \relax +\stoptexdefinition +\starttexdefinition unexpanded moverbase #1 + \edef\mbasecommand{\utfmathfiller\mbasetoken} + \mexecuteifdefined\mbasecommand {#1} + \relax +\stoptexdefinition +\starttexdefinition unexpanded moverbasefiller #1#2 + \edef\mbasecommand{e\utfmathcommandfiller\mbasetoken} + \mexecuteifdefined\mbasecommand \relax {#2} {} +\stoptexdefinition +\starttexdefinition unexpanded moveraccent #1#2 + \edef\movercommand{\utfmathcommandabove\movertoken} + \mexecuteifdefined\movercommand \relax {#1} +\stoptexdefinition +\starttexdefinition unexpanded movertext #1#2 + \mathtriplet {#1} {#2} {} +\stoptexdefinition +\starttexdefinition unexpanded moveraccentchecker #1#2 + \edef\movertoken{\tochar{#2}} + \doifelseutfmathabove\movertoken \moveraccent \movertext {#1}{#2} +\stoptexdefinition + +\starttexdefinition unexpanded mover #1#2 + \mathematics { + \edef\mbasetoken{\tochar{#1}} + \doifelseutfmathfiller\mbasetoken \moverbasefiller \moveraccentchecker {#1}{#2} + } +\stoptexdefinition + +% munder + +\starttexdefinition unexpanded munderbelow #1 + \edef\mundercommand{\utfmathfiller\mundertoken} + \mexecuteifdefined\mundercommand {#1} \relax +\stoptexdefinition +\starttexdefinition unexpanded munderbase #1 + \edef\mbasecommand{\utfmathfiller\mbasetoken} + \mexecuteifdefined\mbasecommand {#1} + \relax +\stoptexdefinition +\starttexdefinition unexpanded munderbasefiller #1#2 + \edef\mbasecommand{e\utfmathcommandfiller\mbasetoken} + \mexecuteifdefined\mbasecommand \relax {#2} {} +\stoptexdefinition +\starttexdefinition unexpanded munderaccent #1#2 + \edef\mundercommand{\utfmathcommandbelow\mundertoken} + \mexecuteifdefined\mundercommand \relax {#1} +\stoptexdefinition +\starttexdefinition unexpanded mundertext #1#2 + \mathtriplet {#1} {} {#2} +\stoptexdefinition +\starttexdefinition unexpanded munderaccentchecker #1#2 + \edef\mundertoken{\tochar{#2}} + \doifelseutfmathbelow\mundertoken \munderaccent \mundertext {#1}{#2} +\stoptexdefinition + +\starttexdefinition unexpanded munder #1#2 + \mathematics { + \edef\mbasetoken{\tochar{#1}} + \doifelseutfmathfiller\mbasetoken \munderbasefiller \munderaccentchecker {#1}{#2} + } +\stoptexdefinition + +% munderover + +% mfenced + +% mfrac + +% mroot msqrt + +% menclose + +% merror + +% mglyph + +% mmultiscripts + +% mpadded + +% mphantom + +% mspace + +% mstyle + +% mtable mtr mlabeledtr mtd + +% maction + +% semantics + +\continueifinputfile{x-mathml-basics.mkiv} + +\starttext + +$\mover{←}{test}$\par +$\mover{\utfchar{"2190}}{test}$\par +$\mover{e:leftarrow}{test}$\par +$\mover{x:2190}{test}$\par + +$\mover{test}{⏞}$\par +$\mover{test}{\utfchar{"23DE}}$\par +$\mover{test}{e:overbrace}$\par +$\mover{test}{x:23DE}$\par +$\mover{test}{over}$\par + +\mover{test}{⏞}\par +\mover{test}{\utfchar{"23DE}}\par +\mover{test}{e:overbrace}\par +\mover{test}{x:23DE}\par + +$\munder{←}{test}$\par +$\munder{\utfchar{"2190}}{test}$\par +$\munder{e:leftarrow}{test}$\par +$\munder{x:2190}{test}$\par + +$\munder{test}{⏟}$\par +$\munder{test}{\utfchar{"23DF}}$\par +$\munder{test}{e:underbrace}$\par +$\munder{test}{x:23DF}$\par +$\munder{test}{under}$\par + +\math{{\msup{x}{2}\mo{+}\mn{2}\mi{x}\mo{+}\mi{b}}} + +\mrow{\msup{x}{2}\mo{+}\mn{2}\mi{x}\mo{+}\mi{b}} + +\stoptext diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 1196713e6..6155d18d7 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 : 10/16/14 17:26:14 +-- merge date : 10/17/14 11:55:51 do -- begin closure to overcome local limits and interference |