Skip to content

Commit

Permalink
Revert "Various optimizations"
Browse files Browse the repository at this point in the history
This reverts commit 15c99cd.
  • Loading branch information
minad committed May 21, 2016
1 parent 6d9d64a commit 6af08b9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
15 changes: 9 additions & 6 deletions lib/temple/erb/parser.rb
Expand Up @@ -12,12 +12,15 @@ def call(input)
input.scan(ERB_PATTERN) do |token, indicator, code|
text = input[pos...$~.begin(0)]
pos = $~.end(0)
if token == "\n"
result << [:static, "#{text}\n"] << [:newline]
elsif token # <%% | %%>
result << [:static, text] unless text.empty?
token.slice!(1)
result << [:static, token]
if token
case token
when "\n"
result << [:static, "#{text}\n"] << [:newline]
when '<%%', '%%>'
result << [:static, text] unless text.empty?
token.slice!(1)
result << [:static, token]
end
else
result << [:static, text] unless text.empty?
case indicator
Expand Down
8 changes: 1 addition & 7 deletions lib/temple/utils.rb
Expand Up @@ -55,13 +55,7 @@ def escape_html(html)
# @param html [String] The string to escape
# @return [String] The escaped string
def escape_html(html)
if html.nil?
''.freeze
else
result = html.to_s
result.gsub!(ESCAPE_HTML_PATTERN, ESCAPE_HTML)
result
end
html.to_s.gsub(ESCAPE_HTML_PATTERN, ESCAPE_HTML)
end
end

Expand Down

0 comments on commit 6af08b9

Please sign in to comment.