Module: MCMarkdown::Formatter::Blockquote
- Included in:
- Base
- Defined in:
- lib/mc_markdown/formatters/blockquote.rb
Constant Summary collapse
- BLOCK_QUOTE_PATTERN =
/(?<!>\n) (^>\s[^>].+)/x
Instance Method Summary collapse
Instance Method Details
#block_quote(quote) ⇒ Object
30 31 32 33 34 |
# File 'lib/mc_markdown/formatters/blockquote.rb', line 30 def block_quote quote quote = quote.strip.gsub( "<p>{{break_quote}} ", '</blockquote><blockquote><p>').gsub(/\n/, '') "<blockquote>" << quote << "</blockquote>" end |
#postprocess(doc) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/mc_markdown/formatters/blockquote.rb', line 20 def postprocess doc doc.gsub! "\n<p>{{break_quote}}</p>", "" if defined?(super) return super(doc) else return doc end end |
#preprocess(doc) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/mc_markdown/formatters/blockquote.rb', line 8 def preprocess doc doc.gsub!(BLOCK_QUOTE_PATTERN) do |match| match.prepend "\n{{break_quote}}\n" end if defined?(super) return super(doc) else return doc end end |