module Temple::Utils

def empty_exp?(exp)

def empty_exp?(exp)
  case exp[0]
  when :multi
    exp[1..-1].all? {|e| empty_exp?(e) }
  when :newline
    true
  else
    false
  end
end

def escape_html(html)

Other tags:
    Api: - public

Returns:
  • (String) - The escaped string

Parameters:
  • html (String) -- The string to escape
def escape_html(html)
  EscapeUtils.escape_html(html.to_s)
end

def escape_html(html)

Other tags:
    Api: - public

Returns:
  • (String) - The escaped string

Parameters:
  • html (String) -- The string to escape
def escape_html(html)
  html.to_s.gsub(/[&\"<>\/]/, ESCAPE_HTML)
end

def escape_html(html)

Other tags:
    Api: - public

Returns:
  • (String) - The escaped string

Parameters:
  • html (String) -- The string to escape
def escape_html(html)
  html.to_s.gsub(/&/n, '&amp;').gsub(/\"/n, '&quot;').gsub(/>/n, '&gt;').gsub(/</n, '&lt;').gsub(/\//, '&#47;')
end

def escape_html_safe(html)

Other tags:
    Api: - public

Returns:
  • (String) - The escaped string

Parameters:
  • html (String) -- The string to escape
def escape_html_safe(html)
  html.html_safe? ? html : escape_html(html)
end

def indent(text, indent, pre_tags)

def indent(text, indent, pre_tags)
  pre_tags =~ text ? text : text.gsub("\n", indent)
end