Class: Include

Inherits:
WikiChunk::WikiReference show all
Defined in:
app/models/chunks/include.rb

Overview

Includes the contents of another page for rendering. The include command looks like this: “[[!include PageName]]”. It is a WikiReference since it refers to another page (PageName) and the wiki content using this command must be notified of changes to that page. If the included page could not be found, a warning is displayed.

Constant Summary collapse

INCLUDE_PATTERN =
/\[\[!include\s+(.*?)\]\]\s*/i

Instance Attribute Summary

Attributes inherited from WikiChunk::WikiReference

#page_name

Attributes inherited from Chunk::Abstract

#text, #unmask_mode, #unmask_text

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from WikiChunk::WikiReference

#refpage

Methods inherited from Chunk::Abstract

apply_to, #escaped?, #id, inherited, #mask, mask_re, mask_string, #rendered?, #revert, #unmask

Constructor Details

#initialize(match_data, content) ⇒ Include

Returns a new instance of Include.



16
17
18
19
20
# File 'app/models/chunks/include.rb', line 16

def initialize(match_data, content)
  super
  @page_name = match_data[1].strip
  @unmask_text = get_unmask_text_avoiding_recursion_loops
end

Class Method Details

.patternObject



13
# File 'app/models/chunks/include.rb', line 13

def self.pattern() INCLUDE_PATTERN end