diff options
author | Hans Hagen <pragma@wxs.nl> | 2019-01-03 20:16:56 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2019-01-03 20:16:56 +0100 |
commit | b04dda4c73d0f71e78f1fd4979ef04c7e9a669ed (patch) | |
tree | 4a53c427af3bca27aa5dc47f4c06ee71fb2e8508 /tex/context/base/mkiv/mlib-lua.lua | |
parent | b28de538b3b4dc7acda5eb9eefc7a7d68c8fb49f (diff) | |
download | context-b04dda4c73d0f71e78f1fd4979ef04c7e9a669ed.tar.gz |
2019-01-03 19:35:00
Diffstat (limited to 'tex/context/base/mkiv/mlib-lua.lua')
-rw-r--r-- | tex/context/base/mkiv/mlib-lua.lua | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tex/context/base/mkiv/mlib-lua.lua b/tex/context/base/mkiv/mlib-lua.lua index c155d7733..8074a6a4a 100644 --- a/tex/context/base/mkiv/mlib-lua.lua +++ b/tex/context/base/mkiv/mlib-lua.lua @@ -10,7 +10,7 @@ if not modules then modules = { } end modules ['mlib-lua'] = { -- maybe we need mplib.model, but how with instances -local type, tostring, select, loadstring = type, tostring, select, loadstring +local type, tostring, tonumber, select, loadstring = type, tostring, tonumber, select, loadstring local find, match, gsub, gmatch = string.find, string.match, string.gsub, string.gmatch local concat, insert, remove = table.concat, table.insert, table.remove @@ -863,6 +863,21 @@ end do + local mppair = mp.pair + + function mp.textextanchor(s) + local x, y = match(s,"tx_anchor=(%S+) (%S+)") -- todo: make an lpeg + if x and y then + x = tonumber(x) + y = tonumber(y) + end + mppair(x or 0,y or 0) + end + +end + +do + local mprint = mp.print local qprint = mp.quoted local getmacro = tokens.getters.macro |