From d817aef76ab8b606c02bd0636661b634b43a68a6 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 19 Apr 2018 17:37:21 +0200 Subject: 2018-04-19 16:02:00 --- tex/context/base/mkiv/node-rul.lua | 45 ++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) (limited to 'tex/context/base/mkiv/node-rul.lua') 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 +} -- cgit v1.2.3