Class: WikiRedCloth

Inherits:
RedCloth
  • Object
show all
Defined in:
lib/soks-view.rb

Overview

This adds some extra match types to (a bodged version of) RedCloth

Specifically:

  • Inserting other pages

  • Square bracketed wiki links

  • Automaticlly links anytime the title of another page appears in the text

  • Automatically links things that look like email addresses and urls

Constant Summary collapse

RULES =
[:refs_soks_bracketed_link, :refs_textile, :block_textile_table, :block_textile_lists,:block_textile_prefix, :inline_textile_image, :inline_textile_link, :inline_textile_code, :inline_soks, :inline_textile_glyphs, :inline_textile_span, :refs_markdown, :block_markdown_setext, :block_markdown_atx, :block_markdown_rule, :block_markdown_bq, :block_markdown_lists, :inline_markdown_reflink, :inline_markdown_link ]

Instance Method Summary collapse

Constructor Details

#initialize(wiki, page, string, hard_breaks = false) ⇒ WikiRedCloth

Returns a new instance of WikiRedCloth.



144
145
146
147
148
149
# File 'lib/soks-view.rb', line 144

def initialize( wiki, page, string, hard_breaks = false )
	@wiki, @view, @page = wiki, wiki, page
	@internal_links_from_page = []
	super(insert_sub_strings( string.dup ),[:no_span_caps])
	self.hard_breaks = hard_breaks
end

Instance Method Details

#inline_soks(text) ⇒ Object



155
156
157
158
159
160
161
162
163
# File 'lib/soks-view.rb', line 155

def inline_soks( text )
	hide_html_links text
	hide_html_tags text 	
	inline_soks_external_link text
	inline_soks_automatic_link text
	unhide text
	@wiki.links.set_links_from( @page, @internal_links_from_page )
     text
end

#to_htmlObject



151
152
153
# File 'lib/soks-view.rb', line 151

def to_html
	super( *RULES ).to_s
end