erbside 0.1.0
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.
- data/HISTORY +11 -0
- data/LICENSE +206 -0
- data/PROFILE +27 -0
- data/README +88 -0
- data/VERSION +1 -0
- data/bin/erbside +3 -0
- data/lib/erbside.rb +57 -0
- data/lib/erbside/context.rb +46 -0
- data/lib/erbside/inline.rb +249 -0
- data/lib/erbside/inline/bash.rb +33 -0
- data/lib/erbside/inline/cpp.rb +32 -0
- data/lib/erbside/inline/css.rb +34 -0
- data/lib/erbside/inline/js.rb +34 -0
- data/lib/erbside/inline/ruby.rb +34 -0
- data/lib/erbside/inline/sgml.rb +135 -0
- data/lib/erbside/metadata.rb +122 -0
- data/lib/erbside/runner.rb +128 -0
- data/lib/plugins/syckle/erbside.rb +45 -0
- data/test/functional/applique/env.rb +33 -0
- data/test/functional/bash.rdoc +57 -0
- data/test/functional/cli.rdoc +14 -0
- data/test/functional/cpp.rdoc +50 -0
- data/test/functional/css.rdoc +53 -0
- data/test/functional/javascript.rdoc +52 -0
- data/test/functional/ruby.rdoc +57 -0
- data/test/functional/sgml.rdoc +61 -0
- data/test/unit/fixture/inline.rb +29 -0
- data/test/unit/fixture/inline_complex.rb +0 -0
- data/test/unit/inline_test.rb +14 -0
- metadata +111 -0
@@ -0,0 +1,53 @@
|
|
1
|
+
== CSS
|
2
|
+
|
3
|
+
=== Sideline Rendering
|
4
|
+
|
5
|
+
Given a file named 'example.css' containing:
|
6
|
+
|
7
|
+
{ color: #000; } // :erb: { color: #<%= 1+1 %>00; }
|
8
|
+
|
9
|
+
The rendered result of 'example.css' will be:
|
10
|
+
|
11
|
+
{ color: #200; } // :erb: { color: #<%= 1+1 %>00; }
|
12
|
+
|
13
|
+
Rather then spell out the entire line we can use the front match
|
14
|
+
marker. Given a file named 'example.css' containing:
|
15
|
+
|
16
|
+
{ color: #000; } // :erb: ^#<%= 2+2 %>00; }
|
17
|
+
|
18
|
+
The rendered result of 'example.css' will be:
|
19
|
+
|
20
|
+
{ color: #400; } // :erb: ^#<%= 2+2 %>00; }
|
21
|
+
|
22
|
+
=== Multiline Rendering
|
23
|
+
|
24
|
+
Given a file named 'example.css' containing:
|
25
|
+
|
26
|
+
//:erb+1: <%= %w{z; y; x;}.sort.join("\n") %>
|
27
|
+
blah blah blah
|
28
|
+
|
29
|
+
The rendered result of 'example.css' will be:
|
30
|
+
|
31
|
+
//:erb+3: <%= %w{z; y; x;}.sort.join("\n") %>
|
32
|
+
x;
|
33
|
+
y;
|
34
|
+
z;
|
35
|
+
|
36
|
+
=== Block Rendering
|
37
|
+
|
38
|
+
Given a file named 'example.css' containing:
|
39
|
+
|
40
|
+
/* :erb+1:
|
41
|
+
<%= %w{z; y; x;}.sort.join("\n") %>
|
42
|
+
*/
|
43
|
+
blah blah blah
|
44
|
+
|
45
|
+
The rendered result of 'example.css' will be:
|
46
|
+
|
47
|
+
/* :erb+3:
|
48
|
+
<%= %w{z; y; x;}.sort.join("\n") %>
|
49
|
+
*/
|
50
|
+
x;
|
51
|
+
y;
|
52
|
+
z;
|
53
|
+
|
@@ -0,0 +1,52 @@
|
|
1
|
+
== Javascript
|
2
|
+
|
3
|
+
=== Sideline Rendering
|
4
|
+
|
5
|
+
Given a file named 'example.js' containing:
|
6
|
+
|
7
|
+
var version = "?"; // :erb: var version = "<%= 1+1 %>";
|
8
|
+
|
9
|
+
The rendered result of 'example.js' will be:
|
10
|
+
|
11
|
+
var version = "2"; // :erb: var version = "<%= 1+1 %>";
|
12
|
+
|
13
|
+
Given a file named 'example.js' containing:
|
14
|
+
|
15
|
+
// Manifest generated 2009 #:erb: ^generated <%= 2009 %>
|
16
|
+
|
17
|
+
The rendered result of 'example.js' will be:
|
18
|
+
|
19
|
+
// Manifest generated 2009 #:erb: ^generated <%= 2009 %>
|
20
|
+
|
21
|
+
=== Multiline Rendering
|
22
|
+
|
23
|
+
Given a file named 'example.js' containing:
|
24
|
+
|
25
|
+
//:erb+1: <%= %w{z; y; x;}.sort.join("\n") %>
|
26
|
+
blah blah blah
|
27
|
+
|
28
|
+
The rendered result of 'example.js' will be:
|
29
|
+
|
30
|
+
//:erb+3: <%= %w{z; y; x;}.sort.join("\n") %>
|
31
|
+
x;
|
32
|
+
y;
|
33
|
+
z;
|
34
|
+
|
35
|
+
=== Block Rendering
|
36
|
+
|
37
|
+
Given a file named 'example.js' containing:
|
38
|
+
|
39
|
+
/* :erb+1:
|
40
|
+
<%= %w{z; y; x;}.sort.join("\n") %>
|
41
|
+
*/
|
42
|
+
blah blah blah
|
43
|
+
|
44
|
+
The rendered result of 'example.js' will be:
|
45
|
+
|
46
|
+
/* :erb+3:
|
47
|
+
<%= %w{z; y; x;}.sort.join("\n") %>
|
48
|
+
*/
|
49
|
+
x;
|
50
|
+
y;
|
51
|
+
z;
|
52
|
+
|
@@ -0,0 +1,57 @@
|
|
1
|
+
== Ruby
|
2
|
+
|
3
|
+
=== Sideline Rendering
|
4
|
+
|
5
|
+
Given a file named 'example.rb' containing:
|
6
|
+
|
7
|
+
# ordinary comment
|
8
|
+
VERSION = "?" # :erb: VERSION = "<%= 1+1 %>"
|
9
|
+
|
10
|
+
The rendered result of 'example.rb' will be:
|
11
|
+
|
12
|
+
# ordinary comment
|
13
|
+
VERSION = "2" # :erb: VERSION = "<%= 1+1 %>"
|
14
|
+
|
15
|
+
=== Sideline Rendering with First Match Marker
|
16
|
+
|
17
|
+
Given a file named 'example.rb' containing:
|
18
|
+
|
19
|
+
# Script generated 200X #:erb: ^generated <%= 2009 %>
|
20
|
+
|
21
|
+
The rendered result of 'example.rb' will be:
|
22
|
+
|
23
|
+
# Script generated 2009 #:erb: ^generated <%= 2009 %>
|
24
|
+
|
25
|
+
Notice in this case we rendered a comment.
|
26
|
+
|
27
|
+
=== Multiline Rendering
|
28
|
+
|
29
|
+
Given a file named 'example.rb' containing:
|
30
|
+
|
31
|
+
#:erb+1: <%= %w{z y x}.sort.join("\n") %>
|
32
|
+
blah blah blah
|
33
|
+
|
34
|
+
The rendered result of 'example.rb' will be:
|
35
|
+
|
36
|
+
#:erb+3: <%= %w{z y x}.sort.join("\n") %>
|
37
|
+
x
|
38
|
+
y
|
39
|
+
z
|
40
|
+
|
41
|
+
=== Block Rendering
|
42
|
+
|
43
|
+
Given a file named 'example.rb' containing:
|
44
|
+
|
45
|
+
=begin :erb+0:
|
46
|
+
<%= %w{a b c}.map{ |x| "#{x}!" }.join("\n") %>
|
47
|
+
=end
|
48
|
+
|
49
|
+
The rendered result of 'example.rb' will be:
|
50
|
+
|
51
|
+
=begin :erb+3:
|
52
|
+
<%= %w{a b c}.map{ |x| "#{x}!" }.join("\n") %>
|
53
|
+
=end
|
54
|
+
a!
|
55
|
+
b!
|
56
|
+
c!
|
57
|
+
|
@@ -0,0 +1,61 @@
|
|
1
|
+
== XML/HTML
|
2
|
+
|
3
|
+
=== Sideline Example
|
4
|
+
|
5
|
+
Given a file named 'example.xml' containing:
|
6
|
+
|
7
|
+
<!-- ordianry comment -->
|
8
|
+
<root>
|
9
|
+
<version number="?"/> <!-- :erb: <version number="<%= 1+1 %>"/> -->
|
10
|
+
</root>
|
11
|
+
|
12
|
+
The rendered result of 'example.xml' will be:
|
13
|
+
|
14
|
+
<!-- ordianry comment -->
|
15
|
+
<root>
|
16
|
+
<version number="2"/> <!-- :erb: <version number="<%= 1+1 %>"/> -->
|
17
|
+
</root>
|
18
|
+
|
19
|
+
=== Multiline Rendering
|
20
|
+
|
21
|
+
Given a file named 'example.xml' containing:
|
22
|
+
|
23
|
+
<root>
|
24
|
+
<letters>
|
25
|
+
<!-- :erb+1: <%= %w{z y x}.sort.join("\n").indent(4) -->
|
26
|
+
blah blah blah
|
27
|
+
</letters>
|
28
|
+
</root>
|
29
|
+
|
30
|
+
The rendered result of 'example.xml' will be:
|
31
|
+
|
32
|
+
<root>
|
33
|
+
<letters>
|
34
|
+
<!-- :erb+3: <%= %w{z y x}.sort.join("\n").indent(4) -->
|
35
|
+
x
|
36
|
+
y
|
37
|
+
z
|
38
|
+
</letters>
|
39
|
+
</root>
|
40
|
+
|
41
|
+
=== Block Rendering
|
42
|
+
|
43
|
+
Given a file named 'example.xml' containing:
|
44
|
+
|
45
|
+
<root>
|
46
|
+
<!-- :erb+0:
|
47
|
+
<%= %w{a b c}.map{ |x| "<#{x}/>" }.join("\n") %>
|
48
|
+
-->
|
49
|
+
</root>
|
50
|
+
|
51
|
+
The rendered result of 'example.xml' will be:
|
52
|
+
|
53
|
+
<root>
|
54
|
+
<!-- :erb+3:
|
55
|
+
<%= %w{a b c}.map{ |x| "<#{x}/>" }.join("\n") %>
|
56
|
+
-->
|
57
|
+
<a/>
|
58
|
+
<b/>
|
59
|
+
<c/>
|
60
|
+
</root>
|
61
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# Stuff
|
2
|
+
puts "Testing...."
|
3
|
+
|
4
|
+
# :till+14: <%= Dir['*'].sort.join("\n") %>
|
5
|
+
HISTORY
|
6
|
+
LICENSE
|
7
|
+
MANIFEST
|
8
|
+
README
|
9
|
+
bin
|
10
|
+
doc
|
11
|
+
lib
|
12
|
+
log
|
13
|
+
meta
|
14
|
+
pkg
|
15
|
+
site
|
16
|
+
task
|
17
|
+
test
|
18
|
+
work
|
19
|
+
|
20
|
+
# Manifest generated 200X #:till: ^generated <%= 2009 %>
|
21
|
+
|
22
|
+
# Some comment
|
23
|
+
puts "We are at the end."
|
24
|
+
|
25
|
+
VERSION = "?" #:till: VERSION = "<%= 1+1 %>"
|
26
|
+
|
27
|
+
# Another comment
|
28
|
+
puts "Yes we are."
|
29
|
+
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: erbside
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Thomas Sawyer
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-02-21 00:00:00 -05:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: facets
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
description: Erbside is a simple project-oriented erb-based inline template system. Inline templates make it easy to do basic code generation without the need for duplicate files.
|
36
|
+
email: transfire@gmail.com
|
37
|
+
executables:
|
38
|
+
- erbside
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- README
|
43
|
+
files:
|
44
|
+
- bin/erbside
|
45
|
+
- lib/erbside/context.rb
|
46
|
+
- lib/erbside/inline/bash.rb
|
47
|
+
- lib/erbside/inline/cpp.rb
|
48
|
+
- lib/erbside/inline/css.rb
|
49
|
+
- lib/erbside/inline/js.rb
|
50
|
+
- lib/erbside/inline/ruby.rb
|
51
|
+
- lib/erbside/inline/sgml.rb
|
52
|
+
- lib/erbside/inline.rb
|
53
|
+
- lib/erbside/metadata.rb
|
54
|
+
- lib/erbside/runner.rb
|
55
|
+
- lib/erbside.rb
|
56
|
+
- lib/plugins/syckle/erbside.rb
|
57
|
+
- test/functional/applique/env.rb
|
58
|
+
- test/functional/bash.rdoc
|
59
|
+
- test/functional/cli.rdoc
|
60
|
+
- test/functional/cpp.rdoc
|
61
|
+
- test/functional/css.rdoc
|
62
|
+
- test/functional/javascript.rdoc
|
63
|
+
- test/functional/ruby.rdoc
|
64
|
+
- test/functional/sgml.rdoc
|
65
|
+
- test/unit/fixture/inline.rb
|
66
|
+
- test/unit/fixture/inline_complex.rb
|
67
|
+
- test/unit/inline_test.rb
|
68
|
+
- PROFILE
|
69
|
+
- LICENSE
|
70
|
+
- README
|
71
|
+
- HISTORY
|
72
|
+
- VERSION
|
73
|
+
has_rdoc: true
|
74
|
+
homepage: http://rubyworks.github.com/erbside
|
75
|
+
licenses:
|
76
|
+
- Apache 2.0
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options:
|
79
|
+
- --title
|
80
|
+
- Erbside API
|
81
|
+
- --main
|
82
|
+
- README
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
hash: 3
|
91
|
+
segments:
|
92
|
+
- 0
|
93
|
+
version: "0"
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
hash: 3
|
100
|
+
segments:
|
101
|
+
- 0
|
102
|
+
version: "0"
|
103
|
+
requirements: []
|
104
|
+
|
105
|
+
rubyforge_project: erbside
|
106
|
+
rubygems_version: 1.3.7
|
107
|
+
signing_key:
|
108
|
+
specification_version: 3
|
109
|
+
summary: ERB-based Inline Templating
|
110
|
+
test_files:
|
111
|
+
- test/unit/inline_test.rb
|