Class: RedmineExtensions::HTMLFormatting::Formatter

Inherits:
String
  • Object
show all
Includes:
ActionView::Helpers::TagHelper
Defined in:
lib/redmine_extensions/html_formatting/formatter.rb

Constant Summary collapse

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

Instance Method Summary collapse

Methods inherited from String

#to_boolean

Instance Method Details

#to_html(*rules, &block) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/redmine_extensions/html_formatting/formatter.rb', line 8

def to_html(*rules, &block)
  ret = self.dup
  RULES.each do |rule_name|
    ret = (method(rule_name).call(ret) || ret)
  end
  ret
end