summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2020-10-23 03:54:39 -0600
committerDan Allen <dan.j.allen@gmail.com>2020-10-23 03:54:39 -0600
commitae24065dc0c7b025abb12e5ba02fd5c828db54b7 (patch)
tree6f24e71478cca9bafeb8fb37e968dc94405335a2 /lib
parentde6cd407dc679fa25a3e072fc23ba77eaec1abf6 (diff)
consolidate has_header_option assignment on table
Diffstat (limited to 'lib')
-rw-r--r--lib/asciidoctor/parser.rb6
-rw-r--r--lib/asciidoctor/table.rb2
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/asciidoctor/parser.rb b/lib/asciidoctor/parser.rb
index 20293be2..349207e9 100644
--- a/lib/asciidoctor/parser.rb
+++ b/lib/asciidoctor/parser.rb
@@ -2274,9 +2274,13 @@ class Parser
end
skipped = table_reader.skip_blank_lines || 0
+ if attributes['header-option']
+ table.has_header_option = true
+ elsif skipped == 0 && !attributes['noheader-option']
+ implicit_header = true
+ end
parser_ctx = Table::ParserContext.new table_reader, table, attributes
format, loop_idx, implicit_header_boundary = parser_ctx.format, -1, nil
- implicit_header = true unless skipped > 0 || attributes['header-option'] || attributes['noheader-option']
while (line = table_reader.read_line)
if (beyond_first = (loop_idx += 1) > 0) && line.empty?
diff --git a/lib/asciidoctor/table.rb b/lib/asciidoctor/table.rb
index 98870b1a..ee1066bc 100644
--- a/lib/asciidoctor/table.rb
+++ b/lib/asciidoctor/table.rb
@@ -58,7 +58,7 @@ class Table < AbstractBlock
@rows = Rows.new
@columns = []
- @has_header_option = attributes['header-option'] ? true : false
+ @has_header_option = false
# smells like we need a utility method here
# to resolve an integer width from potential bogus input