##// END OF EJS Templates
Wiki links:...
Jean-Philippe Lang -
r1265:35a14cbfdc9f
parent child
Show More
@@ -239,7 +239,7 module ApplicationHelper
239 239 # [[project:|mytext]]
240 240 # [[project:mypage]]
241 241 # [[project:mypage|mytext]]
242 text = text.gsub(/(!)?(\[\[([^\]\|]+)(\|([^\]\|]+))?\]\])/) do |m|
242 text = text.gsub(/(!)?(\[\[([^\]\n\|]+)(\|([^\]\n\|]+))?\]\])/) do |m|
243 243 link_project = project
244 244 esc, all, page, title = $1, $2, $3, $5
245 245 if esc.nil?
@@ -510,7 +510,8 class RedCloth < String
510 510 ratts, row = pba( $1, 'tr' ), $2 if row =~ /^(#{A}#{C}\. )(.*)/m
511 511
512 512 cells = []
513 row.split( '|' ).each do |cell|
513 #row.split( /\(?!\[\[[^\]])|(?![^\[]\]\])/ ).each do |cell|
514 row.split( /\|(?![^\[\|]*\]\])/ ).each do |cell|
514 515 ctyp = 'd'
515 516 ctyp = 'h' if cell =~ /^_/
516 517
@@ -142,7 +142,21 class ApplicationHelperTest < HelperTestCase
142 142 "<pre><div>content</div></pre>" => "<pre>&lt;div&gt;content&lt;/div&gt;</pre>",
143 143 }
144 144 to_test.each { |text, result| assert_equal result, textilizable(text) }
145
145 end
146
147 def test_wiki_links_in_tables
148 to_test = {"|Cell 11|Cell 12|Cell 13|\n|Cell 21|Cell 22||\n|Cell 31||Cell 33|" =>
149 '<tr><td>Cell 11</td><td>Cell 12</td><td>Cell 13</td></tr>' +
150 '<tr><td>Cell 21</td><td>Cell 22</td></tr>' +
151 '<tr><td>Cell 31</td><td>Cell 33</td></tr>',
152
153 "|[[Page|Link title]]|[[Other Page|Other title]]|\n|Cell 21|[[Last page]]|" =>
154 '<tr><td><a href="/wiki/ecookbook/Page" class="wiki-page new">Link title</a></td>' +
155 '<td><a href="/wiki/ecookbook/Other_Page" class="wiki-page new">Other title</a></td>' +
156 '</tr><tr><td>Cell 21</td><td><a href="/wiki/ecookbook/Last_page" class="wiki-page new">Last page</a></td></tr>'
157 }
158 @project = Project.find(1)
159 to_test.each { |text, result| assert_equal "<table>#{result}</table>", textilizable(text).gsub(/[\t\n]/, '') }
146 160 end
147 161
148 162 def test_macro_hello_world
General Comments 0
You need to be logged in to leave comments. Login now