From 6580c0d6985f98e634f2081b00576a15201c536b Mon Sep 17 00:00:00 2001 From: Marius Date: Thu, 28 Mar 2013 10:40:16 +0200 Subject: beta 2013.03.28 09:26 --- metapost/context/base/mp-chem.mpiv | 13 +++++-- metapost/context/base/mp-page.mpiv | 2 +- scripts/context/lua/mtxrun.lua | 10 +++--- scripts/context/stubs/mswin/mtxrun.lua | 10 +++--- scripts/context/stubs/unix/mtxrun | 10 +++--- tex/context/base/buff-ini.lua | 2 ++ tex/context/base/char-ini.mkiv | 11 +++--- tex/context/base/chem-str.lua | 30 +++++++++++----- tex/context/base/chem-str.mkiv | 4 +-- tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4136 -> 4137 bytes tex/context/base/context-version.png | Bin 40439 -> 40357 bytes tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 2 +- tex/context/base/font-sty.mkvi | 8 ++--- tex/context/base/l-table.lua | 4 +-- tex/context/base/lang-lab.mkiv | 4 ++- tex/context/base/m-database.lua | 19 +++++++---- tex/context/base/m-database.mkiv | 26 ++++++++------ tex/context/base/math-fen.mkiv | 6 ++-- tex/context/base/mult-dim.mkvi | 2 +- tex/context/base/pack-com.mkiv | 12 +++++-- tex/context/base/phys-dim.lua | 2 ++ tex/context/base/phys-dim.mkiv | 10 ++++++ tex/context/base/spac-chr.mkiv | 38 ++++++++++----------- tex/context/base/status-files.pdf | Bin 24716 -> 24719 bytes tex/context/base/status-lua.pdf | Bin 211628 -> 211539 bytes tex/context/base/strc-con.mkvi | 11 ++++-- tex/context/base/strc-flt.mkvi | 24 +++++++++---- tex/context/base/strc-itm.mkvi | 4 +-- tex/context/base/syst-aux.mkiv | 5 +++ tex/context/base/typo-dir.mkiv | 10 +++--- tex/generic/context/luatex/luatex-fonts-merged.lua | 6 ++-- 34 files changed, 183 insertions(+), 108 deletions(-) diff --git a/metapost/context/base/mp-chem.mpiv b/metapost/context/base/mp-chem.mpiv index 2c9f8f327..4cb4ce78e 100644 --- a/metapost/context/base/mp-chem.mpiv +++ b/metapost/context/base/mp-chem.mpiv @@ -33,7 +33,7 @@ numeric boolean chem_setting_axis, %chem_setting_fitwidth, chem_setting_fitheight, - chem_doing_pb, chem_text_trace, chem_bd_wedge, + chem_doing_pb, chem_text_trace, chem_bd_wedge, chem_tracing, chem_star[], chem_front[], chem_stacked[], chem_tetra[] ; string @@ -81,6 +81,7 @@ chem_sb_pair.b := (0, 1 ) ; %chem_sb_dash.b := dashpattern(on 1) ; chem_text_trace := false ; % debugging chem_bd_wedge := false ; % true is incorrect, but quite common... +chem_tracing := false ; def chem_reset = chem_rotation := 0 ; @@ -342,6 +343,7 @@ vardef chem_stop_structure = endfor currentpicture := (currentpicture shifted -chem_origin) rotated chem_setting_rotation ; + if (not known chem_setting_l) and (not known chem_setting_r) : chem_setting_l := - xpart llcorner currentpicture ; chem_setting_r := xpart urcorner currentpicture ; @@ -371,7 +373,7 @@ vardef chem_stop_structure = chem_setting_bbox := (-chem_setting_l,-chem_setting_b) -- ( chem_setting_r,-chem_setting_b) -- ( chem_setting_r, chem_setting_t) -- (-chem_setting_l, chem_setting_t) -- cycle ; - + if chem_setting_axis : % put it behind the picture chem_pic := currentpicture ; currentpicture := nullpicture ; chem_num0 := .5chem_b_length ; @@ -399,7 +401,14 @@ vardef chem_stop_structure = % frame=on : draw chem_setting_bbox withcolor colorpart(chem_axis_color) ; addto currentpicture also chem_pic ; fi ; + if chem_tracing : + fill boundingbox currentpicture withcolor blue withtransparency(1,.25) ; + fi ; setbounds currentpicture to chem_setting_bbox ; + if chem_tracing : + fill boundingbox currentpicture withcolor red withtransparency(1,.25) ; + fi ; + chem_tracing := false ; enddef ; % \chemical diff --git a/metapost/context/base/mp-page.mpiv b/metapost/context/base/mp-page.mpiv index d263c3617..9c538d42a 100644 --- a/metapost/context/base/mp-page.mpiv +++ b/metapost/context/base/mp-page.mpiv @@ -319,7 +319,7 @@ def SetPageArea = enddef ; def SetPageLocation = - pair Location[] ; + pair Location[][] ; for VerPos=Top step 10 until Bottom: for HorPos=LeftEdge step 1 until RightEdge: Location[HorPos][VerPos] := (Hstep[HorPos],Vstep[VerPos]) ; diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 14112dec1..49c43be78 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -974,7 +974,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-table"] = package.loaded["l-table"] or true --- original size: 44637, stripped down to: 19713 +-- original size: 44643, stripped down to: 19717 if not modules then modules={} end modules ['l-table']={ version=1.001, @@ -1069,8 +1069,8 @@ local function sortedhashkeys(tab,cmp) end function table.allkeys(t) local keys={} - for i=1,#t do - for k,v in next,t[i] do + for k,v in next,t do + for k,v in next,v do keys[k]=true end end @@ -15614,8 +15614,8 @@ end -- of closure -- used libraries : l-lua.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-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 luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 644427 --- stripped bytes : 232540 +-- original bytes : 644433 +-- stripped bytes : 232542 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 14112dec1..49c43be78 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -974,7 +974,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-table"] = package.loaded["l-table"] or true --- original size: 44637, stripped down to: 19713 +-- original size: 44643, stripped down to: 19717 if not modules then modules={} end modules ['l-table']={ version=1.001, @@ -1069,8 +1069,8 @@ local function sortedhashkeys(tab,cmp) end function table.allkeys(t) local keys={} - for i=1,#t do - for k,v in next,t[i] do + for k,v in next,t do + for k,v in next,v do keys[k]=true end end @@ -15614,8 +15614,8 @@ end -- of closure -- used libraries : l-lua.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-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 luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 644427 --- stripped bytes : 232540 +-- original bytes : 644433 +-- stripped bytes : 232542 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 14112dec1..49c43be78 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -974,7 +974,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-table"] = package.loaded["l-table"] or true --- original size: 44637, stripped down to: 19713 +-- original size: 44643, stripped down to: 19717 if not modules then modules={} end modules ['l-table']={ version=1.001, @@ -1069,8 +1069,8 @@ local function sortedhashkeys(tab,cmp) end function table.allkeys(t) local keys={} - for i=1,#t do - for k,v in next,t[i] do + for k,v in next,t do + for k,v in next,v do keys[k]=true end end @@ -15614,8 +15614,8 @@ end -- of closure -- used libraries : l-lua.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-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 luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 644427 --- stripped bytes : 232540 +-- original bytes : 644433 +-- stripped bytes : 232542 -- end library merge diff --git a/tex/context/base/buff-ini.lua b/tex/context/base/buff-ini.lua index f45dd0728..475d23efe 100644 --- a/tex/context/base/buff-ini.lua +++ b/tex/context/base/buff-ini.lua @@ -205,6 +205,8 @@ local continue = false -- return str -- end +-- how about tabs + local getmargin = (Cs(P(" ")^1)*P(-1)+1)^1 local eol = patterns.eol local whatever = (P(1)-eol)^0 * eol^1 diff --git a/tex/context/base/char-ini.mkiv b/tex/context/base/char-ini.mkiv index a93a25f78..0e2b773f0 100644 --- a/tex/context/base/char-ini.mkiv +++ b/tex/context/base/char-ini.mkiv @@ -39,14 +39,11 @@ % {\relax\iffontchar\font#1 \expandafter\firstoftwoarguments\else\expandafter\secondoftwoarguments\fi{\char#1}} % % impossible in math mode so there always fallback (till we have gyre): +% +% use \normalUchar when possible .. the next one is nice for documents and it also accepts +% 0x prefixed numbers -% When this primitive is on everyones system I will inline \Uchar a couple of times. - -\ifdefined\Uchar - \def\utfchar#1{\Uchar\numexpr#1\relax} % make sure that following spaces are kept -\else - \def\utfchar#1{\ctxcommand{utfchar(\number#1)}} -\fi +\def\utfchar#1{\ctxcommand{utfchar(\number#1)}} \def\checkedchar {\relax\ifmmode\expandafter\checkedmathchar\else\expandafter\checkedtextchar\fi} % #1#2 \def\checkedmathchar#1#2{#2} diff --git a/tex/context/base/chem-str.lua b/tex/context/base/chem-str.lua index 577de4c58..9fa5494fd 100644 --- a/tex/context/base/chem-str.lua +++ b/tex/context/base/chem-str.lua @@ -17,7 +17,7 @@ if not modules then modules = { } end modules ['chem-str'] = { -- alternative output. As a consequence it still used a stepwise graphic construction -- approach. As we used \TEX\ for parsing, the syntax was more rigid than it is now. -- This new variant uses a more mathematical and metapostisch approach. In the process --- more rendering variants have been added and alignment has been automated.. As a result +-- more rendering variants have been added and alignment has been automated. As a result -- the current user interface is slightly different from the old one but hopefully users -- will like the added value. @@ -220,14 +220,14 @@ local syntax = { save = { direct = 'chem_save;' }, restore = { direct = 'chem_restore;' }, chem = { direct = formatters['chem_symbol("\\chemicaltext{%s}");'], arguments = 1 }, - space = { direct = formatters['chem_symbol("\\chemicalsymbol[space]");'] }, - plus = { direct = formatters['chem_symbol("\\chemicalsymbol[plus]");'] }, - minus = { direct = formatters['chem_symbol("\\chemicalsymbol[minus]");'] }, + space = { direct = 'chem_symbol("\\chemicalsymbol[space]");' }, + plus = { direct = 'chem_symbol("\\chemicalsymbol[plus]");' }, + minus = { direct = 'chem_symbol("\\chemicalsymbol[minus]");' }, gives = { direct = formatters['chem_symbol("\\chemicalsymbol[gives]{%s}{%s}");'], arguments = 2 }, equilibrium = { direct = formatters['chem_symbol("\\chemicalsymbol[equilibrium]{%s}{%s}");'], arguments = 2 }, mesomeric = { direct = formatters['chem_symbol("\\chemicalsymbol[mesomeric]{%s}{%s}");'], arguments = 2 }, - opencomplex = { direct = formatters['chem_symbol("\\chemicalsymbol[opencomplex]");'] }, - closecomplex = { direct = formatters['chem_symbol("\\chemicalsymbol[closecomplex]");'] }, + opencomplex = { direct = 'chem_symbol("\\chemicalsymbol[opencomplex]");' }, + closecomplex = { direct = 'chem_symbol("\\chemicalsymbol[closecomplex]");' }, reset = { direct = 'chem_reset;' }, mp = { direct = formatters['%s'], arguments = 1 }, -- backdoor MP code - dangerous! } @@ -314,6 +314,7 @@ local pattern = local f_initialize = 'if unknown context_chem : input mp-chem.mpiv ; fi ;' local f_start_structure = formatters['chem_start_structure(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s);'] +local f_set_tracing = formatters['chem_tracing := %l ;'] local f_stop_structure = 'chem_stop_structure;' local f_start_component = 'chem_start_component;' local f_stop_component = 'chem_stop_component;' @@ -604,14 +605,14 @@ end function chemistry.start(settings) chemistry.structures = chemistry.structures + 1 local emwidth, rulethickness, rulecolor, axiscolor = settings.emwidth, settings.rulethickness, settings.rulecolor, settings.framecolor - local width, height, scale, rotation, offset = settings.width or 0, settings.height or 0, settings.scale or "normal", settings.rotation or 0, settings.offset or 0 - local l, r, t, b = settings.left or 0, settings.right or 0, settings.top or 0, settings.bottom or 0 + local width, height, scale, rotation, offset = settings.width or v_fit, settings.height or v_fit, settings.scale or "normal", settings.rotation or 0, settings.offset or 0 + local l, r, t, b = settings.left or v_fit, settings.right or v_fit, settings.top or v_fit, settings.bottom or v_fit -- metacode = { } -- align = settings.symalign or "auto" if trace_structure then - report_chemistry("scale %a, rotation %a, width %a, height %a, l: %a, r: %a, t: %a, b: %a",scale,rotation,width,height,l,r,t,b) + report_chemistry("%s scale %a, rotation %a, width %a, height %a, left %a, right %a, top %a, bottom %a","asked",scale,rotation,width,height,l,r,t,b) report_chemistry("symalign: %s", align) end if align ~= "" then align = "." .. align end @@ -632,6 +633,13 @@ function chemistry.start(settings) end end -- + -- -- shorter: + -- + -- local width = tonumber(width) or v_fit + -- if width ~= v_fit and (width >= 10 or width <= -10) then + -- width = width / 1000 + -- end + -- if width ~= v_fit then if tonumber(width) then width = tonumber(width) @@ -718,12 +726,16 @@ function chemistry.start(settings) -- rotation = tonumber(rotation) or 0 -- + if trace_structure then + report_chemistry("%s scale %a, rotation %a, width %a, height %a, left %a, right %a, top %a, bottom %a","used",scale,rotation,width,height,l,r,t,b) + end metacode[#metacode+1] = f_start_structure( chemistry.structures, l, r, t, b, scale, rotation, tostring(emwidth), tostring(offset), tostring(settings.axis == v_on), tostring(rulethickness), tostring(axiscolor) ) + metacode[#metacode+1] = f_set_tracing(trace_metapost) ; -- variant, keys, stack, pstack, sstack = "one", { }, { }, { }, { } end diff --git a/tex/context/base/chem-str.mkiv b/tex/context/base/chem-str.mkiv index 1c1771df1..a43b756b8 100644 --- a/tex/context/base/chem-str.mkiv +++ b/tex/context/base/chem-str.mkiv @@ -410,9 +410,9 @@ \unexpanded\def\chemicaloxidationseven{\chemicaloxidation\relax7} \unexpanded\def\chemicalbar - {\hbox \!!spread .5\emwidth \bgroup + {\hbox \s!spread .5\emwidth \bgroup \hss - \vrule \!!height .9\strutht \!!depth .65\strutdp \!!width .1\exheight + \vrule \s!height .9\strutht \s!depth .65\strutdp \s!width .1\exheight \hss \egroup} diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 21e24eb48..d582a6905 100644 --- a/tex/context/base/cont-new.mkii +++ b/tex/context/base/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2013.03.27 13:27} +\newcontextversion{2013.03.28 09:26} %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/cont-new.mkiv b/tex/context/base/cont-new.mkiv index c9164086d..d03727ae2 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.03.27 13:27} +\newcontextversion{2013.03.28 09:26} %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 index 6df2bf40c..eab60a3ee 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png index 2ad892536..2793e80f2 100644 Binary files a/tex/context/base/context-version.png and b/tex/context/base/context-version.png differ diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index c8615e23f..1203d3724 100644 --- a/tex/context/base/context.mkii +++ b/tex/context/base/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2013.03.27 13:27} +\edef\contextversion{2013.03.28 09:26} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 104bdd94f..730b358c0 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.03.27 13:27} +\edef\contextversion{2013.03.28 09:26} %D For those who want to use this: diff --git a/tex/context/base/font-sty.mkvi b/tex/context/base/font-sty.mkvi index 732d2b027..3caa94488 100644 --- a/tex/context/base/font-sty.mkvi +++ b/tex/context/base/font-sty.mkvi @@ -380,12 +380,12 @@ %D Variant selectors %D %D \starttyping -%D \mathematics {\vsone{\utfchar{"2229}}} -%D \mathematics {\utfchar{"2229}\vsone{}} +%D \mathematics {\vsone{\utfchar{0x2229}}} +%D \mathematics {\utfchar{0x2229}\vsone{}} %D \stoptyping -\unexpanded\edef\vsone#character{#character\utfchar{"FE00}} % used -\unexpanded\edef\vstwo#character{#character\utfchar{"FE01}} % not used but handy for testing +\unexpanded\edef\vsone#character{#character\normalUchar"FE00 } % used +\unexpanded\edef\vstwo#character{#character\normalUchar"FE01 } % not used but handy for testing %D For historic reasons we keep the following around but they are no longer %D that relevant for \MKIV. diff --git a/tex/context/base/l-table.lua b/tex/context/base/l-table.lua index 830b05b81..640bbbb28 100644 --- a/tex/context/base/l-table.lua +++ b/tex/context/base/l-table.lua @@ -103,8 +103,8 @@ end function table.allkeys(t) local keys = { } - for i=1,#t do - for k, v in next, t[i] do + for k, v in next, t do + for k, v in next, v do keys[k] = true end end diff --git a/tex/context/base/lang-lab.mkiv b/tex/context/base/lang-lab.mkiv index c3c584beb..1ddb44cbb 100644 --- a/tex/context/base/lang-lab.mkiv +++ b/tex/context/base/lang-lab.mkiv @@ -20,7 +20,9 @@ %D Left-overs: -\ifdefined\sixperemspace \else \def\sixperemspace{ } \fi % \utfchar{2006"} % we could embed 0x2006 but it does not show up in a editor +\ifdefined\sixperemspace \else + \def\sixperemspace{\normalUchar"2006} +\fi %D In this module we deal with language dependant labels and %D prefixes, like in {\em Figure~12} and {\em Chapter 1}. In diff --git a/tex/context/base/m-database.lua b/tex/context/base/m-database.lua index caa40f8f6..47854daa0 100644 --- a/tex/context/base/m-database.lua +++ b/tex/context/base/m-database.lua @@ -10,6 +10,7 @@ local sub, gmatch, format = string.sub, string.gmatch, string.format local concat = table.concat local lpegpatterns, lpegmatch, lpegsplitat = lpeg.patterns, lpeg.match, lpeg.splitat local lpegP, lpegC, lpegS, lpegCt = lpeg.P, lpeg.C, lpeg.S, lpeg.Ct +local stripstring = string.strip -- One also needs to enable context.trace, here we only plug in some code (maybe -- some day this tracker will also toggle the main context tracer. @@ -23,6 +24,9 @@ buffers.database = buffers.database or { } local l_tab = lpegpatterns.tab local l_space = lpegpatterns.space local l_comma = lpegpatterns.comma +local l_empty = lpegS("\t\n\r ")^0 * lpegP(-1) + +local v_yes = interfaces.variables.yes local separators = { -- not interfaced tab = l_tab, @@ -50,6 +54,7 @@ function buffers.database.process(settings) local first, last = settings.first or "", settings.last or "" local left, right = settings.left or "", settings.right or "" local setups = settings.setups or "" + local strip = settings.strip == v_yes or false local command = settings.command separatorchar = (not separatorchar and ",") or separators[separatorchar] or separatorchar local separator = type(separatorchar) == "string" and lpegS(separatorchar) or separatorchar @@ -67,12 +72,12 @@ function buffers.database.process(settings) end whatever = quotedata + whatever end - local checker = commentchar ~= "" and lpeg.S(commentchar) + local checker = commentchar ~= "" and lpegS(commentchar) local splitter = lpegCt(whatever * (separator * whatever)^0) local found = false for i=1,#data do local line = data[i] - if line ~= "" and (not checker or not lpegmatch(checker,line)) then + if not lpegmatch(l_empty,line) and (not checker or not lpegmatch(checker,line)) then local list = lpegmatch(splitter,line) if not found then if setups ~= "" then @@ -86,13 +91,14 @@ function buffers.database.process(settings) local result, r = { }, 0 r = r + 1 ; result[r] = first for j=1,#list do + local str = strip and stripstring(list[j]) or list[j] r = r + 1 ; result[r] = left if command == "" then - r = r + 1 ; result[r] = list[j] + r = r + 1 ; result[r] = str else r = r + 1 ; result[r] = command r = r + 1 ; result[r] = "{" - r = r + 1 ; result[r] = list[j] + r = r + 1 ; result[r] = str r = r + 1 ; result[r] = "}" end r = r + 1 ; result[r] = right @@ -102,12 +108,13 @@ function buffers.database.process(settings) else context(first) for j=1,#list do + local str = strip and stripstring(list[j]) or list[j] context(left) if command == "" then - context(list[j]) + context(str) else context(command) - context(false,list[j]) + context(false,str) end context(right) end diff --git a/tex/context/base/m-database.mkiv b/tex/context/base/m-database.mkiv index 01f84482a..0285d3bcd 100644 --- a/tex/context/base/m-database.mkiv +++ b/tex/context/base/m-database.mkiv @@ -31,6 +31,7 @@ [\c!separator={,}, \c!quotechar=, \c!commentchar=, + \c!strip=\v!no, \c!before=, \c!after=, \c!first=, @@ -43,7 +44,7 @@ \setupdatabase [\c!separator={,}] -\def\doprocessdatabase#1#2#3% +\def\module_database_process#1#2#3% {\edef\currentdatabasetype{#1}% \edef\currentdatabase {#2}% \edef\currentdatabasename{#3}% @@ -55,6 +56,7 @@ name = "\currentdatabase", type = "\currentdatabasetype", database = "\currentdatabasename", + strip = "\databaseparameter\c!strip", separator = \!!bs\databaseparameter\c!separator \!!es, quotechar = \!!bs\databaseparameter\c!quotechar \!!es, commentchar = \!!bs\databaseparameter\c!commentchar\!!es, @@ -68,29 +70,31 @@ command = \!!bs\databaseparameter\c!command \!!es, }}} -\unexpanded\def\processdatabasebuffer{\dodoubleempty\doprocessdatabasebuffer} -\unexpanded\def\processdatabasefile {\dodoubleempty\doprocessdatabasefile } +\unexpanded\def\processdatabasebuffer{\dodoubleempty\module_database_process_buffer} +\unexpanded\def\processdatabasefile {\dodoubleempty\module_database_process_file} -\def\doprocessdatabasebuffer[#1][#2]{\doprocessdatabase{buffer}{#1}{#2}} -\def\doprocessdatabasefile [#1][#2]{\doprocessdatabase{file} {#1}{#2}} +\def\module_database_process_buffer[#1][#2]{\module_database_process{buffer}{#1}{#2}} +\def\module_database_process_file [#1][#2]{\module_database_process{file} {#1}{#2}} % for old times sake: -\def\defineseparatedlist {\dodoubleempty\dodefineseparatedlist } -\def\processseparatedfile{\dodoubleempty\doprocessseparatedfile} +\unexpanded\def\defineseparatedlist {\dodoubleempty\module_database_separated_list_define} +\unexpanded\def\processseparatedfile{\dodoubleempty\module_database_separated_list_process} -\def\dodefineseparatedlist[#1][#2]% +\def\module_database_separated_list_define[#1][#2]% {\definedatabase[#1][#2]% \setuvalue{\e!start#1}{\grabbufferdatadirect{#1}{\e!start#1}{\e!stop#1}}% \setuvalue{\e!stop#1}{\processdatabasebuffer[#1][#1]}} -\def\processseparatedfile[#1][#2]% +\def\module_database_separated_list_process[#1][#2]% {\processdatabasefile[#1][#2]} -\def\startseparatedlist[#1]% to be interfaced - {\def\stopseparatedlist{\processdatabasebuffer[#1][#1]}% +\unexpanded\def\startseparatedlist[#1]% to be interfaced + {\unexpanded\def\stopseparatedlist{\processdatabasebuffer[#1][#1]}% \grabbufferdatadirect{#1}{startseparatedlist}{stopseparatedlist}} +\let\setupseparatedlist\setupdatabase + \protect \continueifinputfile{m-database.mkiv} diff --git a/tex/context/base/math-fen.mkiv b/tex/context/base/math-fen.mkiv index de50ace0c..9080ffedf 100644 --- a/tex/context/base/math-fen.mkiv +++ b/tex/context/base/math-fen.mkiv @@ -55,9 +55,9 @@ \fi \to \everydefinemathfence -\def\math_fenced_left {\normalleft \utfchar{\mathfenceparameter\c!left }} -\def\math_fenced_middle{\normalmiddle\utfchar{\mathfenceparameter\c!middle}} -\def\math_fenced_right {\normalright \utfchar{\mathfenceparameter\c!right }} +\def\math_fenced_left {\normalleft \utfchar{\mathfenceparameter\c!left }} % no Uchar here +\def\math_fenced_middle{\normalmiddle\utfchar{\mathfenceparameter\c!middle}} % no Uchar here +\def\math_fenced_right {\normalright \utfchar{\mathfenceparameter\c!right }} % no Uchar here \let\fence \relax \let\fenced\relax diff --git a/tex/context/base/mult-dim.mkvi b/tex/context/base/mult-dim.mkvi index bad7af713..ffc04b523 100644 --- a/tex/context/base/mult-dim.mkvi +++ b/tex/context/base/mult-dim.mkvi @@ -119,7 +119,7 @@ \setbox\b_assign_width\emptybox} \setvalue{\??dimensionwidth\v!broad }#value#dimension#content#extra{\setbox\b_assign_width\hbox{#content}#dimension\dimexpr\wd\b_assign_width+#extra\relax \setbox\b_assign_width\emptybox} -\setvalue{\??dimensionwidth\v!unknown}#value#dimension#content#extra{#dimension=#value\relax} +\setvalue{\??dimensionwidth\s!unknown}#value#dimension#content#extra{#dimension=#value\relax} \unexpanded\def\assignwidth#value% {\csname\??dimensionwidth\ifcsname\??dimensionwidth#value\endcsname#value\else\s!unknown\fi\endcsname{#value}} diff --git a/tex/context/base/pack-com.mkiv b/tex/context/base/pack-com.mkiv index 113ae89ab..d12c0d90a 100644 --- a/tex/context/base/pack-com.mkiv +++ b/tex/context/base/pack-com.mkiv @@ -574,11 +574,19 @@ % \global\setsystemmode{pairedbox}% \pack_pairedboxes_before - \dowithnextboxcs\pack_pairedboxes_first\hbox} + \dogotopar\pack_pairedboxes_first_pickup} + +\def\pack_pairedboxes_first_pickup + {\dowithnextboxcs\pack_pairedboxes_first\hbox + \bgroup + \let\next=} \def\pack_pairedboxes_first {\pack_pairedboxes_between - \dowithnextboxcs\pack_pairedboxes_second\vbox + \dogotopar\pack_pairedboxes_second_pickup} + +\def\pack_pairedboxes_second_pickup + {\dowithnextboxcs\pack_pairedboxes_second\vbox \bgroup \pack_pairedboxes_inside_second \let\next=} diff --git a/tex/context/base/phys-dim.lua b/tex/context/base/phys-dim.lua index 7b263036f..45a99978d 100644 --- a/tex/context/base/phys-dim.lua +++ b/tex/context/base/phys-dim.lua @@ -817,6 +817,8 @@ local function update_parsers() -- todo: don't remap utf sequences local stop = Cc(nil) / unitsNstop local space = Cc(nil) / unitsNspace + -- todo: avoid \unitsNstart\unitsNstop (weird that it can happen .. now catched at tex end) + local p_c_combinedparser = P { "start", number = start * dleader * (p_c_dparser + number) * stop, rule = V("number")^-1 * unitparser, diff --git a/tex/context/base/phys-dim.mkiv b/tex/context/base/phys-dim.mkiv index 910ab9524..4efaa65a8 100644 --- a/tex/context/base/phys-dim.mkiv +++ b/tex/context/base/phys-dim.mkiv @@ -548,6 +548,16 @@ \fi \c_phys_units_state\plusfive} +% This is a hack: for some reason \unit{micro meter} like patterns give +% \unitsNstart\unitsNstop so there is a buglet in the parser + +\let\unitsNstartindeed\unitsNstart + +\unexpanded\def\unitsNstart + {\doifnextcharelse\unitsNstop\gobbleoneargument\unitsNstartindeed} + +% End of hack. + \unexpanded\def\unitsNspace {\space} diff --git a/tex/context/base/spac-chr.mkiv b/tex/context/base/spac-chr.mkiv index e2ed12522..6b7c8742f 100644 --- a/tex/context/base/spac-chr.mkiv +++ b/tex/context/base/spac-chr.mkiv @@ -54,25 +54,25 @@ % Making them active is also not an option unless we do that in every % catcode vector. -% \nobreakspace {\begingroup\setalignstateattribute\utfchar{"00A0}\endgroup} % 1 = left - -\edef\nobreakspace {\utfchar{"00A0}} -\edef\ideographicspace {\utfchar{"2000}} -\edef\ideographichalffillspace{\utfchar{"2001}} -\edef\twoperemspace {\utfchar{"2002}} -\edef\threeperemspace {\utfchar{"2004}} -\edef\fourperemspace {\utfchar{"2005}} -\edef\sixperemspace {\utfchar{"2006}} -\edef\figurespace {\utfchar{"2007}} -\edef\punctuationspace {\utfchar{"2008}} -\edef\breakablethinspace {\utfchar{"2009}} -\edef\hairspace {\utfchar{"200A}} -\edef\zerowidthspace {\utfchar{"200B}} -\edef\zwnj {\utfchar{"200C}} -\edef\zwj {\utfchar{"200D}} -\edef\narrownobreakspace {\utfchar{"202F}} - -%edef\zerowidthnobreakspace {\utfchar{"FEFF}} +% \nobreakspace {\begingroup\setalignstateattribute\normalUchar"00A0\endgroup} % 1 = left + +\edef\nobreakspace {\normalUchar"00A0} +\edef\ideographicspace {\normalUchar"2000} +\edef\ideographichalffillspace{\normalUchar"2001} +\edef\twoperemspace {\normalUchar"2002} +\edef\threeperemspace {\normalUchar"2004} +\edef\fourperemspace {\normalUchar"2005} +\edef\sixperemspace {\normalUchar"2006} +\edef\figurespace {\normalUchar"2007} +\edef\punctuationspace {\normalUchar"2008} +\edef\breakablethinspace {\normalUchar"2009} +\edef\hairspace {\normalUchar"200A} +\edef\zerowidthspace {\normalUchar"200B} +\edef\zwnj {\normalUchar"200C} +\edef\zwj {\normalUchar"200D} +\edef\narrownobreakspace {\normalUchar"202F} + +%edef\zerowidthnobreakspace {\normalUchar"FEFF} \unexpanded\def\zerowidthnobreakspace{\penalty\plustenthousand\kern\zeropoint} diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 44ac02973..ee770e908 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index bae01fd85..e06883ecc 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/strc-con.mkvi b/tex/context/base/strc-con.mkvi index 249594998..13de171dc 100644 --- a/tex/context/base/strc-con.mkvi +++ b/tex/context/base/strc-con.mkvi @@ -15,6 +15,8 @@ \registerctxluafile{strc-con}{1.001} +% todo: check why \copy .. probably mkii leftover +% % todo: check if commands similar to lists % todo: \strc_constructions_setup_counter\strc_constructions_setup_counter{#1} in setup ... synchronization % @@ -745,10 +747,15 @@ \advance\leftskip\leftskipadaption % but we're already further on \fi \hskip-\leftskipadaption\relax - \ifhbox\constructionheadbox\unhcopy\else\copy\fi\constructionheadbox + \ifhbox\constructionheadbox \unhbox\else\box\fi\constructionheadbox \ifconditional\c_strc_constructions_distance_none \else - \kern\ifdim\constructionsheaddistance=\zeropoint .75\emwidth\else\constructionsheaddistance\fi + % we used to have just a kern, but long lines look bad then + \scratchdistance\ifdim\constructionsheaddistance=\zeropoint .75\emwidth\else\constructionsheaddistance\fi + \hskip \scratchdistance + \s!plus .25\scratchdistance + \s!minus.25\scratchdistance \fi + \allowbreak % new \useconstructionstyleandcolor\c!style\c!color \ignorespaces \stopsetups diff --git a/tex/context/base/strc-flt.mkvi b/tex/context/base/strc-flt.mkvi index 6199a3e6b..954748f27 100644 --- a/tex/context/base/strc-flt.mkvi +++ b/tex/context/base/strc-flt.mkvi @@ -142,9 +142,16 @@ \strc_counter_preset_using_parameter\setupcaption\rootcounterparameter +\newtoks\t_strc_parent_floats_synchronize % *1* + +\unexpanded\def\strc_floats_synchronize#1% \gobbleoneargument + {\strc_counter_setup_using_parameter{#1}\floatcaptionparameter} + \appendtoks \let\currentfloat\currentfloatcaption - \ifx\currentfloat\empty \else + \ifx\currentfloat\empty + \the\t_strc_parent_floats_synchronize + \else \strc_counter_setup_using_parameter\currentfloatcaption\floatcaptionparameter \fi \to \everysetupfloatcaption @@ -166,7 +173,8 @@ \fi\fi} \def\strc_floats_define_normal[#1][#2]% - {\definefloatcaption[#1]% + {\appendtoks\strc_floats_synchronize{#1}\to\t_strc_parent_floats_synchronize + \definefloatcaption[#1]% \definecounter[#1]% \definelist[#1]% \presetlabeltext[#1=\Word{#1}~]% @@ -213,7 +221,7 @@ \newif\ifnofloatnumber \newif\ifemptyfloatcaption -\installstructurelistprocessor{float}{\usestructurelistprocessor{number+title}} +\installstructurelistprocessor\s!float{\usestructurelistprocessor{number+title}} \unexpanded\def\thecurrentfloatnumbersuffix {\doifsomething{\floatcaptionparameter\c!suffix} @@ -784,11 +792,13 @@ \globallet\currentfloatattribute \empty \globallet\currentfloatsynchronize\relax \else + \edef\currentfloatcounter{\namedcounterparameter\currentfloat\s!name}% + % *1* as an alternative we could set counter parameters here if needed \ifnofloatnumber \else \ifnofloatcaption \else - \strc_counters_increment{\namedcounterparameter\currentfloat\s!name}% - \fi \fi + \strc_counters_increment\currentfloatcounter + \fi \fi \strc_counters_register_component - {float}% + \s!float \setupcurrentfloatcaption \floatcaptionparameter \detokenizedfloatcaptionparameter @@ -796,7 +806,7 @@ \relax \relax [\c!name=\currentfloat,% - \s!counter=\namedcounterparameter\currentfloat\s!name,% + \s!counter=\currentfloatcounter,% \s!hascaption=\ifnofloatcaption \v!no\else\v!yes\fi,% \s!hasnumber=\ifnofloatnumber \v!no\else\v!yes\fi,% \s!hastitle=\ifemptyfloatcaption\v!no\else\v!yes\fi]% diff --git a/tex/context/base/strc-itm.mkvi b/tex/context/base/strc-itm.mkvi index 2975711db..40e9a4cbe 100644 --- a/tex/context/base/strc-itm.mkvi +++ b/tex/context/base/strc-itm.mkvi @@ -611,8 +611,8 @@ \strc_itemgroups_insert_item_counter_indeed \fi} -\def\strc_itemgroups_insert_item_counter_indeed - {\begingroup +\def\strc_itemgroups_insert_item_counter_indeed % quite slow ... every time this setup + {\begingroup % can be optimized \setupcounter [\v_strc_itemgroups_counter]% [%\c!prefix=\v!no, diff --git a/tex/context/base/syst-aux.mkiv b/tex/context/base/syst-aux.mkiv index 9a6c75f3c..a5551b954 100644 --- a/tex/context/base/syst-aux.mkiv +++ b/tex/context/base/syst-aux.mkiv @@ -4454,6 +4454,11 @@ {\def\dodogotopar{#1}% \redogotopar\par} +\def\dogotoparcs#1% + {\let\dodogotopar#1% + \redogotopar\par} + + \unexpanded\def\GetPar {\expanded {\dowithpar diff --git a/tex/context/base/typo-dir.mkiv b/tex/context/base/typo-dir.mkiv index b46be4763..d35dfeb66 100644 --- a/tex/context/base/typo-dir.mkiv +++ b/tex/context/base/typo-dir.mkiv @@ -64,11 +64,11 @@ \setupdirections % maybe start/stop [\c!bidi=\v!off] -\unexpanded\def\bidilre{\utfchar{"0x202A}} % maybe \edef's -\unexpanded\def\bidirle{\utfchar{"0x202B}} -\unexpanded\def\bidipop{\utfchar{"0x202C}} -\unexpanded\def\bidilro{\utfchar{"0x202D}} -\unexpanded\def\bidirlo{\utfchar{"0x202E}} +\unexpanded\edef\bidilre{\normalUchar"202A} % maybe \edef's +\unexpanded\edef\bidirle{\normalUchar"202B} +\unexpanded\edef\bidipop{\normalUchar"202C} +\unexpanded\edef\bidilro{\normalUchar"202D} +\unexpanded\edef\bidirlo{\normalUchar"202E} \unexpanded\def\dirlre{\ifcase\directionsbidimode\or\bidilre\or\textdir TLT\fi} \unexpanded\def\dirrle{\ifcase\directionsbidimode\or\bidirle\or\textdir TRT\fi} diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 28473b17b..b3cc9cc1c 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 : 03/27/13 13:27:58 +-- merge date : 03/28/13 09:26:25 do -- begin closure to overcome local limits and interference @@ -995,8 +995,8 @@ local function sortedhashkeys(tab,cmp) end function table.allkeys(t) local keys={} - for i=1,#t do - for k,v in next,t[i] do + for k,v in next,t do + for k,v in next,v do keys[k]=true end end -- cgit v1.2.3