-
+
-
+
foo
+
+
bar
+diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 9ae4be5..145a2a8 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -10,6 +10,10 @@ For a detailed view of what has changed, refer to the {url-repo}/commits/main[co * Repurpose example block as open block if filetype is not html +=== Fixed + +* Preserve attribute entries above tabs block (#64) + == 1.0.0-beta.5 (2023-05-28) - @mojavelinux === Changed diff --git a/lib/asciidoctor/tabs/block.rb b/lib/asciidoctor/tabs/block.rb index a6b9fba..274041e 100644 --- a/lib/asciidoctor/tabs/block.rb +++ b/lib/asciidoctor/tabs/block.rb @@ -18,7 +18,9 @@ def process parent, reader, attrs tabs_role = 'tabs' + (!(block.option? 'nosync') && ((block.option? 'sync') || (doc.option? 'tabs-sync')) ? ((gid = attrs['sync-group-id']) ? %( is-sync data-sync-group-id=#{gid.gsub ' ', ?\u00a0}) : ' is-sync') : '') tabs_role += (tabs_user_role = attrs['role']) ? %( #{tabs_user_role} is-loading) : ' is-loading' - (tabs = create_open_block parent, nil, { 'id' => tabs_id, 'role' => tabs_role }).title = attrs['title'] + tabs_attrs = { 'id' => tabs_id, 'role' => tabs_role } + tabs_attrs[:attribute_entries] = attrs[:attribute_entries] if attrs.key? :attribute_entries + (tabs = create_open_block parent, nil, tabs_attrs).title = attrs['title'] tablist = create_list parent, :ulist, { 'role' => 'tablist' } panes = {} set_id_on_tab = (doc.backend == 'html5') || (list_item_supports_id? doc) diff --git a/spec/tabs_spec.rb b/spec/tabs_spec.rb index d5b0dfb..288cf02 100644 --- a/spec/tabs_spec.rb +++ b/spec/tabs_spec.rb @@ -230,6 +230,47 @@ (expect actual).to eql expected end + it 'should preserve attribute entries above tabs block' do + input = <<~'END' + before + + :foo: bar + + [tabs] + ==== + foo:: {foo} + ==== + END + expected = <<~'END'.chomp +
before
+foo
+bar
+