class Hamdown::MdRegs::Quotes
class with logic of markdown's quotes
Constants
- REGS
TODO: add '?:' to unuseful group /learn(?:bydoing)/
Private Instance Methods
text_handler(text, scan_res)
click to toggle source
# File lib/hamdown/md_regs/quotes.rb 12 def text_handler(text, scan_res) 13 # crazy manipulation 14 scan_res = scan_res.map{ |i| i[0] } 15 html_scan = scan_res.map do |i| 16 md_to_html(i) 17 end 18 scan_res.each_with_index do |str, index| 19 space_size = str.scan(/^\n( *)\>/)[0][0].size 20 html = html_scan[index] 21 .split(/\n/) 22 .select { |i| i.size > 0 } 23 .join(' ') 24 text.gsub!(str, "\n#{' ' * space_size}#{html}") 25 end 26 27 text 28 end