Class: Asciidoctor::List

Inherits:
Object
  • Object
show all
Defined in:
lib/asciidoctor/latex/node_processors.rb

Overview

Write TeX itemize or enumerate lists for ulist and olist. Recurses for nested lists.

Instance Method Summary (collapse)

Instance Method Details

- (Object) dlist_process



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# File 'lib/asciidoctor/latex/node_processors.rb', line 221

def dlist_process
  list = "\\begin{description}\n\n"
  self.items.each do |terms, dd|
    list << "\\item["
    [*terms].each do |dt|
    # warn ["  --  item: ".blue, "#{dt.text}"].join(" ") if $VERBOSE
      list << dt.text
    end
    list << "]"
    if dd
      list << dd.text << "\n\n" if dd.text?
      list << dd.content << "\n" if dd.blocks?
    end
  end
  list << "\\end{description}\n\n"
end

- (Object) olist_process



247
248
249
250
251
252
253
254
# File 'lib/asciidoctor/latex/node_processors.rb', line 247

def olist_process
  list = "\\begin{enumerate}\n\n"
  self.content.each do |item|
    list << item.text.macro('item') << "\n\n"
    list << item.content
  end
  list << "\\end{enumerate}\n\n"
end

- (Object) tex_process



208
209
210
211
212
213
214
215
216
217
218
219
# File 'lib/asciidoctor/latex/node_processors.rb', line 208

def tex_process
  case self.node_name
  when 'dlist'
    dlist_process
  when 'ulist'
    ulist_process
  when 'olist'
    olist_process
  else
    # warn "This Asciidoctor::List, tex_process.  I don't know how to do that (#{self.node_name})" if $VERBOSE
  end
end

- (Object) ulist_process



238
239
240
241
242
243
244
245
# File 'lib/asciidoctor/latex/node_processors.rb', line 238

def ulist_process
  list = "\\begin{itemize}\n\n"
  self.content.each do |item|
    list << "\\item #{item.text}\n\n"
    list << item.content
  end
  list << "\\end{itemize}\n\n"
end