ember 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Suraj N. Kurapati
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-03 00:00:00 -07:00
17
+ date: 2010-04-20 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -41,8 +41,9 @@ dependencies:
41
41
  version: "2"
42
42
  type: :development
43
43
  version_requirements: *id002
44
- description: " Ember (EMBEdded Ruby) is an [1]eRuby template processor that\n enables debugging, reduces markup, and improves composability\n of eRuby templates.\n\n * It reports correct line numbers in error message stack\n traces.\n\n * It can infer <% end %> based on indentation.\n\n * It can unindent block content hierarchically.\n\n * It completely silences code-only eRuby directives.\n\n * It is implemented in 364 lines of pure Ruby.\n\n\
45
- References\n\n 1. http://en.wikipedia.org/wiki/ERuby\n"
44
+ description: |-
45
+ Ember (EMBEdded Ruby) is an eRuby template processor that allows
46
+ debugging, reduces markup, and improves composability of eRuby templates.
46
47
  email:
47
48
  executables:
48
49
  - ember
@@ -51,46 +52,13 @@ extensions: []
51
52
  extra_rdoc_files: []
52
53
 
53
54
  files:
54
- - THEORY
55
- - inochi.opts
56
- - INSTALL
57
- - MANUAL
58
- - test/combinatorics.rb
59
- - test/ember/template_test.rb
60
- - test/runner
61
- - test/test_helper.rb
55
+ - bin/ember
62
56
  - lib/ember.rb
63
57
  - lib/ember/inochi.rb
64
58
  - lib/ember/template.rb
65
- - bin/ember
66
- - USAGE
59
+ - man/man1/ember.1.html
60
+ - man/man1/ember.1.gz
67
61
  - LICENSE
68
- - HISTORY
69
- - README
70
- - doc/ann.xml
71
- - doc/example.txt
72
- - doc/example.erb
73
- - doc/index.html
74
- - doc/api/Ember.html
75
- - doc/api/class_list.html
76
- - doc/api/js/full_list.js
77
- - doc/api/js/jquery.js
78
- - doc/api/js/app.js
79
- - doc/api/method_list.html
80
- - doc/api/Ember/Template/Program.html
81
- - doc/api/Ember/Template/Program/Statement.html
82
- - doc/api/Ember/Template.html
83
- - doc/api/css/full_list.css
84
- - doc/api/css/style.css
85
- - doc/api/css/common.css
86
- - doc/api/_index.html
87
- - doc/api/frames.html
88
- - doc/api/top-level-namespace.html
89
- - doc/api/index.html
90
- - doc/api/file.LICENSE.html
91
- - doc/api/file_list.html
92
- - doc/ember.png
93
- - doc/ember.svg
94
62
  has_rdoc: true
95
63
  homepage: http://snk.tuxfamily.org/lib/ember/
96
64
  licenses: []
