Class: Pslm::LatexOutputter::StrophesFormatter

Inherits:
Formatter
  • Object
show all
Defined in:
lib/pslm/latexoutputter.rb

Constant Summary collapse

END_MARKS =
{
  :semantic => '\psalmStrophe',
  :simple => '\hspace*{0pt}\hfill--'
}

Instance Method Summary collapse

Methods inherited from Formatter

format, #part_format, #psalm_format, #strophe_format, #syllable_format, #word_format

Constructor Details

#initialize(options) ⇒ StrophesFormatter

Returns a new instance of StrophesFormatter.



299
300
301
302
303
304
# File 'lib/pslm/latexoutputter.rb', line 299

def initialize(options)
  super
  @options[:paragraph_space] ||= false
  @options[:end_marks] ||= false
  @options[:mark_last_strophe] ||= false
end

Instance Method Details

#verse_format(text, verse, strophe, psalm) ⇒ Object



306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# File 'lib/pslm/latexoutputter.rb', line 306

def verse_format(text, verse, strophe, psalm)
  if strophe == psalm.strophes.last and not @options[:mark_last_strophe] then
    return text
  end
  if verse != strophe.verses.last then
    return text
  end

  if @options[:end_marks] then
    text += END_MARKS[@options[:end_marks]]
  end
  if @options[:paragraph_space] then
    text += '\\'
  end
  return text
end