Class: NoWiki

Inherits:
Chunk::Abstract show all
Defined in:
app/models/chunks/nowiki.rb

Overview

This chunks allows certain parts of a wiki page to be hidden from the rest of the rendering pipeline. It should be run at the beginning of the pipeline in ‘wiki_content.rb`.

An example use of this chunk is to markup double brackets or auto URI links:

<nowiki>Here are [[double brackets]] and a URI: www.uri.org</nowiki>

The contents of the chunks will not be processed by any other chunk so the ‘www.uri.org` and the double brackets will appear verbatim.

Author: Mark Reid <mark at threewordslong dot com> Created: 8th June 2004

Instance Attribute Summary collapse

Attributes inherited from Chunk::Abstract

#text

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Chunk::Abstract

#mask, #post_mask, #pre_mask

Constructor Details

#initialize(match_data) ⇒ NoWiki

Returns a new instance of NoWiki.



22
23
24
25
# File 'app/models/chunks/nowiki.rb', line 22

def initialize(match_data)
	super(match_data)
	@plain_text = match_data[1]
end

Instance Attribute Details

#plain_textObject (readonly)

Returns the value of attribute plain_text.



20
21
22
# File 'app/models/chunks/nowiki.rb', line 20

def plain_text
  @plain_text
end

Class Method Details

.patternObject



18
# File 'app/models/chunks/nowiki.rb', line 18

def self.pattern() Regexp.new('<nowiki>(.*?)</nowiki>') end

Instance Method Details

#revert(content) ⇒ Object



30
# File 'app/models/chunks/nowiki.rb', line 30

def revert(content) content.sub!( Regexp.new(mask(content)), plain_text ) end

#unmask(content) ⇒ Object

The nowiki content is not unmasked. This means the chunk will be reverted using the plain text.



29
# File 'app/models/chunks/nowiki.rb', line 29

def unmask(content) nil end