Class: Coradoc::CoreModel::HeaderElement

Inherits:
StructuralElement show all
Defined in:
lib/coradoc/core_model/structural_element.rb

Overview

Header / title block of a document

Instance Attribute Summary

Attributes inherited from StructuralElement

#attributes, #children, #content, #level

Attributes inherited from Base

#element_attributes, #id, #metadata_entries, #title

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from StructuralElement

#document?, #element_type, #empty_body?, #heading_level, #preamble?, #section?, #visible_children

Methods included from HasChildren

#has_children?

Methods inherited from Base

#accept, #attr, #body_content?, build, #flat_text, #metadata, #semantically_equivalent?, #set_attr, #set_metadata, #whitespace_only?

Class Method Details

.element_type_nameObject



152
153
154
# File 'lib/coradoc/core_model/structural_element.rb', line 152

def self.element_type_name
  'header'
end

Instance Method Details

#document_title?Boolean

A level-0 HeaderElement represents the document title (the ‘= Title` line in AsciiDoc, the `<h1>` in HTML). It is structurally part of the body but semantically the document’s title, not a section —section numbering, TOC builders, and other section-aware logic skip these so the title is not counted as “section 1”.

Returns:

  • (Boolean)


148
149
150
# File 'lib/coradoc/core_model/structural_element.rb', line 148

def document_title?
  level.to_i.zero?
end

#header?Boolean

Returns:

  • (Boolean)


139
140
141
# File 'lib/coradoc/core_model/structural_element.rb', line 139

def header?
  true
end