data/HISTORY DELETED
@@ -1,79 +0,0 @@
1
- %# #%
2
- %# You can read this document in its full glory by #%
3
- %# opening ./doc/index.html in your favorite Web browser. #%
4
- %# #%
5
-
6
- %#----------------------------------------------------------------------------
7
- %| section "Version 0.1.0 (2010-04-03)"
8
- %#----------------------------------------------------------------------------
9
-
10
- This release improves the handling of eRuby comment directives, fixes a bug
11
- in the `<%% end %>` inference logic, and performs some minor housekeeping.
12
-
13
- %#--------------------------------------------------------------------------
14
- %| paragraph "New features"
15
- %#--------------------------------------------------------------------------
16
-
17
- * Single-line comment directives are now ignored (treated like no-ops)
18
- in input templates. This allows us to surround eRuby block directives
19
- with section separators made from single-line comment directives:
20
-
21
- %%|some_block_directive
22
-
23
- Inside some_block_directive.
24
-
25
- %%#-----------------------------------------------------------------
26
-
27
- Still inside some_block_directive!
28
-
29
- %%#---------------------------------------------------------------
30
- %%| nested_block_directive
31
- %%#---------------------------------------------------------------
32
-
33
- Inside nested_block_directive.
34
-
35
- %#--------------------------------------------------------------------------
36
- %| paragraph "Bug fixes"
37
- %#--------------------------------------------------------------------------
38
-
39
- * `<%% end %>` inference did not work for blocks
40
- beginning with `def`, `class`, and `module` keywords.
41
-
42
- %#--------------------------------------------------------------------------
43
- %| paragraph "Housekeeping"
44
- %#--------------------------------------------------------------------------
45
-
46
- * Upgrade to Inochi 2.0.0-rc3. This project no longer
47
- depends on the "inochi" or "trollop" gems at runtime.
48
-
49
- %#----------------------------------------------------------------------------
50
- %| section "Version 0.0.1 (2009-10-03)"
51
- %#----------------------------------------------------------------------------
52
-
53
- This release improves Ruby 1.9 support and revises the user manual.
54
-
55
- %#--------------------------------------------------------------------------
56
- %| paragraph "Bug fixes"
57
- %#--------------------------------------------------------------------------
58
-
59
- * Nested templates could not access parent's binding in Ruby 1.9
60
-
61
- %#--------------------------------------------------------------------------
62
- %| paragraph "Housekeeping"
63
- %#--------------------------------------------------------------------------
64
-
65
- * Use simpler Copyright reminder at the top of every file.
66
-
67
- * Rename internal `Program` class' methods to be self-documenting.
68
-
69
- * Open source is for fun, so [be nice][1]: speak
70
- of "related works" instead of "competitors".
71
-
72
- [1]: http://loiclemeur.com/english/2009/03/never-criticize-your-competitors.html
73
-
74
- %#----------------------------------------------------------------------------
75
- %| section "Version 0.0.0 (2009-02-13)"
76
- %#----------------------------------------------------------------------------
77
-
78
- This is the first public release of Ember. Enjoy!
79
-
data/INSTALL DELETED
@@ -1,31 +0,0 @@
1
- %# #%
2
- %# You can read this document in its full glory by #%
3
- %# opening ./doc/index.html in your favorite Web browser. #%
4
- %# #%
5
-
6
- %#----------------------------------------------------------------------------
7
- %| section "Prerequisites"
8
- %#----------------------------------------------------------------------------
9
-
10
- * [Ruby](http://ruby-lang.org) 1.8.6 or newer.
11
-
12
- * [RubyGems](http://rubygems.org) 1.3.6 or newer.
13
-
14
- %#----------------------------------------------------------------------------
15
- %| section "Installing"
16
- %#----------------------------------------------------------------------------
17
-
18
- %|command! "gem install ember"
19
-
20
- %#----------------------------------------------------------------------------
21
- %| section "Upgrading"
22
- %#----------------------------------------------------------------------------
23
-
24
- %|command! "gem update ember"
25
-
26
- %#----------------------------------------------------------------------------
27
- %| section "Uninstalling"
28
- %#----------------------------------------------------------------------------
29
-
30
- %|command! "gem uninstall ember"
31
-
data/MANUAL DELETED
@@ -1,25 +0,0 @@
1
- %# #%
2
- %# You can read this document in its full glory by #%
3
- %# opening ./doc/index.html in your favorite Web browser. #%
4
- %# #%
5
-
6
- % api_reference_url = 'api/index.html'
7
- % source_code_tool = '[Git](http://git-scm.com)'
8
- % source_code_url = 'http://github.com/sunaku/ember'
9
- % issue_tracker_url = 'http://github.com/sunaku/ember/issues'
10
-
11
- %|part "Welcome"
12
- %+ "README"
13
-
14
- %|part "Setup"
15
- %+ "INSTALL"
16
-
17
- %|part "Theory"
18
- %+ "THEORY"
19
-
20
- %|part "Usage"
21
- %+ "USAGE"
22
-
23
- %|part "History"
24
- %|project_history
25
- %+ "HISTORY"
data/README DELETED
@@ -1,54 +0,0 @@
1
- %# #%
2
- %# You can read this document in its full glory by #%
3
- %# opening ./doc/index.html in your favorite Web browser. #%
4
- %# #%
5
-
6
- %#----------------------------------------------------------------------------
7
- %| project_summary
8
- %#----------------------------------------------------------------------------
9
-
10
- Ember (*EMBE*dded *R*uby) is an [eRuby template][1] processor that enables
11
- debugging, reduces markup, and improves composability of eRuby templates.
12
-
13
- * It reports correct line numbers in error message stack traces.
14
- * It can infer <tt><%% end %></tt> based on indentation.
15
- * It can unindent block content hierarchically.
16
- * It completely silences code-only eRuby directives.
17
- * It is implemented in <%= `sloccount lib`[/^\d+/] %> lines of pure Ruby.
18
-
19
- [1]: http://en.wikipedia.org/wiki/ERuby
20
-
21
- %#----------------------------------------------------------------------------
22
- %| section "Resources"
23
- %#----------------------------------------------------------------------------
24
-
25
- * <%= xref "History", "What's new?" %> ---
26
- release notes and project history.
27
-
28
- * [Issue tracker](<%= issue_tracker_url %>) ---
29
- report bugs, request features, or ask for help.
30
-
31
- * [Source code](<%= source_code_url %>) ---
32
- browse online or obtain using <%= source_code_tool %>
33
-
34
- * [API reference](<%= api_reference_url %>) ---
35
- documentation for source code.
36
-
37
- * [Project home](<%= Ember::WEBSITE %>) ---
38
- the official project home page.
39
-
40
- %#----------------------------------------------------------------------------
41
- %| section "License"
42
- %#----------------------------------------------------------------------------
43
-
44
- %# See the file named "LICENSE" for details.
45
- %< "LICENSE"
46
-
47
- %#----------------------------------------------------------------------------
48
- %| section "Related works"
49
- %#----------------------------------------------------------------------------
50
-
51
- * [ERB](http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/)
52
- * [Erubis](http://www.kuwata-lab.com/erubis/)
53
- * [eruby](http://modruby.net/en/)
54
-
data/THEORY DELETED
@@ -1,151 +0,0 @@
1
- %#----------------------------------------------------------------------------
2
- %| section "Directives"
3
- %#----------------------------------------------------------------------------
4
-
5
- eRuby templates are plain-text documents that contain special processing
6
- instructions known as **directives**, which may be expressed using either
7
- **standard** or **shorthand** notation:
8
-
9
- %|table
10
- %|thead
11
- %|tr
12
- %|th
13
- Notation
14
- %|th
15
- Directive
16
- %|th
17
- Head
18
- %|th
19
- Operation
20
- %|th
21
- Body
22
- %|th
23
- Tail
24
- %|tbody
25
- %|tr
26
- %|td
27
- Standard
28
- %|td
29
- <%%XY%>
30
- %|td
31
- <%%
32
- %|td
33
- X
34
- %|td
35
- Y
36
- %|td
37
- %%>
38
- %|tr
39
- %|td
40
- Shorthand
41
- %|td
42
- %%XY
43
- %|td
44
- %%
45
- %|td
46
- X
47
- %|td
48
- Y
49
- %|td
50
-
51
- In standard notation, the directive is composed of a head, <%= xref \
52
- "Operations", "an operation" %>, a body, and a tail. In addition, the
53
- directive may appear anywhere in the text.
54
-
55
- In shorthand notation, the directive is composed of a head, <%= xref \
56
- "Operations", "an operation" %> and a body. However, the directive may only
57
- appear in the text if it occupies an entire line (arbitrary amounts of
58
- leading whitespace are permitted).
59
-
60
- In any case, directives are atomic constructs; they cannot be nested.
61
-
62
- %#--------------------------------------------------------------------------
63
- %| section "Operations"
64
- %#--------------------------------------------------------------------------
65
-
66
- The first character that follows the head of a directive is known as an
67
- **operation**. It prescribes how the directive should be processed:
68
-
69
- %|table
70
- %|thead
71
- %|tr
72
- %|th
73
- Operation
74
- %|th
75
- Effect
76
- %|th
77
- Example
78
- %|tbody
79
- %|tr
80
- %|td
81
- `<%= Ember::Template::OPERATION_COMMENT_LINE %>`
82
- %|td
83
- The entire directive is omitted from the output.
84
- %|td
85
- %= xref "Comment directives"
86
- %|tr
87
- %|td
88
- `<%= Ember::Template::OPERATION_EVAL_EXPRESSION %>`
89
- %|td
90
- The body of the directive is evaluated as Ruby code, and the
91
- result of this evaluation is inserted into the output.
92
- %|td
93
- %= xref "Vocal directives"
94
- %|tr
95
- %|td
96
- `<%= Ember::Template::OPERATION_EVAL_TEMPLATE_STRING %>`
97
- %|td
98
- The body of the directive is evaluated as an eRuby template, and
99
- the result of this evaluation is inserted into the output.
100
- %|td
101
- %= xref "Dynamic template evaluation"
102
- %|tr
103
- %|td
104
- `<%= Ember::Template::OPERATION_EVAL_TEMPLATE_FILE %>`
105
- %|td
106
- The body of the directive is evaluated as Ruby code, and the
107
- result of this evaluation is assumed to be a string that specifies
108
- the path (either absolute or relative to the eRuby template file
109
- in which this directive is found) to a file containing an eRuby
110
- template. This file is read and its contents are evaluated as an
111
- eRuby template, and the result of this evaluation is inserted into
112
- the output.
113
- %|td
114
- %= xref "Template file inclusion"
115
- %|tr
116
- %|td
117
- `<%= Ember::Template::OPERATION_INSERT_PLAIN_FILE %>`
118
- %|td
119
- The body of the directive is evaluated as Ruby code, and the
120
- result of this evaluation is assumed to be a string that specifies
121
- the path (either absolute or relative to the eRuby template file
122
- in which this directive is found) to a file. This file is read
123
- and its contents are inserted into the output.
124
- %|td
125
- %= xref "Raw file inclusion"
126
- %|tr
127
- %|td
128
- `<%= Ember::Template::OPERATION_BEGIN_LAMBDA %>`
129
- %|td
130
- The body of the directive is treated as the beginning of a Ruby
131
- block. The `do` keyword is automatically appended to the body of
132
- the directive if missing.
133
- %|td
134
- %= xref "Block directives"
135
- %|tr
136
- %|td
137
- `%`
138
- %|td
139
- One "%" character is omitted from the head of the directive and
140
- the entire directive is inserted into the output.
141
- %|td
142
- %= xref "Escaped directives"
143
- %|tr
144
- %|td
145
- (none of the above)
146
- %|td
147
- The body of the directive is evaluated as Ruby code, but the
148
- result of this evaluation *is not* inserted into the output.
149
- %|td
150
- %= xref "Silent directives"
151
-
data/USAGE DELETED
@@ -1,250 +0,0 @@
1
- %# #%
2
- %# You can read this document in its full glory by #%
3
- %# opening ./doc/index.html in your favorite Web browser. #%
4
- %# #%
5
-
6
- %#----------------------------------------------------------------------------
7
- %| section "Shell command"
8
- %#----------------------------------------------------------------------------
9
-
10
- %|command! "ember --help" do |node|
11
- %|text
12
- %= verbatim `ruby bin/#{node.title}`
13
-
14
- %#----------------------------------------------------------------------------
15
- %| section "Ruby library"
16
- %#----------------------------------------------------------------------------
17
-
18
- Begin by loading Ember into Ruby:
19
-
20
- %|code
21
- require 'rubygems' # only necessary if you are using Ruby 1.8
22
- require 'ember'
23
-
24
- Instantiate an Ember template processor:
25
-
26
- %|code
27
- source = "your eRuby template here"
28
- options = { :unindent => true, :shorthand => true }
29
- template = Ember::Template.new(source, options)
30
-
31
- Inspect the Ruby program that was compiled (and is used) by the Ember
32
- template processor to evaluate the eRuby template given as input:
33
-
34
- %|code
35
- puts template.program
36
-
37
- View the result of evaluating the eRuby template:
38
-
39
- %|code
40
- puts template.render
41
-
42
- See the [API documentation](api/index.html) for more information.
43
-
44
- %#--------------------------------------------------------------------------
45
- <%
46
- standard_directive = lambda do |body|
47
- '<' + '%' + body + ' %' + '>'
48
- end
49
-
50
- shorthand_directive = lambda do |body|
51
- '%' + body
52
- end
53
- %>
54
-
55
- %|template_example = lambda do |input, options|
56
- % input = input.strip.gsub(/^ {4}/, '') << "\n" # remove indentation
57
- % template = Ember::Template.new(input, options)
58
-
59
- % text { input }
60
-
61
- <%=
62
- if options.empty?
63
- "The"
64
- else
65
- "With `#{options.inspect}` options, the"
66
- end
67
- %> above template compiles into:
68
-
69
- % code { template.program }
70
-
71
- And renders as:
72
-
73
- % text { template.render }
74
-
75
- %#--------------------------------------------------------------------------
76
- %| example! "An empty template"
77
- %#--------------------------------------------------------------------------
78
-
79
- Begin with an empty template:
80
-
81
- %= template_example.call "", {}
82
-
83
- %#--------------------------------------------------------------------------
84
- %| example! "Comment directives"
85
- %#--------------------------------------------------------------------------
86
-
87
- Add comment directives:
88
-
89
- <%=
90
- template_example.call %{
91
- #{standard_directive.call '# this is a comment'}
92
- #{shorthand_directive.call '# this is also a comment'}
93
-
94
- #{standard_directive.call "# this\nis\na\nmulti-line comment"}
95
- }, :shorthand => true
96
- %>
97
-
98
- %#--------------------------------------------------------------------------
99
- %| example! "Escaped directives"
100
- %#--------------------------------------------------------------------------
101
-
102
- Add escaped directives:
103
-
104
- <%=
105
- example = '% this is an escaped directive'
106
-
107
- template_example.call %{
108
- #{standard_directive.call example}
109
- #{shorthand_directive.call example}
110
- }, :shorthand => true
111
- %>
112
-
113
- %#--------------------------------------------------------------------------
114
- %| example! "Vocal directives"
115
- %#--------------------------------------------------------------------------
116
-
117
- Add vocal directives, which produce output:
118
-
119
- <%=
120
- template_example.call %{
121
- #{standard_directive.call '= "hello"'}
122
- #{shorthand_directive.call '= "world"'}
123
-
124
- }, :shorthand => true
125
- %>
126
-
127
- %#--------------------------------------------------------------------------
128
- %| example! "Silent directives"
129
- %#--------------------------------------------------------------------------
130
-
131
- Add silent directives, which do not produce output:
132
-
133
- <%=
134
- template_example.call %{
135
- #{standard_directive.call ' a = "hello"'}
136
- #{shorthand_directive.call ' b = "world"'}
137
-
138
- #{standard_directive.call '= a'}
139
- #{shorthand_directive.call '= b'}
140
-
141
- }, :shorthand => true
142
- %>
143
-
144
- %#--------------------------------------------------------------------------
145
- %| example! "Block directives"
146
- %#--------------------------------------------------------------------------
147
-
148
- Add some Ruby blocks:
149
-
150
- <%=
151
- template_example.call %{
152
- #{shorthand_directive.call ' words = %w[hello world]'}
153
-
154
- #{standard_directive.call ' words.each do |w|'}
155
- #{standard_directive.call '= w'}
156
- #{standard_directive.call ' end'}
157
-
158
- #{shorthand_directive.call ' words.each do |w|'}
159
- #{shorthand_directive.call '= w'}
160
- #{shorthand_directive.call ' end'}
161
-
162
- #{shorthand_directive.call '|words.each |w|'}
163
- #{shorthand_directive.call '= w'}
164
- #{shorthand_directive.call ' end'}
165
-
166
- }, :shorthand => true
167
- %>
168
-
169
- %#--------------------------------------------------------------------------
170
- %| example! "Infer block endings"
171
- %#--------------------------------------------------------------------------
172
-
173
- Omit <tt><%= standard_directive.call ' end' %></tt> directives from the
174
- template:
175
-
176
- <%=
177
- template_example.call %{
178
- #{shorthand_directive.call ' words = %w[hello world]'}
179
-
180
- #{standard_directive.call ' words.each do |w|'}
181
- #{standard_directive.call '= w'}
182
-
183
- #{shorthand_directive.call ' words.each do |w|'}
184
- #{shorthand_directive.call '= w'}
185
-
186
- #{shorthand_directive.call '|words.each |w|'}
187
- #{shorthand_directive.call '= w'}
188
-
189
- }, :shorthand => true, :infer_end => true
190
- %>
191
-
192
- %#--------------------------------------------------------------------------
193
- %| example! "Raw file inclusion"
194
- %#--------------------------------------------------------------------------
195
-
196
- When <tt>doc/example.txt</tt> contains:
197
-
198
- %|text
199
- %< "doc/example.txt"
200
-
201
- And the eRuby template is:
202
-
203
- <%=
204
- example = '< "doc/example.txt"'
205
-
206
- template_example.call %{
207
- #{standard_directive.call example}
208
-
209
- #{shorthand_directive.call example}
210
-
211
- }, :shorthand => true, :source_file => __FILE__
212
- %>
213
-
214
- %#--------------------------------------------------------------------------
215
- %| example! "Template file inclusion"
216
- %#--------------------------------------------------------------------------
217
-
218
- When <tt>doc/example.erb</tt> contains:
219
-
220
- %|code :rhtml
221
- %< "doc/example.erb"
222
-
223
- And the eRuby template is:
224
-
225
- <%=
226
- example = '+ "doc/example.erb"'
227
-
228
- template_example.call %{
229
- #{standard_directive.call example}
230
-
231
- #{shorthand_directive.call example}
232
-
233
- }, :shorthand => true, :source_file => __FILE__
234
- %>
235
-
236
- %#--------------------------------------------------------------------------
237
- %| example! "Dynamic template evaluation"
238
- %#--------------------------------------------------------------------------
239
-
240
- <%=
241
- example = %{~ "#{shorthand_directive.call '= 2 + 2'}"}
242
-
243
- template_example.call %{
244
- #{standard_directive.call example}
245
-
246
- #{shorthand_directive.call example}
247
-
248
- }, :shorthand => true
249
- %>
250
-