diff options
| author | Jordi Sola <someth2say@gmail.com> | 2024-04-18 18:22:23 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-18 19:22:23 +0300 |
| commit | 2070c4cc22a6fb0e8a6f25378d2ea731f769b6fb (patch) | |
| tree | c681b59b9409de80a4c387dd1daff27ec64dc2a8 | |
| parent | bbbaee9a38336c4a7e626904392238b65ae2ae79 (diff) | |
feat: :sparkles: Honour roles for items in olists and ulists (#469)
| -rw-r--r-- | lib/asciidoctor-epub3/converter.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/asciidoctor-epub3/converter.rb b/lib/asciidoctor-epub3/converter.rb index 1466956..0492daf 100644 --- a/lib/asciidoctor-epub3/converter.rb +++ b/lib/asciidoctor-epub3/converter.rb @@ -952,7 +952,9 @@ document.addEventListener('DOMContentLoaded', function(event, reader) { lines << %(<h3 class="list-heading">#{node.title}</h3>) if node.title? lines << %(<ol#{ol_class_attr}#{ol_start_attr}#{node.option?('reversed') ? ' reversed="reversed"' : ''}>) node.items.each do |item| - lines << %(<li> + li_classes = [item.style, item.role].compact + li_class_attr = li_classes.empty? ? '' : %( class="#{li_classes * ' '}") + lines << %(<li#{li_class_attr}> <span class="principal">#{item.text}</span>) if item.blocks? lines << item.content @@ -979,7 +981,9 @@ document.addEventListener('DOMContentLoaded', function(event, reader) { lines << %(<h3 class="list-heading">#{node.title}</h3>) if node.title? lines << %(<ul#{ul_class_attr}>) node.items.each do |item| - lines << %(<li> + li_classes = [item.style, item.role].compact + li_class_attr = li_classes.empty? ? '' : %( class="#{li_classes * ' '}") + lines << %(<li#{li_class_attr}> <span class="principal">#{item.text}</span>) if item.blocks? lines << item.content |
