diff options
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 |