diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-02-18 11:31:46 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-02-18 11:31:46 +0000 |
commit | f2450b8dde3fe82ea868d83698b34548ccc418b9 (patch) | |
tree | 502a0f21b9b33b5fd3af7784c19c3e1c73d73e30 | |
parent | f2732bc9427a23badf95fe45ca60fd1de65dbad1 (diff) | |
download | redmine-f2450b8dde3fe82ea868d83698b34548ccc418b9.tar.gz redmine-f2450b8dde3fe82ea868d83698b34548ccc418b9.zip |
Merged r13913, r13918 and r13919 (#18883).
git-svn-id: http://svn.redmine.org/redmine/branches/2.6-stable@14019 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | lib/redcloth3.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/redcloth3.rb b/lib/redcloth3.rb index 032e8bd67..31a558799 100644 --- a/lib/redcloth3.rb +++ b/lib/redcloth3.rb @@ -529,13 +529,13 @@ class RedCloth3 < String fullrow.each_line do |row| ratts, row = pba( $1, 'tr' ), $2 if row =~ /^(#{A}#{C}\. )(.*)/m cells = [] - row.split( /(\|)(?![^\[\|]*\]\])/ )[1..-2].each do |cell| - next if cell == '|' + # the regexp prevents wiki links with a | from being cut as cells + row.scan(/\|(_?#{S}#{A}#{C}\. ?)?((\[\[[^|\]]*\|[^|\]]*\]\]|[^|])*?)(?=\|)/) do |modifiers, cell| ctyp = 'd' - ctyp = 'h' if cell =~ /^_/ + ctyp = 'h' if modifiers && modifiers =~ /^_/ - catts = '' - catts, cell = pba( $1, 'td' ), $2 if cell =~ /^(_?#{S}#{A}#{C}\. ?)(.*)/ + catts = nil + catts = pba( modifiers, 'td' ) if modifiers catts = shelve( catts ) if catts cells << "\t\t\t<t#{ ctyp }#{ catts }>#{ cell }</t#{ ctyp }>" @@ -986,8 +986,8 @@ class RedCloth3 < String end def retrieve( text ) - @shelf.each_with_index do |r, i| - text.gsub!( " :redsh##{ i + 1 }:", r ) + text.gsub!(/ :redsh#(\d+):/) do + @shelf[$1.to_i - 1] || $& end end |