class Asciidoctor::HTML5::SectionTemplate

def result(sec)

def result(sec)
  slevel = sec.level
  # QUESTION should this check be done in section?
  if slevel == 0 && sec.special
    slevel = 1
  end
  htag = "h#{slevel + 1}"
  id = anchor = link_start = link_end = nil
  if sec.id
    id = %( id="#{sec.id}")
    if sec.document.attr? 'sectanchors'
      #if sec.document.attr? 'icons', 'font'
      #  anchor = %(<a class="anchor" href="##{sec.id}"><i class="icon-anchor"></i></a>)
      #else
        anchor = %(<a class="anchor" href="##{sec.id}"></a>)
      #end
    elsif sec.document.attr? 'sectlinks'
      link_start = %(<a class="link" href="##{sec.id}">)
      link_end = '</a>'
    end
  end
  if slevel == 0
    %(<h1#{id} class="sect0">#{anchor}#{link_start}#{sec.title}#{link_end}</h1>
sec.content}\n)
  else
    role = (sec.attr? 'role') ? " #{sec.attr 'role'}" : nil
    if !sec.special && (sec.document.attr? 'numbered') && slevel < 4
      sectnum = "#{sec.sectnum} "
    else
      sectnum = nil
    end
    if slevel == 1
      content = %(<div class="sectionbody">
sec.content}
div>)
    else
      content = sec.content
    end
    %(<div class="sect#{slevel}#{role}">
{htag}#{id}>#{anchor}#{link_start}#{sectnum}#{sec.caption}#{sec.title}#{link_end}</#{htag}>
content}
div>\n)
  end
end

def template

def template
  :invoke_result
end