Class: TextLiteral
- Defined in:
- lib/emerald/nodes/text_literal.rb
Overview
A long block of text literal, with variable templating
Instance Method Summary collapse
Instance Method Details
#to_html(context) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/emerald/nodes/text_literal.rb', line 9 def to_html(context) body .elements .map do |element| if element.is_a?(Variable) element.to_html(context) else unescape element.text_value end end .join('') .rstrip end |
#unescape(text) ⇒ Object
23 24 25 |
# File 'lib/emerald/nodes/text_literal.rb', line 23 def unescape(text) text.gsub(/\\(.)/, '\1') end |