Class: Infoboxer::Tree::Text

Inherits:
Node
  • Object
show all
Defined in:
lib/infoboxer/tree/text.rb

Overview

Represents plain text node.

Think of it like this: if you have paragraph

Some paragraph with ''italic'' and [wikilink].

...then it will be parsed as a sequence of [Text, Italic, Text, Wikilink, Text].

Instance Attribute Summary collapse

Attributes inherited from Node

#params, #parent

Instance Method Summary collapse

Methods inherited from Node

#==, #children, coder, def_readers, #index, #inspect, #next_siblings, #prev_siblings, #siblings, #text_, #to_s

Methods included from Navigation::Sections::Node

#in_sections

Methods included from Navigation::Shortcuts::Node

#bold?, #categories, #external_links, #heading?, #headings, #images, #infobox, #infoboxes, #italic?, #lists, #paragraphs, #tables, #templates, #wikilinks

Methods included from Navigation::Lookup::Node

#_lookup, #_lookup_children, #_lookup_next_siblings, #_lookup_parents, #_lookup_prev_siblings, #_lookup_siblings, #_matches?, #has_parent?, #lookup, #lookup_children, #lookup_next_siblings, #lookup_parents, #lookup_prev_siblings, #lookup_siblings, #matches?

Constructor Details

#initialize(text, params = {}) ⇒ Text

Returns a new instance of Text.



17
18
19
20
# File 'lib/infoboxer/tree/text.rb', line 17

def initialize(text, params = {})
  super(params)
  @raw_text = text
end

Instance Attribute Details

#raw_textObject

Text fragment without decodint of HTML entities.



15
16
17
# File 'lib/infoboxer/tree/text.rb', line 15

def raw_text
  @raw_text
end

Instance Method Details

#textObject

See Node#text



23
24
25
# File 'lib/infoboxer/tree/text.rb', line 23

def text
  @text ||= decode(@raw_text)
end

#to_tree(level = 0) ⇒ Object



28
29
30
# File 'lib/infoboxer/tree/text.rb', line 28

def to_tree(level = 0)
  "#{indent(level)}#{text} <#{descr}>\n"
end