Method: RedClothForTex#span

Defined in:
lib/redcloth_for_tex.rb

#span(text) ⇒ Object



422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
# File 'lib/redcloth_for_tex.rb', line 422

def span( text ) 
    QTAGS.each do |tt, ht|
      ttr = Regexp::quote( tt )
      text.gsub!( 
                 
                 /(^|\s|\>|[#{PUNCT}{(\[])
                   #{ttr}
                    (#{C})
                     (?::(\S+?))?
                      ([^\s#{ttr}]+?(?:[^\n]|\n(?!\n))*?)
                       ([#{PUNCT}]*?)
                       #{ttr}
                        (?=[\])}]|[#{PUNCT}]+?|<|\s|$)/xm 
    
    ) do |m|
      
      start,atts,cite,content,tend = $~[1..5]
      atts = pba( atts )
      atts << " cite=\"#{ cite }\"" if cite
      
              "#{ start }{\\#{ ht } #{ content }#{ tend }}"
      
    end
  end
end