diff options
| -rw-r--r-- | README.adoc | 3 | ||||
| -rw-r--r-- | compat/asciidoc.conf | 3 | ||||
| -rwxr-xr-x | lib/asciidoctor.rb | 7 | ||||
| -rw-r--r-- | lib/asciidoctor/backends/html5.rb | 5 |
4 files changed, 16 insertions, 2 deletions
diff --git a/README.adoc b/README.adoc index 409bcd3c..935770ae 100644 --- a/README.adoc +++ b/README.adoc @@ -237,6 +237,9 @@ Here are the known cases where Asciidoctor differs from AsciiDoc: quotes are rarely needed, though you may want to keep them for compatibility) +* Asciidoctor adds the type attribute on ordered lists to provide hint + for numbering style when stylesheet is absent (such as in embedded mode) + * Asciidoctor recognizes +opts+ as an alias for the +options+ attribute. * Asciidoctor creates xref labels using the text from the linked section diff --git a/compat/asciidoc.conf b/compat/asciidoc.conf index bb5fc416..3a2c2f5f 100644 --- a/compat/asciidoc.conf +++ b/compat/asciidoc.conf @@ -71,6 +71,9 @@ monospaced=<code{1? class="{1}"}>|</code> [monospacedwords] <code>{words}</code> +[listtags-numbered] +list=<div class="olist{style? {style}}{compact-option? compact}{role? {role}}"{id? id="{id}"}>{title?<div class="title">{title}</div>}<ol class="{style}"{style@loweralpha: type="a"}{style@lowerroman: type="i"}{style@upperalpha: type="A"}{style@upperroman: type="I"}{start? start="{start}"}>|</ol></div> + [tabletags-monospaced] paragraph=<p class="tableblock"><code>|</code></p> diff --git a/lib/asciidoctor.rb b/lib/asciidoctor.rb index c305dad8..85850955 100755 --- a/lib/asciidoctor.rb +++ b/lib/asciidoctor.rb @@ -182,6 +182,13 @@ module Asciidoctor :upperroman => /[IVX]+\)/ } + ORDERED_LIST_KEYWORDS = { + 'loweralpha' => 'a', + 'lowerroman' => 'i', + 'upperalpha' => 'A', + 'upperroman' => 'I' + } + LIST_CONTINUATION = '+' LINE_BREAK = ' +' diff --git a/lib/asciidoctor/backends/html5.rb b/lib/asciidoctor/backends/html5.rb index 3a1b426f..c063e82f 100644 --- a/lib/asciidoctor/backends/html5.rb +++ b/lib/asciidoctor/backends/html5.rb @@ -625,11 +625,12 @@ class BlockUlistTemplate < BaseTemplate end class BlockOlistTemplate < BaseTemplate + def template @template ||= @eruby.new <<-EOS -<%#encoding:UTF-8%><div#{id} class="olist#{style_class}#{role_class}"> +<%#encoding:UTF-8%><% style = attr 'style', nil, false %><div#{id} class="olist#{style_class}#{role_class}"> #{title_div} - <ol class="<%= attr 'style', nil, false %>"#{attribute('start', :start)}> + <ol class="<%= style %>"<%= (type = ::Asciidoctor::ORDERED_LIST_KEYWORDS[style]) ? %( type="\#{type}") : nil %>#{attribute('start', :start)}> <% content.each do |item| %> <li> <p><%= item.text %></p> |
