diff options
author | Hans Hagen <pragma@wxs.nl> | 2017-06-04 17:42:38 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2017-06-04 17:42:38 +0200 |
commit | 32f8047624c2fa49c3031a66edb5a039a813f276 (patch) | |
tree | d568ec496e3b4c95adc37ce435b0161a3f40c581 /tex/context/base/mkiv/node-rul.lua | |
parent | 3ab20dbdfa095edd8c6bc00b8e3bdccd78900257 (diff) | |
download | context-32f8047624c2fa49c3031a66edb5a039a813f276.tar.gz |
2017-06-04 17:01:00
Diffstat (limited to 'tex/context/base/mkiv/node-rul.lua')
-rw-r--r-- | tex/context/base/mkiv/node-rul.lua | 51 |
1 files changed, 38 insertions, 13 deletions
diff --git a/tex/context/base/mkiv/node-rul.lua b/tex/context/base/mkiv/node-rul.lua index 4ec651d3b..b6cb9c167 100644 --- a/tex/context/base/mkiv/node-rul.lua +++ b/tex/context/base/mkiv/node-rul.lua @@ -35,6 +35,7 @@ local setlink = nuts.setlink local getnext = nuts.getnext local getprev = nuts.getprev local getid = nuts.getid +local getdir = nuts.getdir local getattr = nuts.getattr local setattr = nuts.setattr local getfont = nuts.getfont @@ -57,6 +58,7 @@ local traverse_id = nuts.traverse_id local list_dimensions = nuts.rangedimensions local hpack_nodes = nuts.hpack local current_attr = nuts.current_attr +local copy_list = nuts.copy_list local nodecodes = nodes.nodecodes local rulecodes = nodes.rulecodes @@ -82,6 +84,7 @@ local nodepool = nuts.pool local new_rule = nodepool.rule local new_userrule = nodepool.userrule local new_kern = nodepool.kern +local new_leader = nodepool.leader local n_tostring = nodes.idstostring local n_tosequence = nodes.tosequence @@ -208,8 +211,19 @@ local trace_ruled = false trackers.register("nodes.rules", function(v) trace_ local report_ruled = logs.reporter("nodes","rules") function rules.define(settings) - data[#data+1] = settings - context(#data) + local nofdata = #data+1 + data[nofdata] = settings + local text = settings.text + if text then + local b = nuts.takebox(text) + if b then + nodepool.register(b) + settings.text = getlist(b) + else + settings.text = nil + end + end + context(nofdata) end local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but acceptable for this purpose @@ -242,7 +256,6 @@ local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but a local method = d.method local empty = d.empty == v_yes local offset = d.offset - local continue = d.continue local dy = d.dy local order = d.order local max = d.max @@ -322,18 +335,28 @@ local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but a } inject(tonut(r),w,ht,dp) else - for i=1,level do - local ht = (offset+(i-1)*dy)*e + rulethickness - m - local dp = -(offset+(i-1)*dy)*e + rulethickness + m - local r = new_rule(w,ht,dp) - if color then - setattr(r,a_colormodel,colorspace) - setattr(r,a_color,color) - end - if transparency then - setattr(r,a_transparency,transparency) + local tx = d.text + if tx then + tx = copy_list(tx) + if d["repeat"] == v_yes then + tx = new_leader(w,tx) end + local r = hpack_nodes(tx,w,"exactly") inject(r,w,ht,dp) + else + for i=1,level do + local ht = (offset+(i-1)*dy)*e + rulethickness - m + local dp = -(offset+(i-1)*dy)*e + rulethickness + m + local r = new_rule(w,ht,dp) + if color then + setattr(r,a_colormodel,colorspace) + setattr(r,a_color,color) + end + if transparency then + setattr(r,a_transparency,transparency) + end + inject(r,w,ht,dp) + end end end return head @@ -617,6 +640,8 @@ implement { { "ta", "integer" }, { "mp" }, { "empty" }, + { "text", "integer" }, + { "repeat" }, } } } |