@@ -492,11 +492,14 module ApplicationHelper | |||||
492 | @parsed_headings = [] |
|
492 | @parsed_headings = [] | |
493 | @heading_anchors = {} |
|
493 | @heading_anchors = {} | |
494 | @current_section = 0 if options[:edit_section_links] |
|
494 | @current_section = 0 if options[:edit_section_links] | |
|
495 | ||||
|
496 | parse_sections(text, project, obj, attr, only_path, options) | |||
495 | text = parse_non_pre_blocks(text) do |text| |
|
497 | text = parse_non_pre_blocks(text) do |text| | |
496 |
[ |
|
498 | [:parse_inline_attachments, :parse_wiki_links, :parse_redmine_links, :parse_macros].each do |method_name| | |
497 | send method_name, text, project, obj, attr, only_path, options |
|
499 | send method_name, text, project, obj, attr, only_path, options | |
498 | end |
|
500 | end | |
499 | end |
|
501 | end | |
|
502 | parse_headings(text, project, obj, attr, only_path, options) | |||
500 |
|
503 | |||
501 | if @parsed_headings.any? |
|
504 | if @parsed_headings.any? | |
502 | replace_toc(text, @parsed_headings) |
|
505 | replace_toc(text, @parsed_headings) |
@@ -732,6 +732,8 some code | |||||
732 |
|
732 | |||
733 | h3. Subtitle with *some* _modifiers_ |
|
733 | h3. Subtitle with *some* _modifiers_ | |
734 |
|
734 | |||
|
735 | h3. Subtitle with @inline code@ | |||
|
736 | ||||
735 | h1. Another title |
|
737 | h1. Another title | |
736 |
|
738 | |||
737 | h3. An "Internet link":http://www.redmine.org/ inside subtitle |
|
739 | h3. An "Internet link":http://www.redmine.org/ inside subtitle | |
@@ -748,6 +750,7 RAW | |||||
748 | '<li><a href="#Subtitle-with-red-text">Subtitle with red text</a>' + |
|
750 | '<li><a href="#Subtitle-with-red-text">Subtitle with red text</a>' + | |
749 | '<ul>' + |
|
751 | '<ul>' + | |
750 | '<li><a href="#Subtitle-with-some-modifiers">Subtitle with some modifiers</a></li>' + |
|
752 | '<li><a href="#Subtitle-with-some-modifiers">Subtitle with some modifiers</a></li>' + | |
|
753 | '<li><a href="#Subtitle-with-inline-code">Subtitle with inline code</a></li>' + | |||
751 | '</ul>' + |
|
754 | '</ul>' + | |
752 | '</li>' + |
|
755 | '</li>' + | |
753 | '</ul>' + |
|
756 | '</ul>' + | |
@@ -813,6 +816,48 RAW | |||||
813 | assert textilizable(raw).gsub("\n", "").include?(expected) |
|
816 | assert textilizable(raw).gsub("\n", "").include?(expected) | |
814 | end |
|
817 | end | |
815 |
|
818 | |||
|
819 | def test_section_edit_links | |||
|
820 | raw = <<-RAW | |||
|
821 | h1. Title | |||
|
822 | ||||
|
823 | Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sed libero. | |||
|
824 | ||||
|
825 | h2. Subtitle with a [[Wiki]] link | |||
|
826 | ||||
|
827 | h2. Subtitle with *some* _modifiers_ | |||
|
828 | ||||
|
829 | h2. Subtitle with @inline code@ | |||
|
830 | ||||
|
831 | <pre> | |||
|
832 | some code | |||
|
833 | ||||
|
834 | h2. heading inside pre | |||
|
835 | ||||
|
836 | <h2>html heading inside pre</h2> | |||
|
837 | </pre> | |||
|
838 | ||||
|
839 | h2. Subtitle after pre tag | |||
|
840 | RAW | |||
|
841 | ||||
|
842 | @project = Project.find(1) | |||
|
843 | set_language_if_valid 'en' | |||
|
844 | result = textilizable(raw, :edit_section_links => {:controller => 'wiki', :action => 'edit', :project_id => '1', :id => 'Test'}).gsub("\n", "") | |||
|
845 | ||||
|
846 | # heading that contains inline code | |||
|
847 | assert_match Regexp.new('<div class="contextual" title="Edit this section">' + | |||
|
848 | '<a href="/projects/1/wiki/Test/edit\?section=4"><img alt="Edit" src="/images/edit.png(\?\d+)?" /></a></div>' + | |||
|
849 | '<a name="Subtitle-with-inline-code"></a>' + | |||
|
850 | '<h2 >Subtitle with <code>inline code</code><a href="#Subtitle-with-inline-code" class="wiki-anchor">¶</a></h2>'), | |||
|
851 | result | |||
|
852 | ||||
|
853 | # last heading | |||
|
854 | assert_match Regexp.new('<div class="contextual" title="Edit this section">' + | |||
|
855 | '<a href="/projects/1/wiki/Test/edit\?section=5"><img alt="Edit" src="/images/edit.png(\?\d+)?" /></a></div>' + | |||
|
856 | '<a name="Subtitle-after-pre-tag"></a>' + | |||
|
857 | '<h2 >Subtitle after pre tag<a href="#Subtitle-after-pre-tag" class="wiki-anchor">¶</a></h2>'), | |||
|
858 | result | |||
|
859 | end | |||
|
860 | ||||
816 | def test_default_formatter |
|
861 | def test_default_formatter | |
817 | Setting.text_formatting = 'unknown' |
|
862 | Setting.text_formatting = 'unknown' | |
818 | text = 'a *link*: http://www.example.net/' |
|
863 | text = 'a *link*: http://www.example.net/' |
General Comments 0
You need to be logged in to leave comments.
Login now