Class: Coradoc::AsciiDoc::Serializer::Serializers::Header

Inherits:
Base
  • Object
show all
Defined in:
lib/coradoc/asciidoc/serializer/serializers/header.rb

Instance Method Summary collapse

Methods inherited from Base

#serialize

Instance Method Details

#to_adoc(model, _options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/coradoc/asciidoc/serializer/serializers/header.rb', line 8

def to_adoc(model, _options = {})
  # Output anchor if ID is present
  adoc = +''
  adoc << "[[#{model.id}]]\n" if model.id && !model.id.empty?
  adoc << "= #{model.title}\n"
  adoc << model.author.to_adoc if model.author
  adoc << model.revision.to_adoc if model.revision
  adoc
end