From e2f3737b9e45d1cf4d553b3f6cce71d5428bfe51 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 31 Jan 2013 22:47:00 +0100 Subject: beta 2013.01.31 22:47 --- tex/context/base/cont-new.mkii | 2 +- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4127 -> 4124 bytes tex/context/base/context-version.png | Bin 40206 -> 40232 bytes tex/context/base/context.mkii | 2 +- tex/context/base/context.mkiv | 2 +- tex/context/base/core-env.mkiv | 25 +++++++++++------ tex/context/base/l-file.lua | 28 +++++++++++++++++++ tex/context/base/page-lay.mkiv | 2 +- tex/context/base/page-mak.mkvi | 2 +- tex/context/base/status-files.pdf | Bin 24734 -> 24744 bytes tex/context/base/status-lua.pdf | Bin 208676 -> 208557 bytes tex/context/base/strc-flt.mkvi | 2 +- tex/context/base/strc-not.mkvi | 2 +- tex/context/base/strc-tag.mkiv | 8 +++--- tex/context/base/tabl-ntb.mkiv | 2 +- tex/context/base/trac-lmx.lua | 22 ++++++++++----- tex/generic/context/luatex/luatex-fonts-merged.lua | 30 ++++++++++++++++++++- 18 files changed, 103 insertions(+), 28 deletions(-) (limited to 'tex') diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index 7dc1dac5e..5a9ea173a 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.01.30 23:53} +\newcontextversion{2013.01.31 22:47} %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 a1cef62f0..8e7d04564 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.01.30 23:53} +\newcontextversion{2013.01.31 22:47} %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 c915c2200..1c49aea89 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 3dc78cb88..c90a939dd 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 2952b640c..8a8aa70dc 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.01.30 23:53} +\edef\contextversion{2013.01.31 22:47} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 140acf364..8ad9f130e 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.01.30 23:53} +\edef\contextversion{2013.01.31 22:47} %D For those who want to use this: diff --git a/tex/context/base/core-env.mkiv b/tex/context/base/core-env.mkiv index e5d7792b3..0332631dc 100644 --- a/tex/context/base/core-env.mkiv +++ b/tex/context/base/core-env.mkiv @@ -352,22 +352,31 @@ % the next one is meant for \c!setups situations, hence the check for % a shortcut -\def\doprocesslocalsetups#1% - {\edef\tobeprocessedsetups{#1}% - \ifx\tobeprocessedsetups\empty\else - \dodoprocesslocalsetups +\let\m_syst_setups_asked\empty + +\def\doprocesslocalsetups#1% sort of public, fast local variant + {\edef\m_syst_setups_asked{#1}% + \ifx\m_syst_setups_asked\empty\else + \expandafter\syst_setups_process_local + \fi} + +\unexpanded\def\usesetupsparameter#1% + {\edef\m_syst_setups_asked{#1\c!setups}% + \ifx\m_syst_setups_asked\empty\else + \expandafter\syst_setups_process_local \fi} -% \def\dodoprocesslocalsetups -% {\expandafter\processcommalist\expandafter[\tobeprocessedsetups]\syst_setups} +% \def\syst_setups_process_local +% {\expandafter\processcommalist\expandafter[\m_syst_setups_asked]\syst_setups} % setups=S1 % setups=lua(S2) % setups=S3 % setups={S1,lua(S2),xml(test{123}),S3} -\def\dodoprocesslocalsetups - {\ctxcommand{autosetups("\tobeprocessedsetups")}} +\def\syst_setups_process_local + {\ctxcommand{autosetups("\m_syst_setups_asked")}% + \relax} % let's prevent lookahead \def\autosetups#1% {\ctxcommand{autosetups("#1")}} diff --git a/tex/context/base/l-file.lua b/tex/context/base/l-file.lua index fcf4d65e3..3cc670f5e 100644 --- a/tex/context/base/l-file.lua +++ b/tex/context/base/l-file.lua @@ -12,6 +12,7 @@ file = file or { } local file = file if not lfs then + lfs = { getcurrentdir = function() return "." @@ -26,7 +27,34 @@ if not lfs then return true end end, + isdir = function(name) + print("you need to load lfs") + return false + end } + +elseif not lfs.isfile then + + local attributes = lfs.attributes + + function lfs.isdir(name) + return attributes(name,"mode") == "directory" + end + + function lfs.isfile(name) + return attributes(name,"mode") == "file" + end + + -- function lfs.isdir(name) + -- local a = attributes(name) + -- return a and a.mode == "directory" + -- end + + -- function lfs.isfile(name) + -- local a = attributes(name) + -- return a and a.mode == "file" + -- end + end local insert, concat = table.insert, table.concat diff --git a/tex/context/base/page-lay.mkiv b/tex/context/base/page-lay.mkiv index febabdac4..bbe60eec5 100644 --- a/tex/context/base/page-lay.mkiv +++ b/tex/context/base/page-lay.mkiv @@ -610,7 +610,7 @@ \global\topspace \layoutparameter\c!topspace \page_layouts_set_dimensions \synchronizegridsnapping - \doprocesslocalsetups{\layoutparameter\c!setups}% depends on gridsnapping ! + \usesetupsparameter\layoutparameter % depends on gridsnapping ! \synchronizewhitespace \synchronizeblank \setupinterlinespace[\v!reset]% \synchronizegloballinespecs diff --git a/tex/context/base/page-mak.mkvi b/tex/context/base/page-mak.mkvi index 6120f56bb..4e5e5dcbe 100644 --- a/tex/context/base/page-mak.mkvi +++ b/tex/context/base/page-mak.mkvi @@ -108,7 +108,7 @@ \usemakeupstyleandcolor\c!style\c!color \hsize\makeupparameter\c!width \setupalign[\makeupparameter\c!align]% - \doprocesslocalsetups{\makeupparameter\c!setups}% lua(..),xml(...,..),tex(..) + \usesetupsparameter\makeupparameter % lua(..),xml(...,..),tex(..) \makeupparameter\c!top \let\stopmakeup\page_makeup_stop_yes} diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index 52f361b10..1a957aa56 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 9a4b03e67..0d0ded3d8 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-flt.mkvi b/tex/context/base/strc-flt.mkvi index 2235cdecd..e268afee7 100644 --- a/tex/context/base/strc-flt.mkvi +++ b/tex/context/base/strc-flt.mkvi @@ -333,7 +333,7 @@ % temporary removed ... was not applied systematically % % \def\dosetcaptionthings -% {\doprocesslocalsetups{\floatcaptionparameter\c!setups}\relax} +% {\usesetupsparameter\floatcaptionparameter} \def\strc_floats_check_caption_content {\ifnofloatcaption diff --git a/tex/context/base/strc-not.mkvi b/tex/context/base/strc-not.mkvi index 691b69c2a..0579eb540 100644 --- a/tex/context/base/strc-not.mkvi +++ b/tex/context/base/strc-not.mkvi @@ -1191,7 +1191,7 @@ \the\everybeforenoteinsert \insert\currentnoteinsertionnumber\bgroup \the\everyinsidenoteinsert\relax - \doprocesslocalsetups{\noteparameter\c!setups}% experimental + \usesetupsparameter\noteparameter % experimental \doifelse{\noteparameter\c!paragraph}\v!yes {\nointerlineskip \startvboxtohbox diff --git a/tex/context/base/strc-tag.mkiv b/tex/context/base/strc-tag.mkiv index 88377a600..6e792fd3f 100644 --- a/tex/context/base/strc-tag.mkiv +++ b/tex/context/base/strc-tag.mkiv @@ -277,7 +277,7 @@ \installcorenamespace {paragraph} \installcommandhandler \??paragraph {paragraph} \??paragraph -\setupparagraph % someday maybe also strut (beg/end) and align +\setupparagraph % someday maybe also strut (beg/end) [\c!color=, \c!style=] @@ -314,8 +314,10 @@ \paragraph_start_indeed} \def\paragraph_start_indeed - {\useparagraphstyleandcolor\c!style\c!color - \dostarttagged\t!paragraph\currentparagraph} + {\useparagraphstyleandcolor\c!style\c!color + \usealignparameter\paragraphparameter + \usesetupsparameter\paragraphparameter + \dostarttagged\t!paragraph\currentparagraph} \def\paragraph_start_zero[#1][#2]% {\let\currentparagraph\empty diff --git a/tex/context/base/tabl-ntb.mkiv b/tex/context/base/tabl-ntb.mkiv index fa42055b1..9927256b1 100644 --- a/tex/context/base/tabl-ntb.mkiv +++ b/tex/context/base/tabl-ntb.mkiv @@ -832,7 +832,7 @@ \ifhmode\kern\zeropoint\fi % blocks \removeunwantedspaces: check this on icare handelingsschema \resetcharacteralign % new \setupcurrentnaturaltablelocal[\c!align={\v!right,\v!broad,\v!high},#1]% - \doifsomething{\naturaltablelocalparameter\c!setups}\doprocesslocalsetups{\naturaltablelocalparameter\c!setups}% + \usesetupsparameter\naturaltablelocalparameter \doifelse{\naturaltablelocalparameter\c!textwidth}\v!local {\hsize\availablehsize} {\hsize\naturaltablelocalparameter\c!textwidth}% diff --git a/tex/context/base/trac-lmx.lua b/tex/context/base/trac-lmx.lua index 474869bae..2754dd16d 100644 --- a/tex/context/base/trac-lmx.lua +++ b/tex/context/base/trac-lmx.lua @@ -12,6 +12,7 @@ local type, tostring, rawget, loadstring, pcall = type, tostring, rawget, loadst local format, sub, gsub = string.format, string.sub, string.gsub local concat = table.concat local P, Cc, Cs, C, Carg, lpegmatch = lpeg.P, lpeg.Cc, lpeg.Cs, lpeg.C, lpeg.Carg, lpeg.match +local joinpath, replacesuffix = file.join, file.replacesuffix local allocate = utilities.storage.allocate local setmetatableindex = table.setmetatableindex @@ -133,7 +134,7 @@ end) -- Loading templates: local function loadedfile(name) - name = (resolvers and resolvers.findfile and resolvers.findfile(name)) or name + name = resolvers and resolvers.findfile and resolvers.findfile(name) or name local data = io.loaddata(name) if not data or data == "" then report_lmx("empty file: %s",name) @@ -145,6 +146,8 @@ lmx.loadedfile = loadedfile -- A few helpers (the next one could end up in l-lpeg): +local usedpaths = { } + local pattern = lpeg.replacer { ["&"] = "&", [">"] = ">", @@ -204,11 +207,12 @@ local function do_type_variable(str) end end -local function do_include(filename) -- todo: store paths of loaded files - local stylepath = lmxvariables.includepath +local function do_include(filename) local data = loadedfile(filename) - if (not data or data == "") and stylepath and stylepath ~= "" then - data = loadedfile(file.join(stylepath,filename)) + if (not data or data == "") and type(usedpaths) == "table" then + for i=1,#usedpaths do + data = loadedfile(joinpath(usedpaths[i],filename)) + end end if not data or data == "" then data = format("",filename) @@ -379,7 +383,7 @@ local luacodecss = beginluacss local othercode = (1-beginluaxml-beginluacss)^1 / " p[==[%0]==] " local include = ((beginembedxml * P("lmx-include") * optionalspaces) / "") - * (argument / lmx.include) + * (argument / do_include) * gobbledend local define_b = ((beginembedxml * P("lmx-define-begin") * optionalspaces) / "") @@ -422,6 +426,10 @@ function lmxnew(data,defaults,nocache) -- todo: use defaults in calling routines data = data or "" local known = cache[data] if not known then +usedpaths = lmxvariables.includepath or { } +if type(usedpaths) == "string" then + usedpaths = { usedpaths } +end data = lpegmatch(pattern_1,data) data = lpegmatch(pattern_2,data,1,{}) data = lpegmatch(pattern_3,data) @@ -558,7 +566,7 @@ function lmxmake(name,variables) local lmxfile = lmx.lmxfile(name) local htmfile = lmx.htmfile(name) if lmxfile == htmfile then - htmfile = file.replacesuffix(lmxfile,"html") + htmfile = replacesuffix(lmxfile,"html") end lmxconvert(lmxfile,htmfile,variables) return htmfile diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index ba0d0d4ef..6121c7206 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/13 23:53:42 +-- merge date : 01/31/13 22:47:25 do -- begin closure to overcome local limits and interference @@ -2221,6 +2221,7 @@ file = file or { } local file = file if not lfs then + lfs = { getcurrentdir = function() return "." @@ -2235,7 +2236,34 @@ if not lfs then return true end end, + isdir = function(name) + print("you need to load lfs") + return false + end } + +elseif not lfs.isfile then + + local attributes = lfs.attributes + + function lfs.isdir(name) + return attributes(name,"mode") == "directory" + end + + function lfs.isfile(name) + return attributes(name,"mode") == "file" + end + + -- function lfs.isdir(name) + -- local a = attributes(name) + -- return a and a.mode == "directory" + -- end + + -- function lfs.isfile(name) + -- local a = attributes(name) + -- return a and a.mode == "file" + -- end + end local insert, concat = table.insert, table.concat -- cgit v1.2.3