Defect #23341 » 23341.patch
| 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)
|
||
| ... | ... | |
|
tag('img', :src => link, :alt => alt_text || "", :title => title)
|
||
|
end
|
||
|
private
|
||
|
def replace_wiki_links(full_document, pattern, replacement)
|
||
|
full_document.gsub(/(\[\[([^\]\n#{pattern}]+)(#{pattern})(([^\]\n#{pattern}]+))?\]\])/) do |m|
|
||
|
all, page, separater, title = $1, $2, $3, $4
|
||
|
if page && separater && title
|
||
|
"[[#{page}#{replacement}#{title}]]"
|
||
|
else
|
||
|
all
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
class Formatter
|
||