From 882c68f8cf4b95e1cbceadb0794d7d2d212c9a8c Mon Sep 17 00:00:00 2001 From: Marius Date: Sat, 1 Feb 2014 13:40:15 +0200 Subject: beta 2014.02.01 12:12 --- scripts/context/lua/mtx-plain.lua | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4114 -> 4086 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/core-uti.lua | 4 + tex/context/base/page-brk.mkiv | 6 +- tex/context/base/page-mak.mkvi | 13 +++- tex/context/base/page-mix.mkiv | 3 +- tex/context/base/publ-ini.lua | 84 +++++++++++++++++++-- tex/context/base/s-math-coverage.lua | 4 +- tex/context/base/status-files.pdf | Bin 24848 -> 24840 bytes tex/context/base/status-lua.pdf | Bin 226689 -> 226845 bytes tex/context/base/strc-pag.lua | 2 + tex/context/base/x-mathml.lua | 17 +++-- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 15 files changed, 118 insertions(+), 23 deletions(-) diff --git a/scripts/context/lua/mtx-plain.lua b/scripts/context/lua/mtx-plain.lua index d10c21375..de13717d3 100644 --- a/scripts/context/lua/mtx-plain.lua +++ b/scripts/context/lua/mtx-plain.lua @@ -114,7 +114,7 @@ local texformat = environment.arguments.texformat or environment.arguments.forma local texengine = environment.arguments.texengine or environment.arguments.engine if type(texengine) ~= "string" or texengine == "" then - texengine = environment.arguments.jit and "luajittex" or"luatex" + texengine = (jit or environment.arguments.jit) and "luajittex" or "luatex" end if type(texformat) ~= "string" or texformat == "" then diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index 7f0eec7bb..9c28f21b9 100644 --- a/tex/context/base/cont-new.mkiv +++ b/tex/context/base/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2014.01.30 23:30} +\newcontextversion{2014.02.01 12:12} %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 463822aa3..abc32db00 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.mkiv b/tex/context/base/context.mkiv index 557ec8f9f..abc24dda1 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -28,7 +28,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2014.01.30 23:30} +\edef\contextversion{2014.02.01 12:12} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/core-uti.lua b/tex/context/base/core-uti.lua index 1c230cead..71b80170c 100644 --- a/tex/context/base/core-uti.lua +++ b/tex/context/base/core-uti.lua @@ -126,6 +126,10 @@ function jobvariables.save(cs,value) tobesaved[cs] = value end +function jobvariables.restore(cs) + return collected[cs] or tobesaved[cs] +end + -- checksums function jobvariables.getchecksum(tag) diff --git a/tex/context/base/page-brk.mkiv b/tex/context/base/page-brk.mkiv index 82bde2f67..11dc04bfd 100644 --- a/tex/context/base/page-brk.mkiv +++ b/tex/context/base/page-brk.mkiv @@ -506,9 +506,9 @@ \definepagechecker[\s!unknown:2][\s!unknown:0][\c!method=2] \definepagechecker[\s!unknown:3][\s!unknown:0][\c!method=3] -\def\page_tests_test_a[#1][#2]{\checkpage[\s!unknown:1][\c!lines=#1,\c!offset=\ifsecondargument#2\else\zeropoint\fi]} -\def\page_tests_test_b[#1][#2]{\checkpage[\s!unknown:2][\c!lines=#1,\c!offset=\ifsecondargument#2\else\zeropoint\fi]} -\def\page_tests_test_c[#1][#2]{\checkpage[\s!unknown:3][\c!lines=#1,\c!offset=\ifsecondargument#2\else\zeropoint\fi]} +\def\page_tests_test_a[#1][#2]{\normalexpanded{\checkpage[\s!unknown:1][\c!lines=#1,\c!offset=\ifsecondargument#2\else\zeropoint\fi]}} +\def\page_tests_test_b[#1][#2]{\normalexpanded{\checkpage[\s!unknown:2][\c!lines=#1,\c!offset=\ifsecondargument#2\else\zeropoint\fi]}} +\def\page_tests_test_c[#1][#2]{\normalexpanded{\checkpage[\s!unknown:3][\c!lines=#1,\c!offset=\ifsecondargument#2\else\zeropoint\fi]}} \unexpanded\def\testpage {\dodoubleempty\page_tests_test_a} % \unexpanded\def\testpageonly{\dodoubleempty\page_tests_test_b} % no penalties added to the mvl diff --git a/tex/context/base/page-mak.mkvi b/tex/context/base/page-mak.mkvi index 0fde119f2..17269b174 100644 --- a/tex/context/base/page-mak.mkvi +++ b/tex/context/base/page-mak.mkvi @@ -92,12 +92,21 @@ {\doifelsecommandhandler\??makeup{#name}\page_makeup_start_indeed\page_makeup_start_nop[#name]}% \def\page_makeup_start_indeed[#name][#settings]% - {\edef\p_page{\namedmakeupparameter{#name}\c!page} + {% the next grouping hack is somewhat messy: + \begingroup + \edef\currentmakeup{#name}% + \setupcurrentmakeup[#settings]% + \edef\p_page{\makeupparameter\c!page}% \ifx\p_page\empty + \endgroup \page % new, so best not have dangling mess here like references (we could capture then and flush embedded) + \else\ifx\p_page\v!no + % nothing + \endgroup \else + \endgroup \page[\p_page]% - \fi + \fi\fi \startlayout[#name]% includes \page \bgroup \edef\currentmakeup{#name}% diff --git a/tex/context/base/page-mix.mkiv b/tex/context/base/page-mix.mkiv index 5d1c54a71..d2bb38ca0 100644 --- a/tex/context/base/page-mix.mkiv +++ b/tex/context/base/page-mix.mkiv @@ -517,7 +517,8 @@ %D footnotes. Eventually we will have multiple strategies available. \unexpanded\def\page_mix_routine_construct#1% - {\ctxcommand{mixsetsplit { + {\d_page_mix_max_height\mixedcolumnsparameter\c!maxheight % can have changed due to header=high + \ctxcommand{mixsetsplit { box = \number\b_page_mix_collected, nofcolumns = \number\c_page_mix_n_of_columns, maxheight = \number\d_page_mix_max_height, diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua index 7c3670208..48b5b4ed2 100644 --- a/tex/context/base/publ-ini.lua +++ b/tex/context/base/publ-ini.lua @@ -6,6 +6,39 @@ if not modules then modules = { } end modules ['publ-ini'] = { license = "see context related readme files" } +-- for the moment here + +local lpegmatch = lpeg.match +local P, C, Ct = lpeg.P, lpeg.C, lpeg.Ct + +local lpegmatch = lpeg.match +local pattern = lpeg.Cs((1 - lpeg.P(1) * lpeg.P(-1))^0 * (lpeg.P(".")/"" + lpeg.P(1))) + +local manipulators = { + stripperiod = function(str) return lpegmatch(pattern,str) end, + uppercase = characters.upper, + lowercase = characters.lower, +} + +local manipulation = C((1-P("->"))^1) * P("->") * C(P(1)^0) + +local pattern = manipulation / function(operation,str) + local manipulator = manipulators[operation] + return manipulator and manipulator(str) or str +end + +local function manipulated(str) + return lpegmatch(pattern,str) or str +end + +utilities.parsers.manipulation = manipulation +utilities.parsers.manipulators = manipulators +utilities.parsers.manipulated = manipulated + +function commands.manipulated(str) + context(manipulated(str)) +end + -- use: for rest in gmatch(reference,"[^, ]+") do local next, rawget, type = next, rawget, type @@ -17,6 +50,7 @@ local allocate = utilities.storage.allocate local settings_to_array = utilities.parsers.settings_to_array local sortedkeys, sortedhash = table.sortedkeys, table.sortedhash local lpegmatch = lpeg.match +local P, C, Ct = lpeg.P, lpeg.C, lpeg.Ct local report = logs.reporter("publications") local trace = false trackers.register("publications", function(v) trace = v end) @@ -350,23 +384,59 @@ function commands.setbtxentry(name,tag) end end --- rendering of fields +-- rendering of fields (maybe multiple manipulators) + +local manipulation = utilities.parsers.manipulation +local manipulators = utilities.parsers.manipulators + +-- local function checked(field) +-- local m, f = lpegmatch(manipulation,field) +-- if m then +-- return manipulators[m], f or field +-- else +-- return nil, field +-- end +-- end + +local manipulation = Ct((C((1-P("->"))^1) * P("->"))^1) * C(P(1)^0) + +local function checked(field) + local m, f = lpegmatch(manipulation,field) + if m then + return m, f or field + else + return nil, field + end +end + +local function manipulated(actions,str) + for i=1,#actions do + local action = manipulators[actions[i]] + if action then + str = action(str) or str + end + end + return str +end function commands.btxflush(name,tag,field) local dataset = rawget(datasets,name) if dataset then local fields = dataset.luadata[tag] if fields then + local manipulator, field = checked(field) local value = fields[field] if type(value) == "string" then - context(value) + -- context(manipulator and manipulator(value) or value) + context(manipulator and manipulated(manipulator,value) or value) return end local details = dataset.details[tag] if details then local value = details[field] if type(value) == "string" then - context(value) + -- context(manipulator and manipulator(value) or value) + context(manipulator and manipulated(manipulator,value) or value) return end end @@ -384,9 +454,11 @@ function commands.btxdetail(name,tag,field) if dataset then local details = dataset.details[tag] if details then + local manipulator, field = checked(field) local value = details[field] if type(value) == "string" then - context(value) + -- context(manipulator and manipulator(value) or value) + context(manipulator and manipulated(manipulator,value) or value) else report("unknown detail %a of tag %a in dataset %a",field,tag,name) end @@ -403,9 +475,11 @@ function commands.btxfield(name,tag,field) if dataset then local fields = dataset.luadata[tag] if fields then + local manipulator, field = checked(field) local value = fields[field] if type(value) == "string" then - context(value) + -- context(manipulator and manipulator(value) or value) + context(manipulator and manipulated(manipulator,value) or value) else report("unknown field %a of tag %a in dataset %a",field,tag,name) end diff --git a/tex/context/base/s-math-coverage.lua b/tex/context/base/s-math-coverage.lua index a74e24450..5f1c7cc5a 100644 --- a/tex/context/base/s-math-coverage.lua +++ b/tex/context/base/s-math-coverage.lua @@ -123,7 +123,7 @@ function moduledata.math.coverage.showalphabets() end function moduledata.math.coverage.showcharacters() - context.startcolumns() + context.startmixedcolumns() context.setupalign { "nothyphenated" } context.starttabulate { "|T|i2|Tpl|" } for u, d in table.sortedpairs(chardata) do @@ -150,7 +150,7 @@ function moduledata.math.coverage.showcharacters() end end context.stoptabulate() - context.stopcolumns() + context.stopmixedcolumns() end -- This is a somewhat tricky table as we need to bypass the math machinery. diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 8c1130db1..34b802a2c 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 8ba257c44..617e15c03 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-pag.lua b/tex/context/base/strc-pag.lua index 02ed5610f..7b43a3a58 100644 --- a/tex/context/base/strc-pag.lua +++ b/tex/context/base/strc-pag.lua @@ -40,10 +40,12 @@ local collected, tobesaved = allocate(), allocate() pages.collected = collected pages.tobesaved = tobesaved +pages.nofpages = 0 local function initializer() collected = pages.collected tobesaved = pages.tobesaved + pages.nofpages = #collected end job.register('structures.pages.collected', tobesaved, initializer) diff --git a/tex/context/base/x-mathml.lua b/tex/context/base/x-mathml.lua index cd60e756d..ee18d4776 100644 --- a/tex/context/base/x-mathml.lua +++ b/tex/context/base/x-mathml.lua @@ -491,13 +491,18 @@ function mathml.mi(id) if n == 0 then -- nothing to do elseif n == 1 then - local str = gsub(str[1],"&.-;","") -- bah - local rep = i_replacements[str] - if not rep then - rep = gsub(str,".",i_replacements) + local first = str[1] + if type(first) == "string" then + local str = gsub(first,"&.-;","") -- bah + local rep = i_replacements[str] + if not rep then + rep = gsub(str,".",i_replacements) + end + context(rep) + -- context.mi(rep) + else + context.xmlflush(id) -- xmlsprint or so end - context(rep) - -- context.mi(rep) else context.xmlflush(id) -- xmlsprint or so end diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index aae16dc7b..47776fa30 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 : 01/30/14 23:30:41 +-- merge date : 02/01/14 12:12:13 do -- begin closure to overcome local limits and interference -- cgit v1.2.3