volt-slim 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +83 -0
- data/lib/volt/slim/compiler.rb +1 -1
- data/lib/volt/slim/filters/controls.rb +4 -1
- data/lib/volt/slim/version.rb +1 -1
- data/volt-slim.gemspec +5 -2
- metadata +22 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 097adc88334ee25150e4f9a35af7ea054524ee7c
|
4
|
+
data.tar.gz: 4dbc71917b179d03a2afb523d344d8918c2cf0a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72facdc096c823f7e8cad594716f7b68fb970691aac56785d8c9893b3b86fce989930b3ec53b99bb6e45aa2f754b71177056bbe34ffa407929695991ef0522b1
|
7
|
+
data.tar.gz: 0b3647fa05fb2a3932a673f9942a6ea59ec72552e414fc4082bdd30cf5ddfebce93f4addcea5aaafcacb8dfa01efdffc3dfac34b72b4aed9bee5c4867b91f616
|
data/README.md
CHANGED
@@ -1,2 +1,85 @@
|
|
1
1
|
# volt-slim
|
2
2
|
Slim for Volt framework
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
|
6
|
+
Add this line to your application's Gemfile:
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
gem 'volt-slim'
|
10
|
+
```
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
|
18
|
+
Create view with `slim` extension.
|
19
|
+
|
20
|
+
Write your slim like this
|
21
|
+
|
22
|
+
# Examples
|
23
|
+
|
24
|
+
Example 1
|
25
|
+
In:
|
26
|
+
```slim
|
27
|
+
tpl-title
|
28
|
+
| App title
|
29
|
+
tpl-body
|
30
|
+
| ...
|
31
|
+
use-sucess-alert
|
32
|
+
| ...
|
33
|
+
tpl-sucess-alert
|
34
|
+
.alert
|
35
|
+
Your alert
|
36
|
+
```
|
37
|
+
OUT:
|
38
|
+
```xml
|
39
|
+
<:Title>
|
40
|
+
App title
|
41
|
+
<:Body>
|
42
|
+
...
|
43
|
+
<:sucess-alert></:sucess-alert>
|
44
|
+
...
|
45
|
+
<:Sucess-alert>
|
46
|
+
.alert
|
47
|
+
Your alert
|
48
|
+
```
|
49
|
+
|
50
|
+
Example 2
|
51
|
+
IN:
|
52
|
+
```slim
|
53
|
+
tpl-body
|
54
|
+
| ...
|
55
|
+
.class1 class=(true ? 'true-class' : 'false-class' ) | text
|
56
|
+
- array.each do |item|
|
57
|
+
.item
|
58
|
+
= item[:name]
|
59
|
+
| ...
|
60
|
+
```
|
61
|
+
OUT:
|
62
|
+
```xml
|
63
|
+
<:Body>
|
64
|
+
...
|
65
|
+
<div class="class1 {{ true ? 'true-class' : 'false-class' }}">
|
66
|
+
| text
|
67
|
+
</div>
|
68
|
+
{{ array.each do |item| }}
|
69
|
+
<div class="item">
|
70
|
+
{{ item[:name] }}
|
71
|
+
</div>
|
72
|
+
{{ end }}
|
73
|
+
...
|
74
|
+
```
|
75
|
+
|
76
|
+
## Development
|
77
|
+
|
78
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
79
|
+
|
80
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
81
|
+
|
82
|
+
## Contributing
|
83
|
+
|
84
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ASnow/volt-slim.
|
85
|
+
|
data/lib/volt/slim/compiler.rb
CHANGED
@@ -2,7 +2,7 @@ module Volt
|
|
2
2
|
module Slim
|
3
3
|
class Compiler
|
4
4
|
def self.build template
|
5
|
-
SandlebarsConverter.new({pretty:
|
5
|
+
SandlebarsConverter.new({pretty: false, use_html_safe: false, disable_escape: true}).call(template)
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
@@ -3,9 +3,12 @@ module Volt
|
|
3
3
|
module Filters
|
4
4
|
# @api private
|
5
5
|
class Controls < ::Slim::Controls
|
6
|
+
def on_slim_output(escape, code, content)
|
7
|
+
content.pop if content == [:multi, [:newline]]
|
8
|
+
super
|
9
|
+
end
|
6
10
|
def on_slim_control(code, content)
|
7
11
|
[:multi,
|
8
|
-
[:code, :indent],
|
9
12
|
[:code, code],
|
10
13
|
compile(content)]
|
11
14
|
end
|
data/lib/volt/slim/version.rb
CHANGED
data/volt-slim.gemspec
CHANGED
@@ -8,11 +8,13 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Volt::Slim::VERSION
|
9
9
|
spec.authors = ["Андрей Большов"]
|
10
10
|
spec.email = ["asnow.dev@gmail.ru"]
|
11
|
+
spec.license = 'MIT'
|
11
12
|
|
12
13
|
spec.summary = %q{Allow you use slim templates in volt framework.}
|
13
14
|
spec.description = %q{This gem translate slim to volt template.}
|
14
15
|
spec.homepage = "http://github.com/asnow/volt-slim"
|
15
16
|
|
17
|
+
|
16
18
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
19
|
spec.bindir = "exe"
|
18
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
@@ -20,7 +22,8 @@ Gem::Specification.new do |spec|
|
|
20
22
|
|
21
23
|
spec.add_development_dependency "bundler", "~> 1.10"
|
22
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
-
spec.add_development_dependency "rspec"
|
24
|
-
spec.add_dependency "
|
25
|
+
spec.add_development_dependency "rspec", "~> 0"
|
26
|
+
spec.add_dependency "volt", "~> 0.9.6"
|
27
|
+
spec.add_dependency "slim", "~> 0"
|
25
28
|
spec.add_dependency 'sorcerer'
|
26
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: volt-slim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Андрей Большов"
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -42,28 +42,42 @@ dependencies:
|
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: volt
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.9.6
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.9.6
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: slim
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - "
|
73
|
+
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: '0'
|
62
76
|
type: :runtime
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- - "
|
80
|
+
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
@@ -109,7 +123,8 @@ files:
|
|
109
123
|
- lib/volt/slim/version.rb
|
110
124
|
- volt-slim.gemspec
|
111
125
|
homepage: http://github.com/asnow/volt-slim
|
112
|
-
licenses:
|
126
|
+
licenses:
|
127
|
+
- MIT
|
113
128
|
metadata: {}
|
114
129
|
post_install_message:
|
115
130
|
rdoc_options: []
|