@@ -556,7 +556,7 module ApplicationHelper | |||
|
556 | 556 | "##{anchor}" |
|
557 | 557 | else |
|
558 | 558 | case options[:wiki_links] |
|
559 | when :local; "#{title}.html" | |
|
559 | when :local; "#{page.present? ? Wiki.titleize(page) : ''}.html" + (anchor.present? ? "##{anchor}" : '') | |
|
560 | 560 | when :anchor; "##{title}" # used for single-file wiki export |
|
561 | 561 | else |
|
562 | 562 | wiki_page_id = page.present? ? Wiki.titleize(page) : nil |
@@ -375,6 +375,26 RAW | |||
|
375 | 375 | to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) } |
|
376 | 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 | 398 | def test_html_tags |
|
379 | 399 | to_test = { |
|
380 | 400 | "<div>content</div>" => "<p><div>content</div></p>", |
General Comments 0
You need to be logged in to leave comments.
Login now