Module: Neruda::Chapter

Included in:
App
Defined in:
lib/neruda/chapter.rb

Overview

Various method to handle org conversion and metadata access

Instance Method Summary collapse

Instance Method Details

#authorObject



23
24
25
# File 'lib/neruda/chapter.rb', line 23

def author
  ('author') || Neruda::CONFIG['author']
end

#meta_data(key) ⇒ Object



5
6
7
8
9
10
# File 'lib/neruda/chapter.rb', line 5

def (key)
  return nil if @content.nil?
  value = @content.in_buffer_settings[key.upcase]
  return value if value.nil? || !key.casecmp('date').zero?
  time_for(value).strftime('%A %d %B %Y')
end

#titleObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/neruda/chapter.rb', line 12

def title
  return Neruda::CONFIG['title'] if @content.nil?
  return @title unless @title.nil?
  # We use an instance variable to avoid Orgmode::Parser to render
  # title with the rest of the file
  # Thus we are removing title from the buffer_settings
  @title = @content.in_buffer_settings.delete('TITLE')
  return @title unless @title.nil?
  @title = Neruda::CONFIG['title']
end