trenni 1.4.3 → 1.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +4 -0
- data/README.md +7 -3
- data/lib/trenni/template.rb +2 -2
- data/lib/trenni/version.rb +1 -1
- data/spec/trenni/template_spec.rb +2 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 216efe70504b121ea181eb3de5e24978db147f7e
|
4
|
+
data.tar.gz: fe495f4698096e743427e8b1860cf214ba8d5ce8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f18a0a7bc9a13a81289d6f14188812759e645a5cdea3f9d4a8ecaa6dcfad2da6f71679f032482b176b8ff494396e0914b8b84326f470daa1aebefe91160de918
|
7
|
+
data.tar.gz: dc5079d20186b3800de81560c6932a6a0ff23b5f084e0ea0d2f3e958742859390fa040be47560521e3cbbf0f0d3648833914929a4c61b0b5323cdb86c9bdf0bb
|
data/.rspec
ADDED
data/README.md
CHANGED
@@ -32,11 +32,11 @@ Or install it yourself as:
|
|
32
32
|
Trenni templates work essentially the same way as all other templating systems:
|
33
33
|
|
34
34
|
template = Trenni::Template.new('<?r items.each do |item| ?>#{item}<?r end ?>')
|
35
|
-
|
35
|
+
|
36
36
|
items = 1..4
|
37
|
-
|
37
|
+
|
38
38
|
template.to_string(binding) # => "1234"
|
39
|
-
|
39
|
+
|
40
40
|
The code above demonstrate the only two constructs, `<?r expression ?>` and `#{output}`.
|
41
41
|
|
42
42
|
Trenni provides a slightly higher performance API using objects rather than bindings. If you provide an object instance, `instance_eval` would be used instead.
|
@@ -58,6 +58,10 @@ Trenni can help construct XML/HTML using a simple DSL:
|
|
58
58
|
end
|
59
59
|
# => "<p><strong>Hello</strong> World</p>\n<script type=\"text/html\">\n\tconsole.log(\"Hello World\")\n</script>"
|
60
60
|
|
61
|
+
### Integration
|
62
|
+
|
63
|
+
There is a [language-trenni](https://atom.io/packages/language-trenni) package for the [Atom text editor](https://atom.io). It provides syntax highlighting and integration when Trenni is used with the [utopia web framework](https://github.com/ioquatix/utopia).
|
64
|
+
|
61
65
|
## Contributing
|
62
66
|
|
63
67
|
1. Fork it
|
data/lib/trenni/template.rb
CHANGED
@@ -31,7 +31,7 @@ module Trenni
|
|
31
31
|
out = eval(OUT, block.binding)
|
32
32
|
top = out.size
|
33
33
|
|
34
|
-
block.call
|
34
|
+
block.call(*args)
|
35
35
|
|
36
36
|
return out.pop(out.size - top).join
|
37
37
|
end
|
@@ -65,7 +65,7 @@ module Trenni
|
|
65
65
|
def code
|
66
66
|
parts = ["#{OUT} = [] ; "] + @parts + ["#{OUT}"]
|
67
67
|
|
68
|
-
|
68
|
+
return parts.join
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
data/lib/trenni/version.rb
CHANGED
@@ -29,8 +29,9 @@ module Trenni::TemplateSpec
|
|
29
29
|
describe Trenni::Template do
|
30
30
|
it "should process list of items" do
|
31
31
|
template = Trenni::Template.new('<?r items.each do |item| ?>#{item}<?r end ?>')
|
32
|
-
|
32
|
+
|
33
33
|
items = 1..4
|
34
|
+
|
34
35
|
expect(template.to_string(binding)).to be == "1234"
|
35
36
|
end
|
36
37
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trenni
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -63,6 +63,7 @@ extensions: []
|
|
63
63
|
extra_rdoc_files: []
|
64
64
|
files:
|
65
65
|
- ".gitignore"
|
66
|
+
- ".rspec"
|
66
67
|
- ".simplecov"
|
67
68
|
- ".travis.yml"
|
68
69
|
- Gemfile
|