From de6cd407dc679fa25a3e072fc23ba77eaec1abf6 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Fri, 23 Oct 2020 02:55:49 -0600 Subject: store body rows in a local variable when partitioning table header/footer --- lib/asciidoctor/table.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/asciidoctor/table.rb b/lib/asciidoctor/table.rb index aac25a8b..98870b1a 100644 --- a/lib/asciidoctor/table.rb +++ b/lib/asciidoctor/table.rb @@ -154,21 +154,17 @@ class Table < AbstractBlock # returns nothing def partition_header_footer(attrs) # set rowcount before splitting up body rows - @attributes['rowcount'] = @rows.body.size + num_body_rows = @attributes['rowcount'] = (body = @rows.body).size - num_body_rows = @rows.body.size if num_body_rows > 0 && @has_header_option - head = @rows.body.shift - num_body_rows -= 1 + @rows.head = [(head = body.shift)] # styles aren't applied to header row head.each {|c| c.style = nil } - # QUESTION why does AsciiDoc use an array for head? is it - # possible to have more than one based on the syntax? - @rows.head = [head] + num_body_rows -= 1 end if num_body_rows > 0 && attrs['footer-option'] - @rows.foot = [@rows.body.pop] + @rows.foot = [body.pop] end nil -- cgit v1.2.3