Class: Asciidoctor::Html::Converter

Inherits:
Object
  • Object
show all
Defined in:
lib/asciidoctor/html/converter.rb

Overview

A custom HTML5 converter that plays nicely with Bootstrap CSS

Instance Method Summary collapse

Instance Method Details

#convert_example(node) ⇒ Object



28
29
30
31
32
# File 'lib/asciidoctor/html/converter.rb', line 28

def convert_example(node)
  node.set_attr "reftext", Utils.title_prefix(node)
  content = Utils.display_title(node) + node.content
  Utils.wrap_node content, node
end

#convert_paragraph(node) ⇒ Object



23
24
25
26
# File 'lib/asciidoctor/html/converter.rb', line 23

def convert_paragraph(node)
  content = %(#{Utils.display_title node}<p>#{node.content}</p>)
  node.title? ? Utils.wrap_node(content, node) : "#{content}\n"
end

#convert_section(node) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/asciidoctor/html/converter.rb', line 12

def convert_section(node)
  doc_attrs = node.document.attributes
  level = node.level
  show_sectnum = node.numbered && level <= (doc_attrs["sectnumlevels"] || 3).to_i
  tag_name = %(h#{level + 1})
  sectnum = show_sectnum ? %(<span class="sec-mark">#{node.sectnum ""}</span>) : ""
  content = %(<#{tag_name}#{Utils.id_class_attr_str nil, node.role}>) +
            %(#{sectnum}#{node.title}</#{tag_name}>\n\n#{node.content})
  Utils.wrap_node content, node, :section
end