diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2021-10-28 23:57:26 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-28 23:57:26 -0600 |
| commit | fcfa4964dc05c5743476bb9a225154e2d6a00a50 (patch) | |
| tree | b457a6e3fe93ccdf1723ab9416bd2c075d3fdca5 | |
| parent | 71a1ced057bafd1f5515c9d876a45312ec9a44ce (diff) | |
resolves #4101 add support for role on thematic break to HTML converter (PR #4196)
| -rw-r--r-- | CHANGELOG.adoc | 1 | ||||
| -rw-r--r-- | lib/asciidoctor/converter/html5.rb | 3 | ||||
| -rw-r--r-- | test/blocks_test.rb | 10 |
3 files changed, 13 insertions, 1 deletions
diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 4a81cdb4..92baab56 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -25,6 +25,7 @@ Enhancements:: * Allow section ID to be unset by assigning an empty value to the `id` block attribute (#4139) * Add support for dropping principal text of list item if empty in an ordered or unordered list when converting to man page (#4182) * Don't add empty line before block content if principal text of dlist item is not specified when converting to man page (#4182) + * Add support for role on thematic break in HTML converter (#4101) Compliance:: diff --git a/lib/asciidoctor/converter/html5.rb b/lib/asciidoctor/converter/html5.rb index 4056fb96..891ec6ce 100644 --- a/lib/asciidoctor/converter/html5.rb +++ b/lib/asciidoctor/converter/html5.rb @@ -839,7 +839,8 @@ Your browser does not support the audio tag. end def convert_thematic_break node - %(<hr#{@void_element_slash}>) + class_attribute = node.role ? %( class="#{node.role}") : '' + %(<hr#{class_attribute}#{@void_element_slash}>) end def convert_sidebar node diff --git a/test/blocks_test.rb b/test/blocks_test.rb index d5e86d73..a6953d37 100644 --- a/test/blocks_test.rb +++ b/test/blocks_test.rb @@ -61,6 +61,16 @@ context 'Blocks' do assert_xpath '/hr/following-sibling::*', output, 1 end + test 'horizontal rule with role' do + input = <<~'EOS' + [.fancy] + ''' + EOS + output = convert_string_to_embedded input + assert_css 'hr', output, 1 + assert_css 'hr.fancy', output, 1 + end + test 'page break' do output = convert_string_to_embedded %(page 1\n\n<<<\n\npage 2) assert_xpath '/*[@class="page-break"]', output, 1 |
