Class: Redmine::WikiFormatting::Textile::Formatter

Inherits:
RedCloth3 show all
Includes:
ActionView::Helpers::TagHelper
Defined in:
lib/redmine/wiki_formatting/textile/formatter.rb

Constant Summary collapse

RULES =

auto_link rule after textile rules so that it doesn’t break !image_url! tags

[:textile, :block_markdown_rule, :inline_auto_link, :inline_auto_mailto]
%r{
 (                          # leading text
   <\w+.*?>|                # leading HTML tag, or
   [^=<>!:'"/]|             # leading punctuation, or 
   ^                        # beginning of line
 )
 (
   (?:https?://)|           # protocol spec, or
   (?:s?ftps?://)|
   (?:www\.)                # www.*
 )
 (
   (\S+?)                   # url
   (\/)?                    # slash
 )
 ((?:&gt;)?|[^\w\=\/;\(\)]*?)               # post
 (?=<|\s|$)
}x

Constants inherited from RedCloth3

RedCloth3::DEFAULT_RULES, RedCloth3::VERSION

Instance Attribute Summary

Attributes inherited from RedCloth3

#filter_html, #filter_styles, #hard_breaks, #lite_mode, #no_span_caps, #rules

Instance Method Summary collapse

Methods inherited from String

#parse_csv, #with_leading_slash

Methods included from CoreExtensions::String::Inflections

#with_leading_slash

Methods included from CoreExtensions::String::Conversions

#to_a, #to_hours

Methods included from Diffable

#diff, #patch, #replacenextlarger, #reverse_hash

Constructor Details

#initialize(*args) ⇒ Formatter

Returns a new instance of Formatter.



29
30
31
32
33
34
# File 'lib/redmine/wiki_formatting/textile/formatter.rb', line 29

def initialize(*args)
  super
  self.hard_breaks=true
  self.no_span_caps=true
  self.filter_styles=true
end

Instance Method Details

#to_html(*rules) ⇒ Object



36
37
38
39
# File 'lib/redmine/wiki_formatting/textile/formatter.rb', line 36

def to_html(*rules)
  @toc = []
  super(*RULES).to_s
end