Class: Pslm::LatexOutputter::Formatter
- Inherits:
-
Object
- Object
- Pslm::LatexOutputter::Formatter
show all
- Defined in:
- lib/pslm/latexoutputter.rb
Overview
abstract superclass of the formatters providing dumb implementation of all formatting methods
Direct Known Subclasses
BreakHintsFormatter, FinalAddContentFormatter, LettrineFormatter, PartsFormatter, PointingFormatter, QuoteFormatter, SkipVersesFormatter, StrophesFormatter, TitleFormatter, VersesFormatter, WrapperFormatter
Class Method Summary
collapse
Instance Method Summary
collapse
-
#initialize(options) ⇒ Formatter
constructor
A new instance of Formatter.
-
#part_format(text, part, verse, strophe, psalm) ⇒ Object
-
#psalm_format(text, psalm) ⇒ Object
-
#strophe_format(text, strophe, psalm) ⇒ Object
-
#syllable_format(text, syll, word, part, verse, strophe, psalm) ⇒ Object
-
#verse_format(text, verse, strophe, psalm) ⇒ Object
-
#word_format(text, word, part, verse, strophe, psalm) ⇒ Object
Constructor Details
#initialize(options) ⇒ Formatter
Returns a new instance of Formatter.
121
122
123
124
125
126
127
|
# File 'lib/pslm/latexoutputter.rb', line 121
def initialize(options)
@options = options
@syll_counter = 0
@word_counter = 0
@part_counter = 0
@verse_counter = 0
end
|
Class Method Details
lets all the :formatters: subsequently format :text: assembled from :obj: on the assembly :level:
113
114
115
116
117
118
|
# File 'lib/pslm/latexoutputter.rb', line 113
def format(formatters, level, text, *args)
formatters.each do |f|
text = f.send("#{level}_format", text, *args)
end
return text
end
|
Instance Method Details
149
150
151
152
153
154
|
# File 'lib/pslm/latexoutputter.rb', line 149
def part_format(text, part, verse, strophe, psalm)
@part_counter += 1
@syll_counter = 0
@word_counter = 0
text
end
|
129
130
131
132
133
134
135
|
# File 'lib/pslm/latexoutputter.rb', line 129
def psalm_format(text, psalm)
@syll_counter = 0
@word_counter = 0
@part_counter = 0
@verse_counter = 0
text
end
|
137
138
139
|
# File 'lib/pslm/latexoutputter.rb', line 137
def strophe_format(text, strophe, psalm)
text
end
|
161
162
163
164
|
# File 'lib/pslm/latexoutputter.rb', line 161
def syllable_format(text, syll, word, part, verse, strophe, psalm)
@syll_counter += 1
text
end
|
141
142
143
144
145
146
147
|
# File 'lib/pslm/latexoutputter.rb', line 141
def verse_format(text, verse, strophe, psalm)
@verse_counter += 1
@syll_counter = 0
@word_counter = 0
@part_counter = 0
text
end
|
156
157
158
159
|
# File 'lib/pslm/latexoutputter.rb', line 156
def word_format(text, word, part, verse, strophe, psalm)
@word_counter += 1
text
end
|