From 4a3d6c259183d2e619d39c4f273d7c5489356113 Mon Sep 17 00:00:00 2001 From: Marius Date: Mon, 23 Apr 2012 19:20:16 +0300 Subject: beta 2012.04.23 15:58 --- tex/context/base/char-def.lua | 35 ++++++------ tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4074 -> 4077 bytes tex/context/base/context-version.png | Bin 105915 -> 105975 bytes tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 2 +- tex/context/base/core-mis.mkiv | 10 ++-- tex/context/base/lxml-lpt.lua | 11 ++-- tex/context/base/math-ini.mkiv | 2 +- tex/context/base/mult-low.lua | 2 +- tex/context/base/status-files.pdf | Bin 24321 -> 24320 bytes tex/context/base/status-lua.pdf | Bin 173036 -> 173052 bytes tex/context/base/tabl-tbl.mkiv | 6 +-- tex/context/base/tabl-xtb.lua | 59 ++++++++++++++++----- tex/context/base/tabl-xtb.mkvi | 6 ++- tex/context/base/x-cals.mkiv | 6 ++- tex/context/base/x-ct.lua | 21 ++++++-- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 19 files changed, 107 insertions(+), 61 deletions(-) (limited to 'tex') diff --git a/tex/context/base/char-def.lua b/tex/context/base/char-def.lua index b76886882..1e3b8a595 100644 --- a/tex/context/base/char-def.lua +++ b/tex/context/base/char-def.lua @@ -401,20 +401,20 @@ characters.data={ adobename="comma", category="po", cjkwd="na", + contextname="textcomma", description="COMMA", direction="cs", linebreak="is", mathclass="punctuation", - mathspec={ - { - class="punctuation", - name="textcomma", - }, - { - class="ord", - name="mathcomma", - }, - }, +--mathspec={ +-- { +-- class="punctuation", +-- }, +-- { +-- class="ord", +-- name="mathcomma", +-- }, +--}, unicodeslot=0x002C, }, { @@ -431,19 +431,18 @@ characters.data={ adobename="period", category="po", cjkwd="na", + contextname="textperiod", description="FULL STOP", direction="cs", linebreak="is", mathclass="ord", mathspec={ - { - class="ord", - name="mathperiod", - }, - { - class="punctuation", - name="textperiod", - }, +-- { +-- class="ord", +-- }, +-- { +-- class="punctuation", +-- }, { class="punctuation", name="ldotp", diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 494b78b13..8fb40a354 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{2012.04.19 23:18} +\newcontextversion{2012.04.23 15:58} %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 3cd207ede..c3ec87d67 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{2012.04.19 23:18} +\newcontextversion{2012.04.23 15:58} %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/context-version.pdf b/tex/context/base/context-version.pdf index 14d3139ce..0d24263e5 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 a150ec151..4f24bf5ea 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 63c2dc542..5a707ff4c 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{2012.04.19 23:18} +\edef\contextversion{2012.04.23 15:58} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index dd5905ab0..1de954260 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -23,7 +23,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2012.04.19 23:18} +\edef\contextversion{2012.04.23 15:58} %D For those who want to use this: diff --git a/tex/context/base/core-mis.mkiv b/tex/context/base/core-mis.mkiv index 06939ac89..5c364f3c4 100644 --- a/tex/context/base/core-mis.mkiv +++ b/tex/context/base/core-mis.mkiv @@ -689,12 +689,10 @@ \def\commacommandsentence[#1]{\@EA\commalistsentence\@EA[#1]} -\ifx\textcomma\undefined \def\textcomma{,} \fi - -\setuplabeltext [\s!nl] [and-1=\textcomma\ , and-2= en ] -\setuplabeltext [\s!en] [and-1=\textcomma\ , and-2=\textcomma\ and ] -\setuplabeltext [\s!de] [and-1=\textcomma\ , and-2= und ] -\setuplabeltext [\s!hr] [and-1=\textcomma\ , and-2= i ] +\setuplabeltext [\s!nl] [and-1={,} , and-2= en ] % 1, 2 en 3 +\setuplabeltext [\s!en] [and-1={,} , and-2={,} ] % 1, 2, 3 +\setuplabeltext [\s!de] [and-1={,} , and-2= und ] % 1, 2 und 3 +\setuplabeltext [\s!hr] [and-1={,} , and-2= i ] % 1, 2 i 3 %D \macros %D {somekindoftab} diff --git a/tex/context/base/lxml-lpt.lua b/tex/context/base/lxml-lpt.lua index 2644abf88..44dd97155 100644 --- a/tex/context/base/lxml-lpt.lua +++ b/tex/context/base/lxml-lpt.lua @@ -532,6 +532,7 @@ local lp_builtin = P ( P("element") / "(ll.ei or 1)" + P("index") / "(ll.ni or 1)" + P("match") / "(ll.mi or 1)" + + -- P("namespace") / "ll.ns" + P("ns") / "ll.ns" ) * ((spaces * P("(") * spaces * P(")"))/"") @@ -555,11 +556,11 @@ local lp_function = C(R("az","AZ","__")^1) * P("(") / function(t) -- todo: bett end end -local lparent = lpeg.P("(") -local rparent = lpeg.P(")") +local lparent = P("(") +local rparent = P(")") local noparent = 1 - (lparent+rparent) -local nested = lpeg.P{lparent * (noparent + lpeg.V(1))^0 * rparent} -local value = lpeg.P(lparent * lpeg.C((noparent + nested)^0) * rparent) -- lpeg.P{"("*C(((1-S("()"))+V(1))^0)*")"} +local nested = P{lparent * (noparent + V(1))^0 * rparent} +local value = P(lparent * C((noparent + nested)^0) * rparent) -- P{"("*C(((1-S("()"))+V(1))^0)*")"} local lp_child = Cc("expr.child(ll,'") * R("az","AZ","--","__")^1 * Cc("')") local lp_number = S("+-") * R("09")^1 @@ -773,7 +774,7 @@ local pathparser = Ct { "patterns", -- can be made a bit faster by moving some p expressions = expression / register_expression, letters = R("az")^1, - name = (1-lpeg.S("/[]()|:*!"))^1, -- make inline + name = (1-S("/[]()|:*!"))^1, -- make inline negate = P("!") * Cc(false), nodefunction = V("negate") + P("not") * Cc(false) + Cc(true), diff --git a/tex/context/base/math-ini.mkiv b/tex/context/base/math-ini.mkiv index 50a44d5b0..710a65f5b 100644 --- a/tex/context/base/math-ini.mkiv +++ b/tex/context/base/math-ini.mkiv @@ -1111,7 +1111,7 @@ % force text mode, will be overloaded later -\ifx\text\undefined \let\text\hbox \fi +\ifdefined\text\else \let\text\hbox \fi \unexpanded\def\mathoptext#1{\mathop{\text{#1}}} diff --git a/tex/context/base/mult-low.lua b/tex/context/base/mult-low.lua index c08247afd..9690f6c47 100644 --- a/tex/context/base/mult-low.lua +++ b/tex/context/base/mult-low.lua @@ -190,7 +190,7 @@ return { -- "appendtoks", "prependtoks", "appendtotoks", "prependtotoks", "to", -- - "endgraf", "empty", "null", "space", "obeyspaces", "obeylines", "normalspace", + "endgraf", "empty", "null", "space", "quad", "enspace", "obeyspaces", "obeylines", "normalspace", -- "executeifdefined", -- diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 060bb72f6..5db71ebeb 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 10850803d..c53a0179f 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/tabl-tbl.mkiv b/tex/context/base/tabl-tbl.mkiv index 1857c5a8a..ab4005fb7 100644 --- a/tex/context/base/tabl-tbl.mkiv +++ b/tex/context/base/tabl-tbl.mkiv @@ -1900,10 +1900,10 @@ {\c_tabl_tabulate_pass\plusone \tabl_tabulate_check_full_content \edef\v_tabl_tabulate_align{\executeifdefined{\??tabulatealigning\p_align}0}% - \s_tabl_tabulate_post.5\d_tabl_tabulate_unit + \s_tabl_tabulate_post\zeropoint \s_tabl_tabulate_pre\zeropoint - \s_tabl_tabulate_first\s_tabl_tabulate_post - \s_tabl_tabulate_last\s_tabl_tabulate_post + \s_tabl_tabulate_first.5\d_tabl_tabulate_unit + \s_tabl_tabulate_last\s_tabl_tabulate_first \global\c_tabl_tabulate_columns\zerocount \global\c_tabl_tabulate_nofauto\zerocount \global\c_tabl_tabulate_noflines\zerocount diff --git a/tex/context/base/tabl-xtb.lua b/tex/context/base/tabl-xtb.lua index 6ac5e1835..395d65a03 100644 --- a/tex/context/base/tabl-xtb.lua +++ b/tex/context/base/tabl-xtb.lua @@ -44,6 +44,8 @@ local context_nointerlineskip = context.nointerlineskip local variables = interfaces.variables local setmetatableindex = table.setmetatableindex +local settings_to_hash = utilities.parsers.settings_to_hash + local copy_node_list = node.copy_list local hpack_node_list = node.hpack local vpack_node_list = node.vpack @@ -62,6 +64,7 @@ local v_width = variables.width local v_height = variables.height local v_repeat = variables["repeat"] local v_max = variables.max +local v_fixed = variables.fixed local xtables = { } typesetters.xtables = xtables @@ -89,16 +92,18 @@ local stack, data = { }, nil function xtables.create(settings) table.insert(stack,data) - local rows = { } - local widths = { } - local heights = { } - local depths = { } - local spans = { } - local distances = { } - local autowidths = { } - local modes = { } - local fixedrows = { } - local fixedcolumns = { } + local rows = { } + local widths = { } + local heights = { } + local depths = { } + local spans = { } + local distances = { } + local autowidths = { } + local modes = { } + local fixedrows = { } + local fixedcolumns = { } + local frozencolumns = { } + local options = { } data = { rows = rows, widths = widths, @@ -110,6 +115,8 @@ function xtables.create(settings) autowidths = autowidths, fixedrows = fixedrows, fixedcolumns = fixedcolumns, + frozencolumns = frozencolumns, + options = options, nofrows = 0, nofcolumns = 0, currentrow = 0, @@ -120,6 +127,11 @@ function xtables.create(settings) t[k] = 0 return 0 end + local function add_table(t,k) + local v = { } + t[k] = v + return v + end local function add_cell(row,c) local cell = { nx = 0, @@ -149,12 +161,13 @@ function xtables.create(settings) setmetatableindex(modes,add_zero) setmetatableindex(fixedrows,add_zero) setmetatableindex(fixedcolumns,add_zero) + setmetatableindex(options,add_table) -- settings.columndistance = tonumber(settings.columndistance) or 0 settings.rowdistance = tonumber(settings.rowdistance) or 0 settings.leftmargindistance = tonumber(settings.leftmargindistance) or 0 settings.rightmargindistance = tonumber(settings.rightmargindistance) or 0 - settings.options = utilities.parsers.settings_to_hash(settings.option) + settings.options = settings_to_hash(settings.option) settings.textwidth = tonumber(settings.textwidth) or tex.hsize settings.lineheight = tonumber(settings.lineheight) or texdimen.lineheight settings.maxwidth = tonumber(settings.maxwidth) or settings.textwidth/8 @@ -166,7 +179,7 @@ function xtables.create(settings) end -function xtables.initialize_reflow_width() +function xtables.initialize_reflow_width(option) local r = data.currentrow local c = data.currentcolumn + 1 local drc = data.rows[r][c] @@ -177,6 +190,13 @@ function xtables.initialize_reflow_width() if distance > distances[c] then distances[c] = distance end + if option and option ~= "" then + local options = settings_to_hash(option) + data.options[r][c] = options + if options[v_fixed] then + data.frozencolumns[c] = true + end + end data.currentcolumn = c end @@ -385,6 +405,7 @@ function xtables.reflow_width() local distances = data.distances local autowidths = data.autowidths local fixedcolumns = data.fixedcolumns + local frozencolumns = data.frozencolumns local width = 0 local distance = 0 local nofwide = 0 @@ -393,6 +414,7 @@ function xtables.reflow_width() if trace_xtable then showwidths("stage 1",widths,autowidths) end + local noffrozen = 0 if options[v_max] then for c=1,nofcolumns do width = width + widths[c] @@ -404,6 +426,9 @@ function xtables.reflow_width() if c < nofcolumns then distance = distance + distances[c] end + if frozencolumns[c] then + noffrozen = noffrozen + 1 -- brr, should be nx or so + end end else for c=1,nofcolumns do -- also keep track of forced @@ -422,6 +447,9 @@ function xtables.reflow_width() if c < nofcolumns then distance = distance + distances[c] end + if frozencolumns[c] then + noffrozen = noffrozen + 1 -- brr, should be nx or so + end end end if trace_xtable then @@ -450,13 +478,16 @@ function xtables.reflow_width() widths[c] = widths[c] + factor * widths[c] end else - local extra = delta / nofcolumns + -- frozen -> a column with option=fixed will not stretch + local extra = delta / (nofcolumns - noffrozen) if trace_xtable then report_xtable("normal stretch, delta: %s, extra: %s", points(delta),points(extra)) end for c=1,nofcolumns do - widths[c] = widths[c] + extra + if not frozencolumns[c] then + widths[c] = widths[c] + extra + end end end elseif nofwide > 0 then diff --git a/tex/context/base/tabl-xtb.mkvi b/tex/context/base/tabl-xtb.mkvi index 86bc3f346..2382cae21 100644 --- a/tex/context/base/tabl-xtb.mkvi +++ b/tex/context/base/tabl-xtb.mkvi @@ -64,6 +64,8 @@ % option=stretch : equal distribution % option={stretch,width} : proportional distribution % option={max} : prefer max over forced width/height +% +% cells: option=fixed : nils autostretch (not yet complete) % \setbox\scratchbox\hbox attr \taggedattribute \attribute\taggedattribute {...} % @@ -251,6 +253,8 @@ header = "\xtableparameter\c!header", footer = "\xtableparameter\c!footer", } }% + % + \letxtableparameter\c!option\empty % not so nice but needed as we use this in the setup \linewidth\xtableparameter\c!rulethickness\relax % so we freeze it @@ -424,7 +428,7 @@ \fi % \d_tabl_x_distance\xtableparameter\c!distance\relax - \ctxcommand{x_table_init_reflow_width()}% + \ctxcommand{x_table_init_reflow_width("\xtableparameter\c!option")}% \inheritedxtableframed\bgroup \tabl_x_begin_of_cell \tabl_x_set_hsize} diff --git a/tex/context/base/x-cals.mkiv b/tex/context/base/x-cals.mkiv index 4b9195fad..4e68c3400 100644 --- a/tex/context/base/x-cals.mkiv +++ b/tex/context/base/x-cals.mkiv @@ -26,11 +26,13 @@ % \xmlregistersetup{xml:cals:process} \startxmlsetups xml:cals:process - \xmlsetfunction {\xmldocument} {cals:table} {moduledata.cals.table} +% \xmlsetfunction {\xmldocument} {cals:table} {moduledata.cals.table} + \xmlsetfunction {#1} {cals:table} {moduledata.cals.table} \stopxmlsetups \startxmlsetups xml:cals:nonamespace - \xmlsetfunction {\xmldocument} {table} {moduledata.cals.table} +% \xmlsetfunction {\xmldocument} {table} {moduledata.cals.table} + \xmlsetfunction {#1} {table} {moduledata.cals.table} \stopxmlsetups \xmlregistersetup{xml:cals:process} diff --git a/tex/context/base/x-ct.lua b/tex/context/base/x-ct.lua index 1d0e63dae..2dee985c3 100644 --- a/tex/context/base/x-ct.lua +++ b/tex/context/base/x-ct.lua @@ -24,16 +24,27 @@ local halignments = { justify = '', } +local templates = { } + +function moduledata.ct.registertabulatetemplate(name,str) + templates[name] = str +end + local function roottemplate(root) local rt = root.at.template if rt then - if not find(rt,"|") then - rt = gsub(rt,",","|") + local template = templates[rt] + if template then + return template + else + if not find(rt,"|") then + rt = gsub(rt,",","|") + end + if not find(rt,"^|") then rt = "|" .. rt end + if not find(rt,"|$") then rt = rt .. "|" end + return rt end - if not find(rt,"^|") then rt = "|" .. rt end - if not find(rt,"|$") then rt = rt .. "|" end end - return rt end local function specifiedtemplate(root,templatespec) diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 28b06e1dc..c4939d8ba 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/19/12 23:18:52 +-- merge date : 04/23/12 15:58:30 do -- begin closure to overcome local limits and interference -- cgit v1.2.3