WikiChunk::WikiLink (Class)

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.

Methods

escaped_text   mask   regexp   revert   unmask  

Public Instance methods

By default, no escaped text

[Source]

    # 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

[Source]

    # File app/models/chunks/wiki.rb, line 18
18:     def mask(content) escaped_text || pre_mask + link_text + post_mask end

[Source]

    # File app/models/chunks/wiki.rb, line 20
20:     def regexp() Regexp.new(pre_mask + '(.*)?' + post_mask) end

[Source]

    # File app/models/chunks/wiki.rb, line 22
22:     def revert(content) content.sub!(regexp, text) 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.

[Source]

    # 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

[Validate]