Skip to content

Commit

Permalink
Bumped version, reminified, added test for single quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
quirkey committed Jun 8, 2009
1 parent 30c4167 commit b708761
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Rakefile
@@ -1,7 +1,7 @@
desc 'Pulls the current version from lib/sammy.js'
task :version do
f = File.read('lib/sammy.js')
@version = f.match(/Sammy.VERSION \= \'([\d\.]+)\'/)[1]
@version = f.match(/Sammy.VERSION \= \'([\d\w\.]+)\'/)[1]
puts "VERSION: " + @version
end

Expand Down
3 changes: 2 additions & 1 deletion lib/sammy.js
Expand Up @@ -61,6 +61,7 @@
// Convert the template into pure JavaScript
template
.replace(/[\r\t\n]/g, " ")
// .replace(/\'/g,'\\\'')
.split("<%").join("\t")
.replace(/((^|%>)[^\t]*)'/g, "$1\r")
.replace(/\t=(.*?)%>/g, "',$1,'")
Expand All @@ -85,7 +86,7 @@

Sammy = {};

Sammy.VERSION = '0.1.4';
Sammy.VERSION = '0.2.0pre';

// == Sammy.Object
//
Expand Down
6 changes: 3 additions & 3 deletions lib/sammy.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions test/test_sammy_event_context.js
Expand Up @@ -101,6 +101,10 @@
this.context.blurgh = 'boosh';
var rendered = this.context.template('<div class="test_class"><%= text %> <%= blurgh %></div>', {text: 'TEXT!'});
equals(rendered, '<div class="test_class">TEXT! boosh</div>');
})
.should('render templates with a lot of single quotes', function() {
var rendered = this.context.template("<div class='test_class' id='test'>I'm <%= text %></div>", {text: 'TEXT!'});
equals(rendered, "<div class='test_class' id='test'>I'm TEXT!</div>");
});


Expand Down

0 comments on commit b708761

Please sign in to comment.