|
|
@@ -570,6 +570,7 @@ module ApplicationHelper |
|
|
|
if page =~ /^(.+?)\#(.+)$/ |
|
|
|
page, anchor = $1, $2 |
|
|
|
end |
|
|
|
anchor = sanitize_anchor_name(anchor) if anchor.present? |
|
|
|
# check if page exists |
|
|
|
wiki_page = link_project.wiki.find_page(page) |
|
|
|
url = if anchor.present? && wiki_page.present? && (obj.is_a?(WikiContent) || obj.is_a?(WikiContent::Version)) && obj.page == wiki_page |
|
|
@@ -727,7 +728,7 @@ module ApplicationHelper |
|
|
|
text.gsub!(HEADING_RE) do |
|
|
|
level, attrs, content = $1.to_i, $2, $3 |
|
|
|
item = strip_tags(content).strip |
|
|
|
anchor = item.gsub(%r{[^\w\s\-]}, '').gsub(%r{\s+(\-+\s*)?}, '-') |
|
|
|
anchor = sanitize_anchor_name(item) |
|
|
|
# used for single-file wiki export |
|
|
|
anchor = "#{obj.page.title}_#{anchor}" if options[:wiki_links] == :anchor && (obj.is_a?(WikiContent) || obj.is_a?(WikiContent::Version)) |
|
|
|
@parsed_headings << [level, anchor, item] |
|
|
@@ -919,6 +920,10 @@ module ApplicationHelper |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
def sanitize_anchor_name(anchor) |
|
|
|
anchor.gsub(%r{[^\w\s\-]}, '').gsub(%r{\s+(\-+\s*)?}, '-') |
|
|
|
end |
|
|
|
|
|
|
|
# Returns the javascript tags that are included in the html layout head |
|
|
|
def javascript_heads |
|
|
|
tags = javascript_include_tag(:defaults) |