comparison app/helpers/application_helper.rb @ 929:5f33065ddc4b redmine-1.3

Update to Redmine SVN rev 9414 on 1.3-stable branch
author Chris Cannam
date Wed, 27 Jun 2012 14:54:18 +0100
parents cbb26bc654de
children ec1c49528f36 433d4f72a19b
comparison
equal deleted inserted replaced
909:cbb26bc654de 929:5f33065ddc4b
488 only_path = options.delete(:only_path) == false ? false : true 488 only_path = options.delete(:only_path) == false ? false : true
489 489
490 text = Redmine::WikiFormatting.to_html(Setting.text_formatting, text, :object => obj, :attribute => attr) 490 text = Redmine::WikiFormatting.to_html(Setting.text_formatting, text, :object => obj, :attribute => attr)
491 491
492 @parsed_headings = [] 492 @parsed_headings = []
493 @heading_anchors = {}
493 @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)
494 text = parse_non_pre_blocks(text) do |text| 497 text = parse_non_pre_blocks(text) do |text|
495 [:parse_sections, :parse_inline_attachments, :parse_wiki_links, :parse_redmine_links, :parse_macros, :parse_headings].each do |method_name| 498 [:parse_inline_attachments, :parse_wiki_links, :parse_redmine_links, :parse_macros].each do |method_name|
496 send method_name, text, project, obj, attr, only_path, options 499 send method_name, text, project, obj, attr, only_path, options
497 end 500 end
498 end 501 end
502 parse_headings(text, project, obj, attr, only_path, options)
499 503
500 if @parsed_headings.any? 504 if @parsed_headings.any?
501 replace_toc(text, @parsed_headings) 505 replace_toc(text, @parsed_headings)
502 end 506 end
503 507
776 level, attrs, content = $2.to_i, $3, $4 780 level, attrs, content = $2.to_i, $3, $4
777 item = strip_tags(content).strip 781 item = strip_tags(content).strip
778 anchor = sanitize_anchor_name(item) 782 anchor = sanitize_anchor_name(item)
779 # used for single-file wiki export 783 # used for single-file wiki export
780 anchor = "#{obj.page.title}_#{anchor}" if options[:wiki_links] == :anchor && (obj.is_a?(WikiContent) || obj.is_a?(WikiContent::Version)) 784 anchor = "#{obj.page.title}_#{anchor}" if options[:wiki_links] == :anchor && (obj.is_a?(WikiContent) || obj.is_a?(WikiContent::Version))
785 @heading_anchors[anchor] ||= 0
786 idx = (@heading_anchors[anchor] += 1)
787 if idx > 1
788 anchor = "#{anchor}-#{idx}"
789 end
781 @parsed_headings << [level, anchor, item] 790 @parsed_headings << [level, anchor, item]
782 "<a name=\"#{anchor}\"></a>\n<h#{level} #{attrs}>#{content}<a href=\"##{anchor}\" class=\"wiki-anchor\">&para;</a></h#{level}>" 791 "<a name=\"#{anchor}\"></a>\n<h#{level} #{attrs}>#{content}<a href=\"##{anchor}\" class=\"wiki-anchor\">&para;</a></h#{level}>"
783 end 792 end
784 end 793 end
785 794