class Hamdown::MdRegs::Headers
class with logic of markdown's headers
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/headers.rb 17 def text_handler(text, scan_res) 18 scan_res = scan_res.map { |i| i[0] } 19 html_scan = scan_res.map do |i| 20 # delete whitespace character 21 s = md_to_html(i.gsub(/^\s*/, '')) 22 # delete \n at end of line 23 if s[-1..-1] == "\n" 24 s = s[0..s.size - 2] 25 end 26 s 27 end 28 scan_res.each_with_index do |str, index| 29 text.gsub!( 30 str.gsub(/^\s*/, ''), 31 html_scan[index] 32 ) 33 end 34 35 text 36 end