##// END OF EJS Templates
Faster textile table parsing by using a single scan instead of a regexp matching for each cell (#18883)....
Jean-Philippe Lang -
r13536:b7b1f640798a
parent child
Show More
@@ -529,13 +529,13 class RedCloth3 < String
529 fullrow.each_line do |row|
529 fullrow.each_line do |row|
530 ratts, row = pba( $1, 'tr' ), $2 if row =~ /^(#{A}#{C}\. )(.*)/m
530 ratts, row = pba( $1, 'tr' ), $2 if row =~ /^(#{A}#{C}\. )(.*)/m
531 cells = []
531 cells = []
532 row.split( /(\|)(?![^\[\|]*\]\])/ )[1..-2].each do |cell|
532 # the regexp prevents wiki links with a | from being cut as cells
533 next if cell == '|'
533 row.scan(/\|(_?#{S}#{A}#{C}\. ?)?((\[\[[^|\]]*\|[^|\]]*\]\]|[^|])*?)(?=\|)/) do |modifiers, cell|
534 ctyp = 'd'
534 ctyp = 'd'
535 ctyp = 'h' if cell =~ /^_/
535 ctyp = 'h' if modifiers && modifiers =~ /^_/
536
536
537 catts = nil
537 catts = nil
538 catts, cell = pba( $1, 'td' ), $2 if cell =~ /^(_?#{S}#{A}#{C}\. ?)(.*)/
538 catts = pba( modifiers, 'td' ) if modifiers
539
539
540 catts = shelve( catts ) if catts
540 catts = shelve( catts ) if catts
541 cells << "\t\t\t<t#{ ctyp }#{ catts }>#{ cell }</t#{ ctyp }>"
541 cells << "\t\t\t<t#{ ctyp }#{ catts }>#{ cell }</t#{ ctyp }>"
General Comments 0
You need to be logged in to leave comments. Login now