Feature #6269 ยป basic_redcloth4_support.diff
lib/redmine/wiki_formatting/textile/formatter.rb | ||
---|---|---|
15 | 15 |
# along with this program; if not, write to the Free Software |
16 | 16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
17 | 17 | |
18 |
require 'redcloth3'
|
|
18 |
require 'redcloth' |
|
19 | 19 | |
20 | 20 |
module Redmine |
21 | 21 |
module WikiFormatting |
22 | 22 |
module Textile |
23 |
class Formatter < RedCloth3
|
|
23 |
class Formatter < RedCloth::TextileDoc
|
|
24 | 24 |
include ActionView::Helpers::TagHelper |
25 | 25 |
|
26 | 26 |
# auto_link rule after textile rules so that it doesn't break !image_url! tags |
... | ... | |
31 | 31 |
self.hard_breaks=true |
32 | 32 |
self.no_span_caps=true |
33 | 33 |
self.filter_styles=true |
34 |
self.filter_html=true |
|
34 | 35 |
end |
35 | 36 |
|
36 | 37 |
def to_html(*rules) |
... | ... | |
38 | 39 |
super(*RULES).to_s |
39 | 40 |
end |
40 | 41 |
|
41 |
private
|
|
42 |
protected
|
|
42 | 43 |
|
43 | 44 |
# Patch for RedCloth. Fixed in RedCloth r128 but _why hasn't released it yet. |
44 | 45 |
# <a href="http://code.whytheluckystiff.net/redcloth/changeset/128">http://code.whytheluckystiff.net/redcloth/changeset/128</a> |
... | ... | |
66 | 67 |
# removes wiki links from the item |
67 | 68 |
toc_item = content.gsub(/(\[\[([^\]\|]*)(\|([^\]]*))?\]\])/) { $4 || $2 } |
68 | 69 |
# sanitizes titles from links |
69 |
# see redcloth3.rb, same as "#{pre}#{text}#{post}"
|
|
70 |
# see redcloth, same as "#{pre}#{text}#{post}" |
|
70 | 71 |
toc_item.gsub!(LINK_RE) { [$2, $4, $9].join } |
71 | 72 |
# sanitizes image links from titles |
72 | 73 |
toc_item.gsub!(IMAGE_RE) { [$5].join } |