diff options
author | Luigi Scarso <luigi.scarso@gmail.com> | 2019-02-22 23:11:47 +0000 |
---|---|---|
committer | Luigi Scarso <luigi.scarso@gmail.com> | 2019-02-22 23:11:47 +0000 |
commit | 5c6357cdb820b4f628d036ba7b2248f221d50c0b (patch) | |
tree | 6365552f2737faaffe63a395272da242ee2c4f03 /Master/texmf-dist/tex/context/base/mkiv/buff-ini.lua | |
parent | b4568bc71e054f3d1fd6404b45d2322631778284 (diff) |
ConTeXt version 2019.02.22 19:35
git-svn-id: svn://tug.org/texlive/trunk@50086 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/buff-ini.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/buff-ini.lua | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/buff-ini.lua b/Master/texmf-dist/tex/context/base/mkiv/buff-ini.lua index 1c791277318..bd3cf9d5ae2 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/buff-ini.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/buff-ini.lua @@ -167,7 +167,8 @@ local function collectcontent(name,separator) -- no print elseif nnames == 1 then return getcontent(names[1]) else - local t, n = { }, 0 + local t = { } + local n = 0 for i=1,nnames do local c = getcontent(names[i]) if c ~= "" then @@ -182,7 +183,7 @@ local function collectcontent(name,separator) -- no print end local function loadcontent(name) -- no print - local content = collectcontent(name,"\n") -- tex likes \n + local content = collectcontent(name,"\n") -- tex likes \n hm, elsewhere \r local ok, err = load(content) if ok then return ok() @@ -645,7 +646,10 @@ local function gettexbuffer(name) end end -buffers.run = runbuffer +buffers.get = getbuffer +buffers.getmkiv = getbuffermkiv +buffers.gettexbuffer = gettexbuffer +buffers.run = runbuffer implement { name = "getbufferctxlua", actions = loadcontent, arguments = "string" } implement { name = "getbuffer", actions = getbuffer, arguments = "string" } @@ -708,3 +712,18 @@ do end end + +-- moved here: + +function buffers.samplefile(name) + if not buffers.exists(name) then + buffers.assign(name,io.loaddata(resolvers.findfile(name))) + end + buffers.get(name) +end + +implement { + name = "samplefile", -- bad name, maybe rename to injectbuffercontent + actions = buffers.samplefile, + arguments = "string" +} |