Class: Yuzu::PostProcessors::ExcerptPostProcessor
Instance Attribute Summary
#name
Instance Method Summary
collapse
postprocessors, registry, #value
Constructor Details
5
6
7
8
|
# File 'lib/yuzu/postprocessors/excerpt.rb', line 5
def initialize
@name = :excerpt
@directive = "EXCERPT"
end
|
Instance Method Details
#match(contents) ⇒ Object
15
16
17
18
19
|
# File 'lib/yuzu/postprocessors/excerpt.rb', line 15
def match(contents)
num_paragraphs = 5
m = contents.scan(regex)
m.nil? ? "" : m[0...5].join
end
|
10
11
12
13
|
# File 'lib/yuzu/postprocessors/excerpt.rb', line 10
def regex
/<p\b[^>]*?>.*?<\/p>/n
end
|