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 | 4181 -> 4183 bytes | |||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/l-lpeg.lua | 26 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24508 -> 24502 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 249895 -> 249890 bytes | |||
-rw-r--r-- | tex/context/base/strc-flt.mkvi | 8 | ||||
-rw-r--r-- | tex/context/base/x-asciimath.lua | 84 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 10 |
9 files changed, 90 insertions, 42 deletions
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index c0d95f66c..f4cba9b2a 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{2015.04.10 09:29} +\newcontextversion{2015.04.10 15:19} %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 ed87e1d5e..35bc74037 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 f5726f87e..72f6cfa3c 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2015.04.10 09:29} +\edef\contextversion{2015.04.10 15:19} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/l-lpeg.lua b/tex/context/base/l-lpeg.lua index 9225b57b2..4aadadb72 100644 --- a/tex/context/base/l-lpeg.lua +++ b/tex/context/base/l-lpeg.lua @@ -841,7 +841,7 @@ local function make(t) local function making(t) local p = p_false local keys = sortedkeys(t) - local okay = t[""] +-- local okay = t[""] for i=1,#keys do local k = keys[i] if k ~= "" then @@ -850,13 +850,16 @@ local function make(t) p = p + P(k) * p_true elseif v == false then -- can't happen - elseif okay then - p = p + P(k) * (making(v) + p_true) +-- elseif okay then +-- p = p + P(k) * (making(v) + p_true) else p = p + P(k) * making(v) end end end + if t[""] then + p = p + p_true + end return p end local p = p_false @@ -869,8 +872,8 @@ local function make(t) p = p + P(k) * p_true elseif v == false then -- can't happen - elseif v[""] then - p = p + P(k) * (making(v) + p_true) +-- elseif v[""] then +-- p = p + P(k) * (making(v) + p_true) else p = p + P(k) * making(v) end @@ -956,10 +959,11 @@ function lpeg.utfchartabletopattern(list) -- goes to util-lpg return make(tree) end --- local t = { "a", "abc", "ac", "abe", "abxyz", "xy", "bef" } +-- local t = { "a", "abc", "ac", "abe", "abxyz", "xy", "bef","aa" } -- local p = lpeg.Cs((lpeg.utfchartabletopattern(t)/string.upper + 1)^1) --- + -- inspect(lpegmatch(p,"a")) +-- inspect(lpegmatch(p,"aa")) -- inspect(lpegmatch(p,"aaaa")) -- inspect(lpegmatch(p,"ac")) -- inspect(lpegmatch(p,"bc")) @@ -974,6 +978,14 @@ end -- inspect(lpegmatch(p,"abxyz")) -- inspect(lpegmatch(p,"foobarbefcrap")) +-- local t = { ["^"] = 1, ["^^"] = 2, ["^^^"] = 3, ["^^^^"] = 4 } +-- local p = lpeg.Cs((lpeg.utfchartabletopattern(t)/t + 1)^1) +-- inspect(lpegmatch(p," ^ ^^ ^^^ ^^^^ ^^^^^ ^^^^^^ ^^^^^^^ ")) + +-- local t = { ["^^"] = 2, ["^^^"] = 3, ["^^^^"] = 4 } +-- local p = lpeg.Cs((lpeg.utfchartabletopattern(t)/t + 1)^1) +-- inspect(lpegmatch(p," ^ ^^ ^^^ ^^^^ ^^^^^ ^^^^^^ ^^^^^^^ ")) + -- lpeg.utfchartabletopattern { -- utfchar(0x00A0), -- nbsp -- utfchar(0x2000), -- enquad diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex b68040c09..1f1074357 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 6d8df7fd6..2f1162456 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/strc-flt.mkvi b/tex/context/base/strc-flt.mkvi index d293a9a6c..3788700a0 100644 --- a/tex/context/base/strc-flt.mkvi +++ b/tex/context/base/strc-flt.mkvi @@ -254,8 +254,9 @@ \namedtaggedlabeltexts \t!floatlabel \currentfloat \t!floatnumber\currentfloat - {\clf_savedlistprefixednumber{\currentfloat}\currentfloatnumber\relax - \thecurrentfloatnumbersuffix}% + {\floatcaptionparameter\c!numbercommand + {\clf_savedlistprefixednumber{\currentfloat}\currentfloatnumber\relax + \thecurrentfloatnumbersuffix}}% \fi \fi \fi} @@ -263,7 +264,8 @@ {\ifnofloatcaption \else \ifx\currentfloatnumber\relax\else \dostarttagged\t!floattext\empty - \clf_savedlisttitle{\currentfloat}\currentfloatnumber\relax + \floatcaptionparameter\c!textcommand + {\clf_savedlisttitle{\currentfloat}\currentfloatnumber\relax}% \dostoptagged \fi \fi} diff --git a/tex/context/base/x-asciimath.lua b/tex/context/base/x-asciimath.lua index 4d29e8d31..7ddf5a637 100644 --- a/tex/context/base/x-asciimath.lua +++ b/tex/context/base/x-asciimath.lua @@ -29,8 +29,6 @@ local asciimath = { } local moduledata = moduledata or { } moduledata.asciimath = asciimath -local implement = interfaces.implement - if not characters then require("char-def") require("char-ini") @@ -697,6 +695,10 @@ local reserved = { ["rfloor"] = { true, "⌋" }, ["rceil"] = { true, "⌉" }, + -- a bit special: + + ["\\frac"] = { true, "frac" }, + } local isbinary = { @@ -886,8 +888,13 @@ local p_spaces = patterns.whitespace local p_utf_base = patterns.utf8character local p_utf = C(p_utf_base) -local p_entity_base = P("&") * ((1-P(";"))^2) * P(";") -local p_entity = P("&") * (((1-P(";"))^2) / entities) * P(";") +local p_entity = (P("&") * C((1-P(";"))^2) * P(";"))/ entities + +entities["gt"] = ">" +entities["lt"] = "<" +entities["amp"] = "&" +entities["dquot"] = '"' +entities["quot"] = "'" local p_onechar = p_utf_base * P(-1) @@ -896,8 +903,7 @@ local p_onechar = p_utf_base * P(-1) local sign = P("-")^-1 local digits = R("09")^1 local integer = sign * digits ------ real = sign * digits * (S(".,") * digits)^-1 -local real = digits * (S(".,") * digits)^-1 +local real = digits * (S(".") * digits)^-1 local float = real * (P("E") * integer)^-1 -- local number = C(float + integer) @@ -927,9 +933,14 @@ for k, v in sortedhash(reserved) do end for k, v in next, entities do + k_unicode[k] = v k_unicode["\\"..k] = v end +if not find(k,"[^[a-zA-Z]+$]") then + k_unicode["\\"..k] = k -- dirty trick, no real unicode +end + if not find(k,"[^a-zA-Z]") then k_reserved_words[#k_reserved_words+1] = k end @@ -1049,6 +1060,12 @@ local p_special = -- open | close :: {: | :} +local e_parser = Cs ( ( + p_entity + + p_utf_base +)^0 ) + + local u_parser = Cs ( ( patterns.doublequoted + P("text") * p_spaces^0 * P("(") * (1-P(")"))^0 * P(")") + -- -- todo: balanced @@ -1067,7 +1084,6 @@ local a_parser = Ct { "tokenizer", + Ct(p_left * V("tokenizer") * p_right) -- { (a+b,=,1),(a+b,=,7) } + p_special + p_reserved - + p_entity -- + p_utf - p_close - p_right + (p_utf - p_right) )^1, @@ -1081,8 +1097,9 @@ local function show_state(t,level,state) report_asciimath(serialize(t,f_state(level,state))) end -local function show_result(original,unicoded,texcoded) +local function show_result(original,entified,unicoded,texcoded) report_asciimath("original > %s",original) + report_asciimath("entified > %s",entified) report_asciimath("unicoded > %s",unicoded) report_asciimath("texcoded > %s",texcoded) end @@ -1202,6 +1219,7 @@ local function collapse_pairs(t) if current == "/" and i > 1 then local tl = t[i-1] local tr = t[i+1] + local tn = t[i+2] if type(tl) == "table" then if isleft[tl[1]] and isright[tl[#tl]] then tl[1] = "" -- todo: remove @@ -1209,7 +1227,9 @@ local function collapse_pairs(t) end end if type(tr) == "table" then - if isleft[tr[1]] and isright[tr[#tr]] then + if tn == "^" then + -- brr 1/(1+x)^2 + elseif isleft[tr[1]] and isright[tr[#tr]] then tr[1] = "" -- todo: remove tr[#tr] = nil end @@ -1620,10 +1640,11 @@ local ctx_type = context and context.type or function() end local ctx_inleft = context and context.inleft or function() end local function convert(str,totex) - local unicoded = lpegmatch(u_parser,str) + local entified = lpegmatch(e_parser,str) or str -- when used in text + local unicoded = lpegmatch(u_parser,entified) or entified local texcoded = collapse(lpegmatch(a_parser,unicoded)) if trace_mapping then - show_result(str,unicoded,texcoded) + show_result(str,entified,unicoded,texcoded) end if totex then ctx_mathematics(texcoded) @@ -1668,7 +1689,7 @@ local p_text = ) + patterns.doublequoted -local p_expand = Cs((p_text + p_reserved_spaced + p_entity_base + p_utf_base)^0) +local p_expand = Cs((p_text + p_reserved_spaced + p_utf_base)^0) local p_compress = patterns.collapser local function cleanedup(str) @@ -1773,13 +1794,14 @@ asciimath.cleanedup = cleanedup local function convert(str) if #str > 0 then - local unicoded = lpegmatch(u_parser,str) + local entified = lpegmatch(e_parser,str) or str -- when used in text + local unicoded = lpegmatch(u_parser,entified) or entified if lpegmatch(p_onechar,unicoded) then ctx_mathematics(unicoded) else local texcoded = collapse(lpegmatch(a_parser,unicoded)) if trace_mapping then - show_result(str,unicoded,texcoded) + show_result(str,entified,unicoded,texcoded) end if #texcoded == 0 then report_asciimath("error in asciimath: %s",str) @@ -1796,12 +1818,6 @@ local function convert(str) end end -implement { - name = "asciimath", -- module_asciimath_convert - actions = convert, - arguments = "string" -} - local context = context if not context then @@ -1814,10 +1830,24 @@ if not context then -- report_asciimath(cleanedup([[a "α" b]])) -- report_asciimath(cleanedup([[//4]])) --- convert("10000,00001") --- convert("4/18*100text(%)~~22,2") --- convert("4/18*100text(%)≈22,2") --- convert("62541/(197,6)≈316,05") +-- convert("\\frac{a}{b}") +-- convert("frac{a}{b}") +-- convert("\\sin{a}{b}") +-- convert("sin{a}{b}") +-- convert("1: rightarrow") +-- convert("2: \\rightarrow") + +-- convert("((1,2,3),(4,5,6),(7,8,9))") + +-- convert("1/(t+x)^2") + +-- convert("AA a > 0 ^^ b > 0 | {:log_g:} a + {:log_g:} b") +-- convert("AA a > 0 ^^ b > 0 | {:log_g:} a + {:log_g:} b") + +-- convert("10000,00001") +-- convert("4/18*100text(%)~~22,2") +-- convert("4/18*100text(%)≈22,2") +-- convert("62541/(197,6)≈316,05") -- convert([[sum x]]) -- convert([[sum^(1)_(2) x]]) @@ -1876,6 +1906,12 @@ if not context then end +interfaces.implement { + name = "asciimath", -- module_asciimath_convert + actions = convert, + arguments = "string" +} + local ctx_typebuffer = context.typebuffer local ctx_mathematics = context.mathematics local ctx_color = context.color diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 2e0518be1..0c3cb5d78 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 : 04/10/15 09:29:23 +-- merge date : 04/10/15 15:19:00 do -- begin closure to overcome local limits and interference @@ -666,7 +666,6 @@ local function make(t) local function making(t) local p=p_false local keys=sortedkeys(t) - local okay=t[""] for i=1,#keys do local k=keys[i] if k~="" then @@ -674,13 +673,14 @@ local function make(t) if v==true then p=p+P(k)*p_true elseif v==false then - elseif okay then - p=p+P(k)*(making(v)+p_true) else p=p+P(k)*making(v) end end end + if t[""] then + p=p+p_true + end return p end local p=p_false @@ -692,8 +692,6 @@ local function make(t) if v==true then p=p+P(k)*p_true elseif v==false then - elseif v[""] then - p=p+P(k)*(making(v)+p_true) else p=p+P(k)*making(v) end |