diff options
author | Hans Hagen <pragma@wxs.nl> | 2018-03-21 09:47:34 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2018-03-21 09:47:34 +0100 |
commit | f47b4939787074397c9ea37c1d892a1f7ccc7290 (patch) | |
tree | 7768be58efe0faab8e2dccb999686c6a674bf0d7 /tex/context/base/mkiv/back-exp.lua | |
parent | f923c957a3b322ae3ee8e7a0b20df1580869bee7 (diff) | |
download | context-f47b4939787074397c9ea37c1d892a1f7ccc7290.tar.gz |
2018-03-21 09:24:00
Diffstat (limited to 'tex/context/base/mkiv/back-exp.lua')
-rw-r--r-- | tex/context/base/mkiv/back-exp.lua | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/tex/context/base/mkiv/back-exp.lua b/tex/context/base/mkiv/back-exp.lua index 84be8cff9..2d51d933d 100644 --- a/tex/context/base/mkiv/back-exp.lua +++ b/tex/context/base/mkiv/back-exp.lua @@ -39,7 +39,7 @@ local validstring = string.valid local lpegmatch = lpeg.match local utfchar, utfvalues = utf.char, utf.values local concat, insert, remove, merge, sort = table.concat, table.insert, table.remove, table.merge, table.sort -local sortedhash = table.sortedhash +local sortedhash, sortedkeys = table.sortedhash, table.sortedkeys local formatters = string.formatters local todimen = number.todimen local replacetemplate = utilities.templates.replace @@ -74,6 +74,7 @@ local implement = interfaces.implement local included = backends.included local settings_to_array = utilities.parsers.settings_to_array +local settings_to_hash = utilities.parsers.settings_to_hash local setmetatableindex = table.setmetatableindex local tasks = nodes.tasks @@ -1790,7 +1791,35 @@ do resolve(di,element,n,fulltag) end - extras.float = resolve + local floats = { } + + function structurestags.setfloat(options,method) + floats[locatedtag("float")] = { + options = options, + method = method, + } + end + + function extras.float(di,element,n,fulltag) + local hash = floats[fulltag] + if hash then + local method = hash.method + if not method or method == "" then + method = "here" + end + setattribute(di,"method",method) + local options = hash.options + if options and options ~= "" then + options = settings_to_hash(options) + options[method] = nil + options = concat(sortedkeys(options),",") + if #options > 0 then + setattribute(di,"options",options) + end + end + end + resolve(di,element,n,fulltag) + end -- todo: internal is already hashed @@ -3845,6 +3874,12 @@ implement { } implement { + name = "settagfloat", + actions = structurestags.setfloat, + arguments = { "string", "string" } +} + +implement { name = "settagdelimitedsymbol", actions = structurestags.settagdelimitedsymbol, arguments = "string" |