Class: Asciidoctor::List

Inherits:
Object show all
Defined in:
lib/asciidoctor/pdf/ext/asciidoctor/list.rb

Overview

TODO: add these methods to Asciidoctor core

Instance Method Summary collapse

Instance Method Details

#list_levelObject

Get the nesting level of this list within the broader list (unordered or ordered) structure.

This method differs from the level property in that it considers only list ancestors. It’s important for selecting the marker for an unordered list.

Return the 1-based level of this list within the list structure.



18
19
20
21
22
23
24
25
26
# File 'lib/asciidoctor/pdf/ext/asciidoctor/list.rb', line 18

def list_level
  l = 1
  ancestor = self
  # FIXME: does not cross out of AsciiDoc table cell
  while (ancestor = ancestor.parent)
    l += 1 if Asciidoctor::List === ancestor && (ancestor.context == :ulist || ancestor.context == :olist)
  end
  l
end

#nested?Boolean

Check whether this list is nested inside the item of another list.

Return true if the parent of this list is a list item. Otherwise, return false.

Returns:

  • (Boolean)


8
9
10
# File 'lib/asciidoctor/pdf/ext/asciidoctor/list.rb', line 8

def nested?
  Asciidoctor::ListItem === @parent
end