Class: Coradoc::AsciiDoc::Model::List::Ordered

Inherits:
Core
  • Object
show all
Defined in:
lib/coradoc/asciidoc/model/list/ordered.rb

Overview

Ordered (numbered) list for AsciiDoc documents.

Ordered lists use numeric markers (1, 2, 3…) or custom markers and are typically used for sequential items.

Examples:

Create an ordered list

list = Coradoc::AsciiDoc::Model::List::Ordered.new
item = Coradoc::AsciiDoc::Model::ListItem.new
item.content = [Coradoc::AsciiDoc::Model::TextElement.new("First item")]
list.items << item

See Also:

Instance Attribute Summary

Attributes inherited from Core

#attrs, #id, #items, #marker, #ol_count

Attributes inherited from Base

#id

Instance Method Summary collapse

Methods inherited from Core

#block_level?

Methods included from Anchorable

#default_anchor, #gen_anchor, included, #initialize

Methods inherited from Base

#block_level?, #inline?, #serialize_content, #simplify_block_content, #to_adoc, #to_h, visit, #visit

Instance Method Details

#prefixString

Generate the prefix marker for this list level

Returns:

  • (String)

    The prefix marker (e.g., “.”, “..”, “…”)



25
26
27
28
29
# File 'lib/coradoc/asciidoc/model/list/ordered.rb', line 25

def prefix
  return marker if marker

  '.' * [ol_count, 1].max
end