| In: |
app/models/chunks/wiki.rb
|
| Parent: | Chunk::Abstract |
A wiki link is the top-level class for anything that refers to another wiki page.
By default, no escaped text
# File app/models/chunks/wiki.rb, line 14
14: def escaped_text() nil end
Delimit the link text with markers to replace later unless the word is escaped. In that case, just return the link text
# File app/models/chunks/wiki.rb, line 18
18: def mask(content) escaped_text || pre_mask + link_text + post_mask end
# File app/models/chunks/wiki.rb, line 20
20: def regexp() Regexp.new(pre_mask + '(.*)?' + post_mask) end
Do not keep this chunk if it is escaped. Otherwise, pass the link procedure a page_name and link_text and get back a string of HTML to replace the mask with.
# File app/models/chunks/wiki.rb, line 27
27: def unmask(content)
28: return nil if escaped_text
29: return self if content.sub!(regexp) { |match| content.page_link(page_name, $1) }
30: end