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

Inherits:
RedCloth3 show all
Defined in:
lib/redmine/wiki_formatting/textile/formatter.rb

Constant Summary

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, :inline_toc, :inline_macros]
MACROS_RE =
/
  (!)?                        # escaping
  (
  \{\{                        # opening tag
  ([\w]+)                     # macro name
  (\(([^\}]*)\))?             # optional arguments
  \}\}                        # closing tag
  )
/x
%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
 )
 ([^\w\=\/;\(\)]*?)               # post
 (?=<|\s|$)
}x

Constants inherited from RedCloth3

RedCloth3::A, RedCloth3::ALLOWED_TAGS, RedCloth3::ALLTAG_MATCH, RedCloth3::ATX_RE, RedCloth3::A_HLGN, RedCloth3::A_VLGN, RedCloth3::BASIC_TAGS, RedCloth3::BLOCKS_GROUP_RE, RedCloth3::BLOCK_RE, RedCloth3::C, RedCloth3::CODE_RE, RedCloth3::C_CLAS, RedCloth3::C_LNGE, RedCloth3::C_STYL, RedCloth3::DEFAULT_RULES, RedCloth3::GLYPHS, RedCloth3::HASTAG_MATCH, RedCloth3::HYPERLINK, RedCloth3::H_ALGN_VALS, RedCloth3::IMAGE_RE, RedCloth3::LINK_RE, RedCloth3::LISTS_CONTENT_RE, RedCloth3::LISTS_RE, RedCloth3::MARKDOWN_BQ_RE, RedCloth3::MARKDOWN_LINK_RE, RedCloth3::MARKDOWN_REFLINK_RE, RedCloth3::MARKDOWN_REFS_RE, RedCloth3::MARKDOWN_RULE_RE, RedCloth3::OFFTAGS, RedCloth3::OFFTAG_CLOSE, RedCloth3::OFFTAG_MATCH, RedCloth3::OFFTAG_OPEN, RedCloth3::PUNCT, RedCloth3::PUNCT_NOQ, RedCloth3::PUNCT_Q, RedCloth3::QTAGS, RedCloth3::QUOTES_CONTENT_RE, RedCloth3::QUOTES_RE, RedCloth3::S, RedCloth3::SETEXT_RE, RedCloth3::SIMPLE_HTML_TAGS, RedCloth3::S_CSPN, RedCloth3::S_RSPN, RedCloth3::TABLE_RE, RedCloth3::TEXTILE_REFS_RE, RedCloth3::TEXTILE_TAGS, RedCloth3::VERSION, RedCloth3::V_ALGN_VALS

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

#with_leading_slash

Methods included from CoreExtensions::String::Conversions

#to_hours

Methods included from Diffable

#diff, #patch, #replacenextlarger, #reverse_hash

Constructor Details

- (Formatter) initialize(*args)

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

- (Object) to_html(*rules, &block)



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

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