Class: Avm::EacAsciidoctorBase0::Instances::Build::Document::HeaderLines

Inherits:
Object
  • Object
show all
Defined in:
lib/avm/eac_asciidoctor_base0/instances/build/document/header_lines.rb

Constant Summary collapse

ATTRIBUTES =
['Author Initials', 'toc', 'icons', 'numbered', 'source-highlighter',
'website'].freeze
TOC =
'left'
ICONS =
''
NUMBERED =
''
SOURCE_HIGHLIGHTER =
'rouge'

Instance Method Summary collapse

Instance Method Details

#attribute_line(name, value) ⇒ String



28
29
30
# File 'lib/avm/eac_asciidoctor_base0/instances/build/document/header_lines.rb', line 28

def attribute_line(name, value)
  [":#{name}:", value].compact_blank.join(' ')
end

#attribute_value(attr) ⇒ Object



36
37
38
# File 'lib/avm/eac_asciidoctor_base0/instances/build/document/header_lines.rb', line 36

def attribute_value(attr)
  setting_value(attr.variableize)
end

#attributes_linesObject



32
33
34
# File 'lib/avm/eac_asciidoctor_base0/instances/build/document/header_lines.rb', line 32

def attributes_lines
  ATTRIBUTES.map { |attr| attribute_line(attr, attribute_value(attr)) }
end

#author_initialsObject



40
41
42
# File 'lib/avm/eac_asciidoctor_base0/instances/build/document/header_lines.rb', line 40

def author_initials
  instance.author_name_initials
end

#author_lineObject



44
45
46
# File 'lib/avm/eac_asciidoctor_base0/instances/build/document/header_lines.rb', line 44

def author_line
  "#{author_name} <#{author_email}>"
end


49
50
51
# File 'lib/avm/eac_asciidoctor_base0/instances/build/document/header_lines.rb', line 49

def breadcrumbs_lines
  ['[.normal]', document.macro_lines(:breadcrumbs)]
end

#relative_path_to_stylesheetPathname



60
61
62
63
# File 'lib/avm/eac_asciidoctor_base0/instances/build/document/header_lines.rb', line 60

def relative_path_to_stylesheet
  build.theme.target_stylesheet_path
    .relative_path_from(document.body_target_path.dirname)
end

#resultArray<String>



54
55
56
57
# File 'lib/avm/eac_asciidoctor_base0/instances/build/document/header_lines.rb', line 54

def result
  [stylesheet_line, title_line, author_line] + attributes_lines + [''] +
    breadcrumbs_lines
end

#stylesheet_lineString



66
67
68
# File 'lib/avm/eac_asciidoctor_base0/instances/build/document/header_lines.rb', line 66

def stylesheet_line
  attribute_line('stylesheet', stylesheet_path)
end

#title_lineString



71
72
73
# File 'lib/avm/eac_asciidoctor_base0/instances/build/document/header_lines.rb', line 71

def title_line
  "= #{source_document.title}"
end

#websiteObject



75
76
77
# File 'lib/avm/eac_asciidoctor_base0/instances/build/document/header_lines.rb', line 75

def website
  instance.web_url
end