Class: Trenni::MarkupString
- Inherits:
-
String
- Object
- String
- Trenni::MarkupString
- Includes:
- Markup
- Defined in:
- lib/trenni/markup.rb
Overview
Initialized from text which is escaped to use HTML entities.
Constant Summary collapse
- ESCAPE =
This is only casually related to HTML, it’s just enough so that it would not be mis-interpreted by ‘Trenni::Parser`.
Substitutions.new("&" => "&", "<" => "<", ">" => ">", "\"" => """)
Constants included from Markup
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(string = nil, escape = true) ⇒ MarkupString
constructor
Convert ESCAPE characters into their corresponding entities.
Methods included from Markup
Constructor Details
#initialize(string = nil, escape = true) ⇒ MarkupString
Convert ESCAPE characters into their corresponding entities.
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/trenni/markup.rb', line 51 def initialize(string = nil, escape = true) if string super(string) # self.replace CGI.escapeHTML(self) ESCAPE.gsub!(self) if escape else super() end end |
Class Method Details
.raw(string) ⇒ Object
62 63 64 |
# File 'lib/trenni/markup.rb', line 62 def self.raw(string) self.new(string, false) end |