curly-templates 1.0.0rc1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +17 -15
- data/curly-templates.gemspec +2 -3
- data/lib/curly.rb +1 -1
- data/lib/curly/compiler.rb +5 -1
- metadata +21 -22
- data/lib/curly/invalid_block_error.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c6776520ae424f8f845a888ea934f20656e652a
|
4
|
+
data.tar.gz: 7f5130ecae48ef5293c6f7c9688e203efe5ed9a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed594473b873e31367e7c738a16e071d3b3f487b6755382c9c72ac940efcdaac4050f55390be8b1a1b58b92746a1247374b3533f32d21334f74065bc30c2fefa
|
7
|
+
data.tar.gz: a425716b8c05ef9c194d1aaa3c4b7ea531303f67d6bd4a4eddff88116aa222f426832e70b9fc84801ae75c874213e63a3f477bec6aa9a736186c21135aa9b5c7
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
### Unreleased
|
2
2
|
|
3
|
+
### Curly 1.0.0rc1 (February 18, 2014)
|
4
|
+
|
5
|
+
* Add support for conditional blocks:
|
6
|
+
|
7
|
+
```
|
8
|
+
{{#admin?}}
|
9
|
+
Hello!
|
10
|
+
{{/admin?}}
|
11
|
+
```
|
12
|
+
|
13
|
+
*Jeremy Rodi*
|
14
|
+
|
3
15
|
### Curly 0.12.0 (December 3, 2013)
|
4
16
|
|
5
17
|
* Allow Curly to output Curly syntax by using the `{{{ ... }}` syntax:
|
data/README.md
CHANGED
@@ -16,18 +16,8 @@ or [Handlebars](http://handlebarsjs.com/), Curly is different in some key ways:
|
|
16
16
|
languages like [Liquid](http://liquidmarkup.org/).
|
17
17
|
- Instead of implementing its own template resolution mechanism, Curly hooks
|
18
18
|
directly into Rails, leveraging the existing resolvers.
|
19
|
-
- Because of
|
20
|
-
|
21
|
-
when integrating with Rails, it is common to return Hash objects from view
|
22
|
-
object methods that are in turn used by the template.
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
### Is it ready to use in production?
|
27
|
-
|
28
|
-
Yes! While still a young project, it's being used in a rather large Rails app
|
29
|
-
at Zendesk, where it performs admirably.
|
30
|
-
|
19
|
+
- Because of its close integration with Rails, with Curly you can easily set
|
20
|
+
up caching for your views and partials.
|
31
21
|
|
32
22
|
|
33
23
|
### Table of Contents
|
@@ -75,7 +65,7 @@ Add some HTML to the partial template along with some Curly variables:
|
|
75
65
|
{{body}}
|
76
66
|
|
77
67
|
{{#author?}}
|
78
|
-
<
|
68
|
+
<p>{{deletion_link}}</p>
|
79
69
|
{{/author?}}
|
80
70
|
</div>
|
81
71
|
```
|
@@ -93,7 +83,11 @@ class Posts::CommentPresenter < Curly::Presenter
|
|
93
83
|
end
|
94
84
|
|
95
85
|
def author_link
|
96
|
-
link_to
|
86
|
+
link_to @comment.author.name, @comment.author, rel: "author"
|
87
|
+
end
|
88
|
+
|
89
|
+
def deletion_link
|
90
|
+
link_to "Delete", @comment, method: :delete
|
97
91
|
end
|
98
92
|
|
99
93
|
def time_ago
|
@@ -222,7 +216,8 @@ use `yield` to signal that content can be inserted. Curly works just like ERB, s
|
|
222
216
|
will make it try to read a content block with the given name:
|
223
217
|
|
224
218
|
```ruby
|
225
|
-
# Given you have the following Curly template in
|
219
|
+
# Given you have the following Curly template in
|
220
|
+
# app/views/layouts/application.html.curly
|
226
221
|
#
|
227
222
|
# <html>
|
228
223
|
# <head>
|
@@ -420,6 +415,13 @@ Thanks
|
|
420
415
|
Thanks to [Zendesk](http://zendesk.com/) for sponsoring the work on Curly.
|
421
416
|
|
422
417
|
|
418
|
+
### Contributors
|
419
|
+
|
420
|
+
- Daniel Schierbeck ([@dasch](https://github.com/dasch))
|
421
|
+
- Benjamin Quorning ([@bquorning](https://github.com/bquorning))
|
422
|
+
- Jeremy Rodi ([@redjazz96](https://github.com/redjazz96))
|
423
|
+
|
424
|
+
|
423
425
|
Build Status
|
424
426
|
------------
|
425
427
|
|
data/curly-templates.gemspec
CHANGED
@@ -4,8 +4,8 @@ Gem::Specification.new do |s|
|
|
4
4
|
s.rubygems_version = '1.3.5'
|
5
5
|
|
6
6
|
s.name = 'curly-templates'
|
7
|
-
s.version = '1.0.
|
8
|
-
s.date = '2014-
|
7
|
+
s.version = '1.0.0'
|
8
|
+
s.date = '2014-03-12'
|
9
9
|
|
10
10
|
s.summary = "Free your views!"
|
11
11
|
s.description = "A view layer for your Rails apps that separates structure and logic."
|
@@ -42,7 +42,6 @@ Gem::Specification.new do |s|
|
|
42
42
|
lib/curly/error.rb
|
43
43
|
lib/curly/incomplete_block_error.rb
|
44
44
|
lib/curly/incorrect_ending_error.rb
|
45
|
-
lib/curly/invalid_block_error.rb
|
46
45
|
lib/curly/invalid_reference.rb
|
47
46
|
lib/curly/presenter.rb
|
48
47
|
lib/curly/railtie.rb
|
data/lib/curly.rb
CHANGED
data/lib/curly/compiler.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'curly/scanner'
|
2
2
|
require 'curly/error'
|
3
3
|
require 'curly/invalid_reference'
|
4
|
-
require 'curly/invalid_block_error'
|
5
4
|
require 'curly/incorrect_ending_error'
|
6
5
|
require 'curly/incomplete_block_error'
|
7
6
|
|
@@ -18,6 +17,11 @@ module Curly
|
|
18
17
|
# template - The template String that should be compiled.
|
19
18
|
# presenter_class - The presenter Class.
|
20
19
|
#
|
20
|
+
# Raises InvalidReference if the template contains a reference that is not
|
21
|
+
# allowed.
|
22
|
+
# Raises IncorrectEndingError if a conditional block is not ended in the
|
23
|
+
# correct order - the most recent block must be ended first.
|
24
|
+
# Raises IncompleteBlockError if a block is not completed.
|
21
25
|
# Returns a String containing the Ruby code.
|
22
26
|
def self.compile(template, presenter_class)
|
23
27
|
new(template, presenter_class).compile
|
metadata
CHANGED
@@ -1,95 +1,95 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: curly-templates
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Schierbeck
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.1'
|
20
|
-
- - <
|
20
|
+
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '4.1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '3.1'
|
30
|
-
- - <
|
30
|
+
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '4.1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: railties
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- -
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '3.1'
|
40
|
-
- - <
|
40
|
+
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '4.1'
|
43
43
|
type: :development
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- -
|
47
|
+
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '3.1'
|
50
|
-
- - <
|
50
|
+
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '4.1'
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: rake
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- -
|
57
|
+
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: '0'
|
60
60
|
type: :development
|
61
61
|
prerelease: false
|
62
62
|
version_requirements: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
|
-
- -
|
64
|
+
- - ">="
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: '0'
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
name: rspec
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
|
-
- - ~>
|
71
|
+
- - "~>"
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: '2.12'
|
74
74
|
type: :development
|
75
75
|
prerelease: false
|
76
76
|
version_requirements: !ruby/object:Gem::Requirement
|
77
77
|
requirements:
|
78
|
-
- - ~>
|
78
|
+
- - "~>"
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '2.12'
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: genspec
|
83
83
|
requirement: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
|
-
- -
|
85
|
+
- - ">="
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
90
|
version_requirements: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
|
-
- -
|
92
|
+
- - ">="
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: '0'
|
95
95
|
description: A view layer for your Rails apps that separates structure and logic.
|
@@ -112,7 +112,6 @@ files:
|
|
112
112
|
- lib/curly/error.rb
|
113
113
|
- lib/curly/incomplete_block_error.rb
|
114
114
|
- lib/curly/incorrect_ending_error.rb
|
115
|
-
- lib/curly/invalid_block_error.rb
|
116
115
|
- lib/curly/invalid_reference.rb
|
117
116
|
- lib/curly/presenter.rb
|
118
117
|
- lib/curly/railtie.rb
|
@@ -136,22 +135,22 @@ licenses:
|
|
136
135
|
metadata: {}
|
137
136
|
post_install_message:
|
138
137
|
rdoc_options:
|
139
|
-
- --charset=UTF-8
|
138
|
+
- "--charset=UTF-8"
|
140
139
|
require_paths:
|
141
140
|
- lib
|
142
141
|
required_ruby_version: !ruby/object:Gem::Requirement
|
143
142
|
requirements:
|
144
|
-
- -
|
143
|
+
- - ">="
|
145
144
|
- !ruby/object:Gem::Version
|
146
145
|
version: '0'
|
147
146
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
147
|
requirements:
|
149
|
-
- -
|
148
|
+
- - ">="
|
150
149
|
- !ruby/object:Gem::Version
|
151
|
-
version:
|
150
|
+
version: '0'
|
152
151
|
requirements: []
|
153
152
|
rubyforge_project:
|
154
|
-
rubygems_version: 2.0
|
153
|
+
rubygems_version: 2.2.0
|
155
154
|
signing_key:
|
156
155
|
specification_version: 2
|
157
156
|
summary: Free your views!
|