Skip to content

Commit

Permalink
latest haml 3.1 update
Browse files Browse the repository at this point in the history
  • Loading branch information
cail committed Jun 15, 2012
1 parent aee9de6 commit 09668e1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions init.rb
Expand Up @@ -69,25 +69,25 @@ def have_translation(key)
#
# Inject translate into plain text and tag plain text calls
#
def push_plain(text)
def plain(text)
if have_translation(text)
push_script "translate('#{text.gsub(/'/, '\\\'')}')"
script "translate('#{text.gsub(/'/, '\\\'')}')"
else
super(text)
end
end

def parse_tag(line)
tag_name, attributes, attributes_hash, object_ref, nuke_outer_whitespace,
nuke_inner_whitespace, action, value = super(line)
tag_name, attributes, attributes_hashes, object_ref, nuke_outer_whitespace,
nuke_inner_whitespace, action, value, last_line = super(line)

if !action and !value.empty? and have_translation(value)
action = '='
value = "translate('#{value.gsub(/'/, '\\\'')}')"
end

[tag_name, attributes, attributes_hash, object_ref, nuke_outer_whitespace,
nuke_inner_whitespace, action, value]
[tag_name, attributes, attributes_hashes, object_ref, nuke_outer_whitespace,
nuke_inner_whitespace, action, value, last_line]
end
end
end

0 comments on commit 09668e1

Please sign in to comment.