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