Class: WikiChunk::Link
- Inherits:
-
WikiLink
- Object
- Chunk::Abstract
- WikiReference
- WikiLink
- WikiChunk::Link
- Defined in:
- app/models/chunks/wiki.rb
Overview
This chunk handles [[bracketted wiki words]] and [[AliasedWords|aliased wiki words]]. The first part of an aliased wiki word must be a WikiWord. If the WikiWord is aliased, the link_text
field will contain the alias, otherwise link_text
will contain the entire contents within the double brackets.
NOTE: This chunk must be tested before WikiWord since
a WikiWords can be a substring of a WikiLink.
Constant Summary collapse
- WIKI_LINK =
/(":)?\[\[\s*([^\]\s][^\]]+?)\s*\]\]/
- LINK_TYPE_SEPARATION =
Regexp.new('^(.+):((file)|(pic))$', 0, 'utf-8')
- ALIAS_SEPARATION =
Regexp.new('^(.+)\|(.+)$', 0, 'utf-8')
Instance Attribute Summary
Attributes inherited from WikiLink
Attributes inherited from WikiReference
Attributes inherited from Chunk::Abstract
#text, #unmask_mode, #unmask_text
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(match_data, content) ⇒ Link
constructor
A new instance of Link.
Methods inherited from WikiLink
apply_to, #refpage, #textile_url?
Methods inherited from WikiReference
Methods inherited from Chunk::Abstract
apply_to, #escaped?, #id, inherited, #mask, mask_re, mask_string, #rendered?, #revert, #unmask
Constructor Details
#initialize(match_data, content) ⇒ Link
Returns a new instance of Link.
109 110 111 112 113 114 115 116 |
# File 'app/models/chunks/wiki.rb', line 109 def initialize(match_data, content) super @textile_link_suffix, @page_name = match_data[1..2] @link_text = @page_name separate_link_type separate_alias @unmask_text = @content.page_link(@page_name, @link_text, @link_type) end |
Class Method Details
.pattern ⇒ Object
107 |
# File 'app/models/chunks/wiki.rb', line 107 def self.pattern() WIKI_LINK end |