class Asciidoctor::HTML5::BlockOpenTemplate

Public Instance Methods

open_block(node, id, style, role, title, content) click to toggle source
# File lib/asciidoctor/backends/html5.rb, line 531
  def open_block(node, id, style, role, title, content)
    if style == 'abstract'
      if node.parent == node.document && node.document.attr?('doctype', 'book')
        puts 'asciidoctor: WARNING: abstract block cannot be used in a document without a title when doctype is book. Excluding block content.'
        ''
      else
        %Q(<div#{id && " id=\"#{id}\""} class="quoteblock abstract#{role && " #{role}"}">#{title &&
"<div class=\"title\">#{title}</div>"}
<blockquote>
#{content}
</blockquote>
</div>\n)
      end
    elsif style == 'partintro' && (!node.document.attr?('doctype', 'book') || !node.parent.is_a?(Asciidoctor::Section) || node.level != 0)
      puts 'asciidoctor: ERROR: partintro block can only be used when doctype is book and it\s a child of a book part. Excluding block content.'
      ''
    else
      %Q(<div#{id && " id=\"#{id}\""} class="openblock#{style != 'open' ? " #{style}" : ''}#{role && " #{role}"}">#{title &&
"<div class=\"title\">#{title}</div>"}
<div class="content">
#{content}
</div>
</div>\n)
    end
  end
result(node) click to toggle source
# File lib/asciidoctor/backends/html5.rb, line 527
def result(node)
  open_block(node, node.id, (node.attr 'style', nil, false), (node.attr 'role'), node.title? ? node.title : nil, node.content)
end
template() click to toggle source
# File lib/asciidoctor/backends/html5.rb, line 557
def template
  :invoke_result
end