Class: WikiChunk::Word
- Inherits:
-
WikiLink
- Object
- Chunk::Abstract
- WikiLink
- WikiChunk::Word
- Defined in:
- app/models/chunks/wiki.rb
Overview
This chunk matches a WikiWord. WikiWords can be escaped by prepending a ‘'. When this is the case, the escaped_text
method will return the WikiWord instead of the usual nil
. The page_name
method returns the matched WikiWord.
Instance Attribute Summary collapse
-
#page_name ⇒ Object
readonly
Returns the value of attribute page_name.
Attributes inherited from Chunk::Abstract
Class Method Summary collapse
Instance Method Summary collapse
- #escaped_text ⇒ Object
-
#initialize(match_data) ⇒ Word
constructor
A new instance of Word.
- #link_text ⇒ Object
Methods inherited from WikiLink
#mask, #regexp, #revert, #unmask
Methods inherited from Chunk::Abstract
#mask, #post_mask, #pre_mask, #revert, #unmask
Constructor Details
#initialize(match_data) ⇒ Word
Returns a new instance of Word.
44 45 46 47 48 |
# File 'app/models/chunks/wiki.rb', line 44 def initialize(match_data) super(match_data) @escape = match_data[1] @page_name = match_data[2] end |
Instance Attribute Details
#page_name ⇒ Object (readonly)
Returns the value of attribute page_name.
42 43 44 |
# File 'app/models/chunks/wiki.rb', line 42 def page_name @page_name end |
Class Method Details
.pattern ⇒ Object
38 39 40 |
# File 'app/models/chunks/wiki.rb', line 38 def self.pattern Regexp.new('(\\\\)?(' + WikiWords::WIKI_WORD_PATTERN + ')\b', 0, "utf-8") end |