@@ -883,12 +883,12 module ApplicationHelper | |||||
883 | def parse_sections(text, project, obj, attr, only_path, options) |
|
883 | def parse_sections(text, project, obj, attr, only_path, options) | |
884 | return unless options[:edit_section_links] |
|
884 | return unless options[:edit_section_links] | |
885 | text.gsub!(HEADING_RE) do |
|
885 | text.gsub!(HEADING_RE) do | |
886 | heading = $1 |
|
886 | heading, level = $1, $2 | |
887 | @current_section += 1 |
|
887 | @current_section += 1 | |
888 | if @current_section > 1 |
|
888 | if @current_section > 1 | |
889 | content_tag('div', |
|
889 | content_tag('div', | |
890 | link_to(image_tag('edit.png'), options[:edit_section_links].merge(:section => @current_section)), |
|
890 | link_to(image_tag('edit.png'), options[:edit_section_links].merge(:section => @current_section)), | |
891 |
:class => |
|
891 | :class => "contextual heading-#{level}", | |
892 | :title => l(:button_edit_section), |
|
892 | :title => l(:button_edit_section), | |
893 | :id => "section-#{@current_section}") + heading.html_safe |
|
893 | :id => "section-#{@current_section}") + heading.html_safe | |
894 | else |
|
894 | else |
@@ -1242,14 +1242,14 RAW | |||||
1242 | result = textilizable(raw, :edit_section_links => {:controller => 'wiki', :action => 'edit', :project_id => '1', :id => 'Test'}).gsub("\n", "") |
|
1242 | result = textilizable(raw, :edit_section_links => {:controller => 'wiki', :action => 'edit', :project_id => '1', :id => 'Test'}).gsub("\n", "") | |
1243 |
|
1243 | |||
1244 | # heading that contains inline code |
|
1244 | # heading that contains inline code | |
1245 | assert_match Regexp.new('<div class="contextual" title="Edit this section" id="section-4">' + |
|
1245 | assert_match Regexp.new('<div class="contextual heading-2" title="Edit this section" id="section-4">' + | |
1246 | '<a href="/projects/1/wiki/Test/edit\?section=4"><img src="/images/edit.png(\?\d+)?" alt="Edit" /></a></div>' + |
|
1246 | '<a href="/projects/1/wiki/Test/edit\?section=4"><img src="/images/edit.png(\?\d+)?" alt="Edit" /></a></div>' + | |
1247 | '<a name="Subtitle-with-inline-code"></a>' + |
|
1247 | '<a name="Subtitle-with-inline-code"></a>' + | |
1248 | '<h2 >Subtitle with <code>inline code</code><a href="#Subtitle-with-inline-code" class="wiki-anchor">¶</a></h2>'), |
|
1248 | '<h2 >Subtitle with <code>inline code</code><a href="#Subtitle-with-inline-code" class="wiki-anchor">¶</a></h2>'), | |
1249 | result |
|
1249 | result | |
1250 |
|
1250 | |||
1251 | # last heading |
|
1251 | # last heading | |
1252 | assert_match Regexp.new('<div class="contextual" title="Edit this section" id="section-5">' + |
|
1252 | assert_match Regexp.new('<div class="contextual heading-2" title="Edit this section" id="section-5">' + | |
1253 | '<a href="/projects/1/wiki/Test/edit\?section=5"><img src="/images/edit.png(\?\d+)?" alt="Edit" /></a></div>' + |
|
1253 | '<a href="/projects/1/wiki/Test/edit\?section=5"><img src="/images/edit.png(\?\d+)?" alt="Edit" /></a></div>' + | |
1254 | '<a name="Subtitle-after-pre-tag"></a>' + |
|
1254 | '<a name="Subtitle-after-pre-tag"></a>' + | |
1255 | '<h2 >Subtitle after pre tag<a href="#Subtitle-after-pre-tag" class="wiki-anchor">¶</a></h2>'), |
|
1255 | '<h2 >Subtitle after pre tag<a href="#Subtitle-after-pre-tag" class="wiki-anchor">¶</a></h2>'), |
General Comments 0
You need to be logged in to leave comments.
Login now