diff options
Diffstat (limited to 'tex/context/base/buff-imp-mp.lua')
-rw-r--r-- | tex/context/base/buff-imp-mp.lua | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/tex/context/base/buff-imp-mp.lua b/tex/context/base/buff-imp-mp.lua index 24ca597e7..f219df797 100644 --- a/tex/context/base/buff-imp-mp.lua +++ b/tex/context/base/buff-imp-mp.lua @@ -16,12 +16,6 @@ if not modules then modules = { } end modules ['buff-imp-mp'] = { local P, S, V, patterns = lpeg.P, lpeg.S, lpeg.V, lpeg.patterns -local mps = dofile(resolvers.findfile("mult-mps.lua","tex")) - -local primitives = table.tohash(mps.primitives) -local plain = table.tohash(mps.plain) -local metafun = table.tohash(mps.metafun) - local context = context local verbatim = context.verbatim local makepattern = visualizers.makepattern @@ -39,7 +33,23 @@ local MetapostSnippetNamePlain = verbatim.MetapostSnippetNamePlain local MetapostSnippetNameMetafun = verbatim.MetapostSnippetNameMetafun local MetapostSnippetName = verbatim.MetapostSnippetName +local primitives, plain, metafun + +local function initialize() + local mps = dofile(resolvers.findfile("mult-mps.lua","tex")) or { + primitives = { }, + plain = { }, + metafun = { }, + } + primitives = table.tohash(mps.primitives) + plain = table.tohash(mps.plain) + metafun = table.tohash(mps.metafun) +end + local function visualizename(s) + if not primitives then + initialize() + end if primitives[s] then MetapostSnippetNamePrimitive(s) elseif plain[s] then |