Module: Trenni::Markup
- Included in:
- Builder, MarkupString, Tag
- Defined in:
- lib/trenni/markup.rb,
ext/trenni/trenni.c
Overview
A wrapper which indicates that ‘value` can be appended to the output buffer without any changes.
Class Method Summary collapse
-
.append(buffer, value) ⇒ Object
Appends a string to the output buffer, escaping if if necessary.
-
.escape_string(string) ⇒ String
Converts special characters ‘<`, `>`, `&`, and `“` into their equivalent entities.
- .raw(string) ⇒ Object
Class Method Details
.append(buffer, value) ⇒ Object
Appends a string to the output buffer, escaping if if necessary.
35 36 37 38 39 40 41 |
# File 'lib/trenni/markup.rb', line 35 def self.append(buffer, value) if value.is_a? Markup buffer << value elsif value buffer << self.escape_string(value.to_s) end end |
.escape_string(string) ⇒ String
Converts special characters ‘<`, `>`, `&`, and `“` into their equivalent entities.
30 31 32 |
# File 'lib/trenni/markup.rb', line 30 def self.escape_string(string) CGI.escape_html(string) end |
.raw(string) ⇒ Object
17 18 19 20 21 22 23 |
# File 'ext/trenni/escape.c', line 17
VALUE Trenni_MarkupString_raw(VALUE self, VALUE string) {
string = rb_str_dup(string);
rb_obj_reveal(string, rb_Trenni_MarkupString);
return string;
}
|