diff options
author | Hans Hagen <pragma@wxs.nl> | 2018-04-19 17:37:21 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2018-04-19 17:37:21 +0200 |
commit | d817aef76ab8b606c02bd0636661b634b43a68a6 (patch) | |
tree | b222d7a356ebe7f1f2267f6aa4f4e424a4d6d88c /tex/context/base/mkiv/node-rul.lua | |
parent | d57683f5f67d6651f7b3353ff347ae57a409e0d4 (diff) | |
download | context-d817aef76ab8b606c02bd0636661b634b43a68a6.tar.gz |
2018-04-19 16:02:00
Diffstat (limited to 'tex/context/base/mkiv/node-rul.lua')
-rw-r--r-- | tex/context/base/mkiv/node-rul.lua | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/tex/context/base/mkiv/node-rul.lua b/tex/context/base/mkiv/node-rul.lua index b8388f373..7c4c2c2f2 100644 --- a/tex/context/base/mkiv/node-rul.lua +++ b/tex/context/base/mkiv/node-rul.lua @@ -49,6 +49,7 @@ local setattrlist = nuts.setattrlist local setshift = nuts.setshift local getwidth = nuts.getwidth local setwidth = nuts.setwidth +local setfield = nuts.setfield local flushlist = nuts.flush_list local effective_glue = nuts.effective_glue @@ -348,12 +349,13 @@ local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but a else local tx = d.text if tx then - tx = copy_list(tx) + local l = copy_list(tx) if d["repeat"] == v_yes then - tx = new_leader(w,tx) + l = new_leader(w,l) + setattrlist(l,tx) end - local r = hpack_nodes(tx,w,"exactly") - inject(r,w,ht,dp) + l = hpack_nodes(l,w,"exactly") + inject(l,w,ht,dp) else for i=1,level do local ht = (offset+(i-1)*dy)*e + rulethickness - m @@ -746,3 +748,38 @@ implement { onlyonce = true, actions = nodes.linefillers.enable } + +-- We add a bonus feature here: + +local new_rule = nodes.pool.rule + +interfaces.implement { + name = "autorule", + arguments = { + { + { "width", "dimension" }, + { "height", "dimension" }, + { "depth", "dimension" }, + { "left", "dimension" }, + { "right", "dimension" }, + }, + }, + actions = function(t) + local l = t.left + local r = t.right + local n = new_rule( + t.width, + t.height, + t.depth + ) + if LUATEXFUNCTIONALITY >= 6710 then + if l then + n.left = l + end + if r then + n.right = r + end + end + context(n) + end +} |