reco 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/README.md +1 -1
  2. data/lib/reco/wrapper.js +43 -0
  3. data/lib/reco.rb +1 -1
  4. metadata +2 -1
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Reco: Ruby port of the Eco template compiler.
2
2
  =============================================
3
3
 
4
- Eco is a wonderful javascript template system by [Sam Stephenson](http://twitter.com/sstephenson/). For more information about eco visit [its github page](https://github.com/sstephenson/eco).
4
+ Eco is a wonderful javascript template system by [Sam Stephenson](http://twitter.com/sstephenson/). For more information about Eco visit [its github page](https://github.com/sstephenson/eco).
5
5
 
6
6
  Reco let you compile Eco templates into Javascript through Ruby like this:
7
7
 
@@ -0,0 +1,43 @@
1
+ %{identifier} = function(__obj) {
2
+ if (!__obj) __obj = {};
3
+ var __out = [], __capture = function(callback) {
4
+ var out = __out, result;
5
+ __out = [];
6
+ callback.call(this);
7
+ result = __out.join('');
8
+ __out = out;
9
+ return __safe(result);
10
+ }, __sanitize = function(value) {
11
+ if (value && value.ecoSafe) {
12
+ return value;
13
+ } else if (typeof value !== 'undefined' && value != null) {
14
+ return __escape(value);
15
+ } else {
16
+ return '';
17
+ }
18
+ }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;
19
+ __safe = __obj.safe = function(value) {
20
+ if (value && value.ecoSafe) {
21
+ return value;
22
+ } else {
23
+ if (!(typeof value !== 'undefined' && value != null)) value = '';
24
+ var result = new String(value);
25
+ result.ecoSafe = true;
26
+ return result;
27
+ }
28
+ };
29
+ if (!__escape) {
30
+ __escape = __obj.escape = function(value) {
31
+ return ('' + value)
32
+ .replace(/&/g, '&')
33
+ .replace(/</g, '&lt;')
34
+ .replace(/>/g, '&gt;')
35
+ .replace(/\x22/g, '&quot;');
36
+ };
37
+ }
38
+ (function() {
39
+ %{compiled_javascript}
40
+ }).call(__obj);
41
+ __obj.safe = __objSafe, __obj.escape = __escape;
42
+ return __out.join('');
43
+ };
data/lib/reco.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Reco
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
 
4
4
  autoload :Compiler, "reco/compiler"
5
5
  autoload :Scanner, "reco/scanner"
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: reco
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.0
5
+ version: 0.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - "Rasmus R\xC3\xB8nn Nielsen"
@@ -40,6 +40,7 @@ files:
40
40
  - lib/reco/scanner.rb
41
41
  - lib/reco/util.rb
42
42
  - lib/reco.rb
43
+ - lib/reco/wrapper.js
43
44
  has_rdoc: true
44
45
  homepage: https://github.com/rasmusrn/reco
45
46
  licenses: []