diff options
22 files changed, 646 insertions, 206 deletions
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index c1d345ef2..b7790d42a 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -2843,7 +2843,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-file"] = package.loaded["l-file"] or true --- original size: 17682, stripped down to: 9745 +-- original size: 17777, stripped down to: 9653 if not modules then modules={} end modules ['l-file']={ version=1.001, @@ -3211,16 +3211,10 @@ function file.strip(name,dir) end end function lfs.mkdirs(path) - local full - for sub in gmatch(path,"([^\\/]+)") do - if full then - full=full.."/"..sub - else - full=sub - end - if not lfs.isdir(full) then - lfs.mkdir(full) - end + local full="" + for sub in gmatch(path,"(/*[^\\/]+)") do + full=full..sub + lfs.mkdir(full) end end @@ -5549,7 +5543,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-prs"] = package.loaded["util-prs"] or true --- original size: 17754, stripped down to: 12749 +-- original size: 17827, stripped down to: 12722 if not modules then modules={} end modules ['util-prs']={ version=1.001, @@ -5842,8 +5836,7 @@ local escape=P('\\') local separator=S(' ,') local key=C((1-equal)^1) local value=dquote*C((1-dquote-escape*dquote)^0)*dquote -local pattern=Cf(Ct("")*Cg(key*equal*value)*separator^0,rawset)^0*P(-1) -patterns.keq_to_hash_c=pattern +local pattern=Cf(Ct("")*(Cg(key*equal*value)*separator^0)^1,rawset)^0*P(-1) function parsers.keq_to_hash(str) if str and str~="" then return lpegmatch(pattern,str) @@ -16103,8 +16096,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 670044 --- stripped bytes : 244968 +-- original bytes : 670212 +-- stripped bytes : 245255 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index c1d345ef2..b7790d42a 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -2843,7 +2843,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-file"] = package.loaded["l-file"] or true --- original size: 17682, stripped down to: 9745 +-- original size: 17777, stripped down to: 9653 if not modules then modules={} end modules ['l-file']={ version=1.001, @@ -3211,16 +3211,10 @@ function file.strip(name,dir) end end function lfs.mkdirs(path) - local full - for sub in gmatch(path,"([^\\/]+)") do - if full then - full=full.."/"..sub - else - full=sub - end - if not lfs.isdir(full) then - lfs.mkdir(full) - end + local full="" + for sub in gmatch(path,"(/*[^\\/]+)") do + full=full..sub + lfs.mkdir(full) end end @@ -5549,7 +5543,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-prs"] = package.loaded["util-prs"] or true --- original size: 17754, stripped down to: 12749 +-- original size: 17827, stripped down to: 12722 if not modules then modules={} end modules ['util-prs']={ version=1.001, @@ -5842,8 +5836,7 @@ local escape=P('\\') local separator=S(' ,') local key=C((1-equal)^1) local value=dquote*C((1-dquote-escape*dquote)^0)*dquote -local pattern=Cf(Ct("")*Cg(key*equal*value)*separator^0,rawset)^0*P(-1) -patterns.keq_to_hash_c=pattern +local pattern=Cf(Ct("")*(Cg(key*equal*value)*separator^0)^1,rawset)^0*P(-1) function parsers.keq_to_hash(str) if str and str~="" then return lpegmatch(pattern,str) @@ -16103,8 +16096,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 670044 --- stripped bytes : 244968 +-- original bytes : 670212 +-- stripped bytes : 245255 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index c1d345ef2..b7790d42a 100755 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -2843,7 +2843,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-file"] = package.loaded["l-file"] or true --- original size: 17682, stripped down to: 9745 +-- original size: 17777, stripped down to: 9653 if not modules then modules={} end modules ['l-file']={ version=1.001, @@ -3211,16 +3211,10 @@ function file.strip(name,dir) end end function lfs.mkdirs(path) - local full - for sub in gmatch(path,"([^\\/]+)") do - if full then - full=full.."/"..sub - else - full=sub - end - if not lfs.isdir(full) then - lfs.mkdir(full) - end + local full="" + for sub in gmatch(path,"(/*[^\\/]+)") do + full=full..sub + lfs.mkdir(full) end end @@ -5549,7 +5543,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-prs"] = package.loaded["util-prs"] or true --- original size: 17754, stripped down to: 12749 +-- original size: 17827, stripped down to: 12722 if not modules then modules={} end modules ['util-prs']={ version=1.001, @@ -5842,8 +5836,7 @@ local escape=P('\\') local separator=S(' ,') local key=C((1-equal)^1) local value=dquote*C((1-dquote-escape*dquote)^0)*dquote -local pattern=Cf(Ct("")*Cg(key*equal*value)*separator^0,rawset)^0*P(-1) -patterns.keq_to_hash_c=pattern +local pattern=Cf(Ct("")*(Cg(key*equal*value)*separator^0)^1,rawset)^0*P(-1) function parsers.keq_to_hash(str) if str and str~="" then return lpegmatch(pattern,str) @@ -16103,8 +16096,8 @@ end -- of closure -- used libraries : l-lua.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 670044 --- stripped bytes : 244968 +-- original bytes : 670212 +-- stripped bytes : 245255 -- end library merge diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index ca982e6c5..fe5841a5b 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{2013.05.21 16:14} +\newcontextversion{2013.05.22 19:28} %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 37755f842..b98c66f90 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 34f457df9..c81f9ab55 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -25,7 +25,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2013.05.21 16:14} +\edef\contextversion{2013.05.22 19:28} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/l-file.lua b/tex/context/base/l-file.lua index deaaca735..a64ee8656 100644 --- a/tex/context/base/l-file.lua +++ b/tex/context/base/l-file.lua @@ -585,18 +585,15 @@ end -- end -- end --- a goodie: a dumb version of mkdirs: +-- a goodie: a dumb version of mkdirs (not used in context itself, only +-- in generic usage) function lfs.mkdirs(path) - local full - for sub in gmatch(path,"([^\\/]+)") do - if full then - full = full .. "/" .. sub - else - full = sub - end - if not lfs.isdir(full) then - lfs.mkdir(full) - end + local full = "" + for sub in gmatch(path,"(/*[^\\/]+)") do -- accepts leading c: and / + full = full .. sub + -- lfs.isdir("/foo") mistakenly returns true on windows so + -- so we don't test and just make as that one is not too picky + lfs.mkdir(full) end end diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv index c19e24365..81ec339d6 100644 --- a/tex/context/base/math-ini.mkiv +++ b/tex/context/base/math-ini.mkiv @@ -614,7 +614,7 @@ ^\bgroup \expandafter\math_prime_indeed_virtual % virtual mess (using funny signal) \else -% \expandafter\math_prime_indeed_normal % gets collapsed + % \expandafter\math_prime_indeed_normal % gets collapsed \expandafter\math_prime_indeed_crapped % gets collapsed \fi} diff --git a/tex/context/base/meta-pdf.lua b/tex/context/base/meta-pdf.lua index 32e48902a..e51290e42 100644 --- a/tex/context/base/meta-pdf.lua +++ b/tex/context/base/meta-pdf.lua @@ -162,19 +162,19 @@ function mps.rlineto(x,y) dx = msp[1] dy = msp[2] end - m_stack_path[topofstack+1] = {dx,dy,"l"} + m_stack_path[topofstack+1] = { dx, dy, "l" } end function mps.translate(tx,ty) - mpscode(f_translate(tx,ty) + mpscode(f_translate(tx,ty)) end function mps.scale(sx,sy) - m_stack_concat = {sx,0,0,sy,0,0} + m_stack_concat = { sx, 0, 0, sy, 0, 0 } end function mps.concat(sx, rx, ry, sy, tx, ty) - m_stack_concat = {sx,rx,ry,sy,tx,ty} + m_stack_concat = { sx, rx, ry, sy, tx, ty } end function mps.setlinejoin(d) diff --git a/tex/context/base/phys-dim.mkiv b/tex/context/base/phys-dim.mkiv index fe0f3f3b9..3de6b2344 100644 --- a/tex/context/base/phys-dim.mkiv +++ b/tex/context/base/phys-dim.mkiv @@ -159,6 +159,21 @@ \expandafter\high \fi} +% we could use a symbolset but how many symbols are there ? + +% \definesymbol[units][times][\times] +% \definesymbol[units][times][\cdots] + +% \def\digitstimessymbol{\symbol[units][times]} + +% \definesymbol[units][times][\times] +% \definesymbol[units][times][\cdots] +% \definesymbol[units][times][\ifmmode\cdot\else\kern.2\emwidth\cdot\kern.2\emwidth\fi] + +\def\digitstimessymbol{\times} +% \def\digitstimessymbol{\cdot} +% \def\digitstimessymbol{\ifmmode\cdot\else\kern.2\emwidth\cdot\kern.2\emwidth\fi} + \unexpanded\def\digitszeropadding {\hphantom{0}} \unexpanded\def\digitsnegative {\phys_digits_normalized{0}{\phys_digits_raised{\textminus}}} \unexpanded\def\digitspositive {\phys_digits_normalized{0}{\phys_digits_raised{\textplus}}} @@ -170,9 +185,9 @@ \unexpanded\def\digitsseparatorspace{\hphantom{.}} \unexpanded\def\digitssignspace {\hphantom{\digitsminus}} \unexpanded\def\digitshighspace {\hphantom{\digitspositive}} -\unexpanded\def\digitspower #1{\times10\phys_digits_raised{#1}} -\unexpanded\def\digitspowerplus #1{\times10\phys_digits_raised{\digitsplus#1}} -\unexpanded\def\digitspowerminus #1{\times10\phys_digits_raised{\digitsminus#1}} +\unexpanded\def\digitspower #1{\digitstimessymbol10\phys_digits_raised{#1}} +\unexpanded\def\digitspowerplus #1{\digitstimessymbol10\phys_digits_raised{\digitsplus#1}} +\unexpanded\def\digitspowerminus #1{\digitstimessymbol10\phys_digits_raised{\digitsminus#1}} \unexpanded\def\digitsdigit #1{#1} \unexpanded\def\normaldigitscommasymbol {,} diff --git a/tex/context/base/s-math-characters.lua b/tex/context/base/s-math-characters.lua new file mode 100644 index 000000000..b0a79fcb6 --- /dev/null +++ b/tex/context/base/s-math-characters.lua @@ -0,0 +1,206 @@ +if not modules then modules = { } end modules['s-math-characters'] = { + version = 1.001, + comment = "companion to s-math-characters.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- This is one of the oldest cld files but I'm not going to clean it up. + +moduledata.math = moduledata.math or { } +moduledata.math.characters = moduledata.math.characters or { } + +local concat = table.concat +local lower = string.lower +local utfchar = utf.char +local round = math.round + +local fontdata = fonts.hashes.identifiers +local chardata = characters.data + +local no_description = "no description, private to font" + +local limited = true +local fillinthegaps = true +local upperlimit = 0x0007F +local upperlimit = 0xF0000 + +local f_unicode = string.formatters["%U"] +local f_slot = string.formatters["%s/%0X"] + +function moduledata.math.characters.showlist(specification) + specification = interfaces.checkedspecification(specification) + local id = specification.number -- or specification.id + local list = specification.list + if not id then + id = font.current() + end + if list == "" then + list = nil + end + local tfmdata = fontdata[id] + local characters = tfmdata.characters + local descriptions = tfmdata.descriptions + local resources = tfmdata.resources + local lookuptypes = resources.lookuptypes + local virtual = tfmdata.properties.virtualized + local names = { } + local gaps = mathematics.gaps + local sorted = { } + if type(list) == "string" then + sorted = utilities.parsers.settings_to_array(list) + elseif type(list) == "table" then + sorted = list + elseif fillinthegaps then + sorted = table.keys(characters) + for k, v in next, gaps do + if characters[v] then + sorted[#sorted+1] = k + end + end + table.sort(sorted) + else + sorted = table.sortedkeys(characters) + end + if virtual then + for k, v in ipairs(tfmdata.fonts) do + local id = v.id + local name = fontdata[id].properties.name + names[k] = (name and file.basename(name)) or id + end + end + context.showmathcharactersstart() + for _, unicode in next, sorted do + if not limited or unicode < upperlimit then + local code = gaps[unicode] or unicode + local char = characters[code] + local desc = descriptions[code] + local info = chardata[code] + if char then + local next_sizes = char.next + local v_variants = char.vert_variants + local h_variants = char.horiz_variants + local commands = char.commands + local slookups = desc and desc.slookups + local mlookups = desc and desc.mlookups + local mathclass = info.mathclass + local mathspec = info.mathspec + local mathsymbol = info.mathsymbol + local description = info.description or no_description + context.showmathcharactersstartentry() + context.showmathcharactersreference(f_unicode(unicode)) + context.showmathcharactersentryhexdectit(f_unicode(code),code,lower(description)) + context.showmathcharactersentrywdhtdpic(round(char.width or 0),round(char.height or 0),round(char.depth or 0),round(char.italic or 0)) + if virtual and commands then + local t = { } + for i=1,#commands do + local ci = commands[i] + if ci[1] == "slot" then + local fnt, idx = ci[2], ci[3] + t[#t+1] = f_slot(names[fnt] or fnt,idx) + end + end + if #t > 0 then + context.showmathcharactersentryresource(concat(t,", ")) + end + end + if mathclass or mathspec then + context.showmathcharactersstartentryclassspec() + if mathclass then + context.showmathcharactersentryclassname(mathclass,info.mathname or "no name") + end + if mathspec then + for i=1,#mathspec do + local mi = mathspec[i] + context.showmathcharactersentryclassname(mi.class,mi.name or "no name") + end + end + context.showmathcharactersstopentryclassspec() + end + if mathsymbol then + context.showmathcharactersentrysymbol(f_unicode(mathsymbol),mathsymbol) + end + if next_sizes then + local n, done = 0, { } + context.showmathcharactersstartnext() + while next_sizes do + n = n + 1 + if done[next_sizes] then + context.showmathcharactersnextcycle(n) + break + else + done[next_sizes] = true + context.showmathcharactersnextentry(n,f_unicode(next_sizes),next_sizes) + next_sizes = characters[next_sizes] + v_variants = next_sizes.vert_variants or v_variants + h_variants = next_sizes.horiz_variants or h_variants + if next_sizes then + next_sizes = next_sizes.next + end + end + end + context.showmathcharactersstopnext() + if h_variants or v_variants then + context.showmathcharactersbetweennextandvariants() + end + end + if h_variants then + context.showmathcharactersstarthvariants() + for i=1,#h_variants do -- we might go top-down in the original + local vi = h_variants[i] + context.showmathcharactershvariantsentry(i,f_unicode(vi.glyph),vi.glyph) + end + context.showmathcharactersstophvariants() + elseif v_variants then + context.showmathcharactersstartvvariants() + for i=1,#v_variants do + local vi = v_variants[#v_variants-i+1] + context.showmathcharactersvvariantsentry(i,f_unicode(vi.glyph),vi.glyph) + end + context.showmathcharactersstopvvariants() + end + if slookups or mlookups then + local variants = { } + if slookups then + for lookupname, lookupdata in next, slookups do + local lookuptype = lookuptypes[lookupname] + if lookuptype == "substitution" then + variants[lookupdata] = "sub" + elseif lookuptype == "alternate" then + for i=1,#lookupdata do + variants[lookupdata[i]] = "alt" + end + end + end + end + if mlookups then + for lookupname, lookuplist in next, mlookups do + local lookuptype = lookuptypes[lookupname] + for i=1,#lookuplist do + local lookupdata = lookuplist[i] + local lookuptype = lookuptypes[lookupname] + if lookuptype == "substitution" then + variants[lookupdata] = "sub" + elseif lookuptype == "alternate" then + for i=1,#lookupdata do + variants[lookupdata[i]] = "alt" + end + end + end + end + end + context.showmathcharactersstartlookupvariants() + local i = 0 + for variant, lookuptype in table.sortedpairs(variants) do + i = i + 1 + context.showmathcharacterslookupvariant(i,f_unicode(variant),variant,lookuptype) + end + context.showmathcharactersstoplookupvariants() + end + context.showmathcharactersstopentry() + end + end + end + context.showmathcharactersstop() +end diff --git a/tex/context/base/s-math-characters.mkiv b/tex/context/base/s-math-characters.mkiv new file mode 100644 index 000000000..1c4159544 --- /dev/null +++ b/tex/context/base/s-math-characters.mkiv @@ -0,0 +1,184 @@ +%D \module +%D [ file=s-math-characters.mkiv, % was: s-fnt-25 and later s-mat-10 +%D version=2009.01.25, +%D title=\CONTEXT\ Style File, +%D subtitle=Math Glyph Checking, +%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. + +\startmodule[math-characters] + +\registerctxluafile{s-math-characters}{} + +% context --jit --global --bodyfont=cambria --result=math-characters-cambria s-math-characters.mkiv +% context --jit --global --bodyfont=modern --result=math-characters-modern s-math-characters.mkiv + +\startsetups s-math-characters:reset + + \let\showmathcharactersstart \relax + \let\showmathcharactersstop \relax + \let\showmathcharactersreference \gobbleoneargument + \let\showmathcharactersstartentry \relax + \let\showmathcharactersstopentry \relax + \let\showmathcharactersentryhexdectit \gobblethreearguments + \let\showmathcharactersentrywdhtdpic \gobblefourarguments + \let\showmathcharactersentryresource \gobbleoneargument + \let\showmathcharactersstartnext \relax + \let\showmathcharactersnextentry \gobblethreearguments + \let\showmathcharactersnextcycle \gobbleonearguments + \let\showmathcharactersstopnext \relax + \let\showmathcharactersstarthvariants \relax + \let\showmathcharactershvariantsentry \gobblethreearguments + \let\showmathcharactersstophvariants \relax + \let\showmathcharactersstartvvariants \showmathcharactersstarthvariants + \let\showmathcharactersvvariantsentry \showmathcharactershvariantsentry + \let\showmathcharactersstopvvariants \showmathcharactersstophvariants + \let\showmathcharactersbetweennextandvariants\relax + \let\showmathcharactersstartentryclassspec \relax + \let\showmathcharactersstopentryclassspec \relax + \let\showmathcharactersentryclassname \gobbletwoarguments + \let\showmathcharactersentrysymbol \gobbletwoarguments + \let\showmathcharactersstartlookupvariants \relax + \let\showmathcharacterslookupvariant \gobblefourarguments + \let\showmathcharactersstoplookupvariants \relax + +\stopsetups + +\directsetup{s-math-characters:reset} + +\startsetups s-math-characters:default + + \directsetup{s-math-characters:reset} + + \unexpanded\def\showmathcharactersstartentry {\blank\begingroup\raggedright} + \unexpanded\def\showmathcharactersstopentry {\endgroup\blank} + + \def\showmathcharactersentryhexdectit##1##2##3% + {##1:\space{\char##2}\space\ruledhbox{\char##2}\space##3\par + \advance\leftskip\emwidth\relax} + + \def\showmathcharactersentrywdhtdpic##1##2##3##4% + {width:\space##1,\space height:\space##2,\space depth:\space##3,\space italic:\space##4\par} + + \def\showmathcharactersentryresource##1% + {virtual:\space##1\par} + + \def\showmathcharactersstartnext + {\par\begingroup\hangindent\emwidth\hangafter-\plushundred\hskip-\emwidth + next:\space} + + \def\showmathcharactersnextentry##1##2##3% + {\ifnum##1>\plusone \space=>\space\fi##2~\ruledhbox{\char##3}} + + \def\showmathcharactersnextcycle##1% + {\ifnum##1>\plusone \space=>\space\fi cycle} + + \def\showmathcharactersstopnext + {\par\endgroup} + + \def\showmathcharactersstarthvariants + {\par\begingroup\hangindent\emwidth\hangafter-\plushundred\hskip-\emwidth + variants:\space} + + \def\showmathcharactershvariantsentry##1##2##3% + {\ifnum##1>\plusone \space=>\space\fi##2~\ruledhbox{\char##3}} + + \def\showmathcharactersstophvariants + {\par\endgroup} + + \let\showmathcharactersstartvvariants\showmathcharactersstarthvariants + \let\showmathcharactersvvariantsentry\showmathcharactershvariantsentry + \let\showmathcharactersstopvvariants \showmathcharactersstophvariants + + \def\showmathcharactersbetweennextandvariants + {}% \space=>\space} + + \def\showmathcharactersentryclassname##1##2% + {mathclass:\space##1,\space mathname:\space##2\par} + + \def\showmathcharactersentrysymbol##1##2% + {mathsymbol:\space##1~\ruledhbox{\char##2}\par} + + \def\showmathcharactersstartlookupvariants + {\par\begingroup\hangindent\emwidth\hangafter-\plushundred\hskip-\emwidth + lookupvariants:\space} + + \def\showmathcharacterslookupvariant##1##2##3##4% + {\ifnum##1>\plusone,\space\fi##2:~{\char##3}\space(##4)} + + \def\showmathcharactersstoplookupvariants + {\par\endgroup} + +\stopsetups + +\unprotect + +\unexpanded\def\enableshowmathfontvirtual + {\ctxlua{fonts.constructors.autocleanup=false}} + +\unexpanded\def\showmathfontcharacters + {\dosingleempty\module_math_characters_show} + +\def\module_math_characters_show[#1]% + {\begingroup + \getdummyparameters[\c!bodyfont=,\c!list=,\c!alternative=default,#1]% + \directsetup{s-math-characters:\dummyparameter\c!alternative}% + \doifelsenothing{\dummyparameter\c!bodyfont} + {\definedfont[MathRoman*math-text]} + {\definedfont[\dummyparameter\c!bodyfont]}% + \dontcomplain + \ctxlua{moduledata.math.characters.showlist { + number = false, + list = "\dummyparameter\c!list", + }}% + \endgroup} + +\protect + +\stopmodule + +\continueifinputfile{s-math-characters.mkiv} + +\setuplayout + [width=middle, + height=middle, + topspace=15mm, + backspace=15mm, + bottomspace=15mm, + header=1cm, + headerdistance=0.5cm, + footer=0pt] + +\starttext + + \doifelse {\getdocumentargument{bodyfont}} {} { + + \setupbodyfont[cambria, 12pt] + % \setupbodyfont[modern, 12pt] + % \setupbodyfont[lmvirtual, 12pt] + % \setupbodyfont[pxvirtual, 12pt] + % \setupbodyfont[txvirtual, 12pt] + % \setupbodyfont[palatino, 10pt] + % \setupbodyfont[mathtimes, 12pt] + % \setupbodyfont[stix, 12pt] + % \setupbodyfont[xits, 12pt] + % \setupbodyfont[lucida, 12pt] + % \setupbodyfont[lucidanova,12pt] + % \setupbodyfont[pagella, 12pt] + % \setupbodyfont[bonum, 12pt] + + } { + + \normalexpanded{\setupbodyfont[\getdocumentargument{bodyfont},12pt]} + + } + + \showmathfontcharacters + +\stoptext + diff --git a/tex/context/base/s-pages-statistics.mkiv b/tex/context/base/s-pages-statistics.mkiv new file mode 100644 index 000000000..375dd9949 --- /dev/null +++ b/tex/context/base/s-pages-statistics.mkiv @@ -0,0 +1,134 @@ +%D \module +%D [ file=s-pages-statistics, % s-otr-01, +%D version=2012.02.02, +%D title=\CONTEXT\ Style File, +%D subtitle=Page Statistics, +%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. + +\unprotect + +\defineframed + [otrstatistics] + [\c!offset=\bodyfontsize, + \c!background=\v!color, + \c!strut=\v!no, + \c!backgroundcolor=white, + \c!frame=\v!off, + \c!align=\v!middle] + +\definecombination + [otrstatistics] + [\c!nx=2, + \c!ny=2, + \c!location=\v!top] + +% expansion is neeed because tabulate sets some penalties + +\startsetups system:page:otr:statistics + \normalexpanded { + \startcombination[otrstatistics] { + \otrstatistics { + \starttabulate[|Tw(10em)|Trw(8em)|] + \NC \string\textwidth \NC \the\textwidth \NC \NR + \NC \string\textheight \NC \the\textheight \NC \NR + \NC \string\lineheight \NC \the\lineheight \NC \NR + \NC \string\strutheight \NC \strutheight \NC \NR + \NC \string\strutdepth \NC \strutdepth \NC \NR + % \NC \string\vsize \NC \the\vsize \NC \NR + \NC \string\topskip \NC \the\topskip \NC \NR + \stoptabulate + } + } {} + { + \otrstatistics { + \starttabulate[|Tw(10em)|Trw(8em)|] + \NC \string\pagegoal \NC \the\pagegoal \NC \NR + \NC \string\pagetotal \NC \the\pagetotal \NC \NR + \NC \string\pagedepth \NC \the\pagedepth \NC \NR + \NC \string\pageshrink \NC \the\pageshrink \NC \NR + \NC \string\pagestretch \NC \the\pagestretch \NC \NR + \NC \string\pagefilstretch \NC \the\pagefilstretch \NC \NR + \NC \string\pagefillstretch \NC \the\pagefillstretch \NC \NR + \NC \string\pagefilllstretch \NC \the\pagefilllstretch \NC \NR + \stoptabulate + } + } {} + { + \otrstatistics { + \starttabulate[|Tw(10em)|Trw(8em)|] + \NC \string\widowpenalty \NC \the\widowpenalty \NC \NR + \NC \string\clubpenalty \NC \the\clubpenalty \NC \NR + \NC \string\displaywidowpenalty \NC \the\displaywidowpenalty \NC \NR + \NC \string\brokenpenalty \NC \the\brokenpenalty \NC \NR + \NC \string\interlinepenalty \NC \the\interlinepenalty \NC \NR + \stoptabulate + } + } {} + { + \otrstatistics[\c!foregroundcolor=darkred] { + \starttabulate[|Tw(10em)|Trw(8em)|] + \NC page \NC \the\realpageno \NC \NR + \NC delta \NC \the\dimexpr\pagegoal-\pagetotal\relax \NC \NR + \stoptabulate + } + } {} + \stopcombination + } +\stopsetups + +\defineoverlay + [system:page:otr:statistics] + [{\framed + [\c!offset=\bodyfontsize, + \c!background=\v!color, + \c!strut=\v!no, + %\c!frame=\v!off, + \c!framecolor=white, + \c!frameoffset=\onepoint, + \c!rulethickness=2\onepoint, + \c!backgroundcolor=darkblue, + \c!align=\v!middle] + {\forgetall + \insidefloattrue + \setups{system:page:otr:statistics}}}] + +\unexpanded\def\page_one_command_package_show_state_indeed + {\scratchheight\ht\b_page_one_contents + \scratchdepth \dp\b_page_one_contents + \setbox\b_page_one_contents\vbox\framed + [\c!offset=\v!overlay, + \c!framecolor=darkred, + \c!rulethickness=\onepoint, + \c!background={\v!foreground,system:page:otr:statistics}] + {\lower\scratchdepth\box\b_page_one_contents}% + \ht\b_page_one_contents\scratchheight + \dp\b_page_one_contents\scratchdepth} + +\let\page_one_command_package_show_state\relax + +\unexpanded\def\showpageproperties + {\let\page_one_command_package_show_state\page_one_command_package_show_state_indeed} + +\protect + +\continueifinputfile{s-pages-statistics.mkiv} + +\setupbodyfont[dejavu,11pt] \dontcomplain \showpageproperties + +\starttext + +\dorecurse {100} { \input tufte + + \startitemize[packed,intro] + \startitem test \stopitem \startitem test \stopitem + \startitem test \stopitem \startitem test \stopitem + \stopitemize +} + +\stoptext diff --git a/tex/context/base/s-phy-01.mkiv b/tex/context/base/s-phy-01.mkiv deleted file mode 100644 index dde3f9bbb..000000000 --- a/tex/context/base/s-phy-01.mkiv +++ /dev/null @@ -1,111 +0,0 @@ -%D \module -%D [ file=s-phy-01, -%D version=2011-11-24, -%D title=\CONTEXT\ Modules, -%D subtitle=Units Tables, -%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. - -\unprotect - -% todo: better breaks of head line - -\startluacode -moduledata.units = moduledata.units or { } - -local tables = physics.units.tables -local units = tables.units -local shortcuts = tables.shortcuts - -local HL = context.HL -local NC = context.NC -local NR = context.NR - -local function typeset(list,followup,name,category) - if list then - if followup then - context.TB() - end - if category then - HL() - NC() - context.rlap(category .. ":" .. name) - NC() - NC() - NR() - HL() - end - for k, v in table.sortedhash(list) do - NC() - context(k) - NC() - if isunit then - context(v) - else - context.type(v) - end - NC() - if name == "units" or name == "symbols" or name == "packaged" then - context.unittext(v) - elseif name == "prefixes" then - context.prefixtext(v) - elseif name == "operators" then - context.operatortext(v) - elseif name == "suffixes" then - context.suffixtext(v) - end - NC() - NR() - end - if category and name then - HL() - end - end -end - -function moduledata.units.show_table(name) - context.starttabulate { "|lT|l|c|" } - if name and name ~= "" then - local first, second = string.match(name,"(.-):(.-)") -- [units|shortcuts]:[units|...] - if first then - typeset(tables[first] and tables[first][second],false) - else - typeset(units[name],false) - typeset(shortcuts[name],true) - end - else - local done = false - for what, list in table.sortedhash(units) do - typeset(list,done,what,"units") - done = true - end - for what, list in table.sortedhash(shortcuts) do - typeset(list,done,what,"shortcuts") - done = true - end - end - context.stoptabulate() -end - -\stopluacode - -\unexpanded\def\ShowUnitsTable - {\dosingleempty\Show_Units_Table} - -\def\Show_Units_Table[#1]% - {\ctxlua{moduledata.units.show_table("#1")}} - -\protect - -\continueifinputfile{s-phy-01.mkiv} - -\usemodule[art-01] - -\starttext - \ShowUnitsTable -\stoptext diff --git a/tex/context/base/s-physics-units.mkiv b/tex/context/base/s-physics-units.mkiv new file mode 100644 index 000000000..50adc8014 --- /dev/null +++ b/tex/context/base/s-physics-units.mkiv @@ -0,0 +1,30 @@ +%D \module +%D [ file=s-physics-units, % s-phy-01, +%D version=2011-11-24, +%D title=\CONTEXT\ Modules, +%D subtitle=Physics Units, +%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. + +\startmodule[physics-units] + +\registerctxluafile{s-physics-units}{} + +\installmodulecommandluasingle \showunits {moduledata.physics.units.showlist} + +\stopmodule + +\continueifinputfile{s-physics-units.mkiv} + +\usemodule[art-01] + +\starttext + + \showunits + +\stoptext diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 52886b14d..5b6cf07f9 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 165f0a0cc..c2ee1ee3e 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/status-mkiv.lua b/tex/context/base/status-mkiv.lua index efd84f854..c763583ff 100644 --- a/tex/context/base/status-mkiv.lua +++ b/tex/context/base/status-mkiv.lua @@ -4352,6 +4352,11 @@ return { }, { category = "lua", + filename = "s-physics-units", + status = "okay", + }, + { + category = "lua", filename = "s-pre-71", status = "todo", }, @@ -5506,8 +5511,13 @@ return { }, { category = "mkiv", - filename = "s-phy-01", - status = "todo", + filename = "s-pages-statistics", + status = "okay", + }, + { + category = "mkiv", + filename = "s-physics-units", + status = "okay", }, { category = "tex", diff --git a/tex/context/base/supp-box.mkiv b/tex/context/base/supp-box.mkiv index 25c7764f8..833096222 100644 --- a/tex/context/base/supp-box.mkiv +++ b/tex/context/base/supp-box.mkiv @@ -271,15 +271,17 @@ \box\nextbox \endgroup} -\def\syst_boxes_s_w{\wd\nextbox\zeropoint} -\def\syst_boxes_s_h{\ht\nextbox\zeropoint} -\def\syst_boxes_s_d{\dp\nextbox\zeropoint} -\def\syst_boxes_s_t{\ht\nextbox\zeropoint} -\def\syst_boxes_s_b{\dp\nextbox\zeropoint} +\installcorenamespace {smashoptions} + +\setvalue{\??smashoptions w}{\wd\nextbox\zeropoint} +\setvalue{\??smashoptions h}{\ht\nextbox\zeropoint} +\setvalue{\??smashoptions d}{\dp\nextbox\zeropoint} +\setvalue{\??smashoptions t}{\ht\nextbox\zeropoint} +\setvalue{\??smashoptions b}{\dp\nextbox\zeropoint} \def\syst_boxes_smash_process_option#1% {\ifx#1\relax\else - \csname boxes_s_#1\endcsname + \ifcsname\??smashoptions#1\endcsname\csname\??smashoptions#1\endcsname\fi \expandafter\syst_boxes_smash_process_option \fi} diff --git a/tex/context/base/util-prs.lua b/tex/context/base/util-prs.lua index cdf497588..9d2ffcc3e 100644 --- a/tex/context/base/util-prs.lua +++ b/tex/context/base/util-prs.lua @@ -372,9 +372,8 @@ local separator = S(' ,') local key = C((1-equal)^1) local value = dquote * C((1-dquote-escape*dquote)^0) * dquote -local pattern = Cf(Ct("") * Cg(key * equal * value) * separator^0,rawset)^0 * P(-1) - -patterns.keq_to_hash_c = pattern +----- pattern = Cf(Ct("") * Cg(key * equal * value) * separator^0,rawset)^0 * P(-1) -- was wrong +local pattern = Cf(Ct("") * (Cg(key * equal * value) * separator^0)^1,rawset)^0 * P(-1) function parsers.keq_to_hash(str) if str and str ~= "" then @@ -384,7 +383,7 @@ function parsers.keq_to_hash(str) end end --- inspect(lpeg.match(pattern,[[key="value"]])) +-- inspect(lpeg.match(pattern,[[key="value" foo="bar"]])) local defaultspecification = { separator = ",", quote = '"' } @@ -392,7 +391,7 @@ local defaultspecification = { separator = ",", quote = '"' } -- database module function parsers.csvsplitter(specification) - specification = specification and table.setmetatableindex(specification,defaultspecification) or defaultspecification + specification = specification and table.setmetatableindex(specification,defaultspecification) or defaultspecification local separator = specification.separator local quotechar = specification.quote local separator = S(separator ~= "" and separator or ",") @@ -419,14 +418,14 @@ end -- and this is a slightly patched version of a version posted by Philipp Gesang -- local mycsvsplitter = utilities.parsers.rfc4180splitter() --- + -- local crap = [[ -- first,second,third,fourth -- "1","2","3","4" -- "a","b","c","d" -- "foo","bar""baz","boogie","xyzzy" -- ]] --- + -- local list, names = mycsvsplitter(crap,true) inspect(list) inspect(names) -- local list, names = mycsvsplitter(crap) inspect(list) inspect(names) diff --git a/tex/context/base/util-sql-imp-swiglib.lua b/tex/context/base/util-sql-imp-swiglib.lua index 719620a6f..758c81746 100644 --- a/tex/context/base/util-sql-imp-swiglib.lua +++ b/tex/context/base/util-sql-imp-swiglib.lua @@ -23,6 +23,7 @@ local report_state = logs.reporter("sql","swiglib") local sql = utilities.sql local mysql = require("swiglib.mysql.core") -- "5.6" +----- mysql = swiglib("mysql.core") -- "5.6" -- inspect(table.sortedkeys(mysql)) diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 310febe96..5789db6c8 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 : 05/21/13 16:14:48 +-- merge date : 05/22/13 19:28:51 do -- begin closure to overcome local limits and interference @@ -2310,16 +2310,10 @@ function file.strip(name,dir) end end function lfs.mkdirs(path) - local full - for sub in gmatch(path,"([^\\/]+)") do - if full then - full=full.."/"..sub - else - full=sub - end - if not lfs.isdir(full) then - lfs.mkdir(full) - end + local full="" + for sub in gmatch(path,"(/*[^\\/]+)") do + full=full..sub + lfs.mkdir(full) end end |