Class: Content::Pipeline::Filters::Blockquote
Constant Summary
collapse
- XPaths =
[
".//blockquote/p[1][starts-with(text(), 'By ')]",
".//blockquote/p[1][starts-with(text(), 'From ')]"
]
Instance Method Summary
collapse
add_filter, #initialize, #run
Instance Method Details
#blockquotes ⇒ Object
11
12
13
14
15
16
17
18
|
# File 'lib/content/pipeline/filters/blockquote.rb', line 11
def blockquotes
@str = @str.to_nokogiri_fragment
@str.xpath(XPaths.join(" | ")).each do |v|
v.replace(parse_blockquote(
v.inner_html
))
end
end
|
#parse_blockquote(text) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/content/pipeline/filters/blockquote.rb', line 20
def parse_blockquote(text)
text = text.each_line.to_a
text[0] = " <header class=\"cite\">\n \#{text[0]}\n </header>\n \#{\n if text[1..-1].any?\n <<-HTML\n <p>\n \#{text[1..-1].join(\n \"\\n\"\n )}\n </p>\n HTML\n end\n }\n HTML\nend\n"
|