##// END OF EJS Templates
Fix generation of blank local link when no title is specified in wiki link....
Etienne Massip -
r7440:ac2dbde135f7
parent child
Show More
@@ -576,7 +576,7 module ApplicationHelper
576 "##{anchor}"
576 "##{anchor}"
577 else
577 else
578 case options[:wiki_links]
578 case options[:wiki_links]
579 when :local; "#{title}.html"
579 when :local; "#{page.present? ? Wiki.titleize(page) : ''}.html" + (anchor.present? ? "##{anchor}" : '')
580 when :anchor; "##{title}" # used for single-file wiki export
580 when :anchor; "##{title}" # used for single-file wiki export
581 else
581 else
582 wiki_page_id = page.present? ? Wiki.titleize(page) : nil
582 wiki_page_id = page.present? ? Wiki.titleize(page) : nil
@@ -375,6 +375,26 RAW
375 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
375 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
376 end
376 end
377
377
378 def test_wiki_links_within_local_file_generation_context
379
380 to_test = {
381 # link to a page
382 '[[CookBook documentation]]' => '<a href="CookBook_documentation.html" class="wiki-page">CookBook documentation</a>',
383 '[[CookBook documentation|documentation]]' => '<a href="CookBook_documentation.html" class="wiki-page">documentation</a>',
384 '[[CookBook documentation#One-section]]' => '<a href="CookBook_documentation.html#One-section" class="wiki-page">CookBook documentation</a>',
385 '[[CookBook documentation#One-section|documentation]]' => '<a href="CookBook_documentation.html#One-section" class="wiki-page">documentation</a>',
386 # page that doesn't exist
387 '[[Unknown page]]' => '<a href="Unknown_page.html" class="wiki-page new">Unknown page</a>',
388 '[[Unknown page|404]]' => '<a href="Unknown_page.html" class="wiki-page new">404</a>',
389 '[[Unknown page#anchor]]' => '<a href="Unknown_page.html#anchor" class="wiki-page new">Unknown page</a>',
390 '[[Unknown page#anchor|404]]' => '<a href="Unknown_page.html#anchor" class="wiki-page new">404</a>',
391 }
392
393 @project = Project.find(1)
394
395 to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text, :wiki_links => :local) }
396 end
397
378 def test_html_tags
398 def test_html_tags
379 to_test = {
399 to_test = {
380 "<div>content</div>" => "<p>&lt;div&gt;content&lt;/div&gt;</p>",
400 "<div>content</div>" => "<p>&lt;div&gt;content&lt;/div&gt;</p>",
General Comments 0
You need to be logged in to leave comments. Login now