Project

General

Profile

Defect #23341 » 23341-fixed-regexp.patch

Martin Cizek, 2019-08-01 16:11

View differences:

lib/redmine/wiki_formatting/markdown/formatter.rb
include ActionView::Helpers::TagHelper
include Redmine::Helpers::URL
def preprocess(full_document)
replace_wiki_links(full_document, '\|', '|')
end
def postprocess(full_document)
replace_wiki_links(full_document, '|', '|')
end
def link(link, title, content)
return nil unless uri_with_safe_scheme?(link)
......
content_tag('a', content.to_s.html_safe, :href => link, :title => title, :class => css)
end
def replace_wiki_links(full_document, pattern, replacement)
full_document.gsub(/(\[\[(((?![\]\n]|#{pattern}).)+)(#{pattern})(((?![\]\n]|#{pattern}).)+)\]\])/) do |m|
all, page, separater, title = $1, $2, $4, $5
if page && separater && title
"[[#{page}#{replacement}#{title}]]"
else
all
end
end
end
def block_code(code, language)
if language.present? && Redmine::SyntaxHighlighting.language_supported?(language)
"<pre><code class=\"#{CGI.escapeHTML language} syntaxhl\">" +
(3-3/3)