skim 0.9.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +0 -1
- data/.ruby-version +1 -0
- data/.travis.yml +2 -1
- data/History.md +25 -0
- data/LICENSE +2 -2
- data/README.md +48 -19
- data/bin/skim +6 -0
- data/lib/skim.rb +2 -5
- data/lib/skim/command.rb +141 -0
- data/lib/skim/engine.rb +12 -12
- data/lib/skim/sprockets.rb +16 -0
- data/lib/skim/template.rb +9 -1
- data/lib/skim/version.rb +1 -1
- data/lib/temple/coffee_script/generators.rb +2 -5
- data/skim.gemspec +12 -10
- data/test/helper.rb +7 -6
- data/test/test_attribute_merger.rb +1 -1
- data/test/test_code_blocks.rb +32 -14
- data/test/test_code_output.rb +4 -4
- data/test/test_commands.rb +203 -0
- data/test/test_html_escaping.rb +1 -2
- data/test/test_html_structure.rb +6 -6
- data/test/test_skim_template.rb +2 -2
- data/vendor/assets/javascripts/skim.js.coffee +5 -3
- metadata +56 -63
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: be0b29f6955ce76137070ba09b3472195a065c2d773aee16e29c0876cb167d46
|
4
|
+
data.tar.gz: 708c7d0a475fdfdebb68aea3736aa8c71ad0defdeaa05cf63fe350095cb84e42
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 22f31e4516bc4742782dac10a29799105855c3d02e4ef92e8b05cb7c6ec4240e5d09798ecb13d635b7812896eba856b49d70ac3c040f9ab6f51c2b33492104e8
|
7
|
+
data.tar.gz: 13697db4450022d4195a9093827b6d160893c90c688cfd5c30a003604e4b415dece32cf94d7595e9496d9d839bcb96510a13f1c452c809469f963381b5c14217
|
data/.gitignore
CHANGED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.6.6
|
data/.travis.yml
CHANGED
data/History.md
CHANGED
@@ -1,5 +1,30 @@
|
|
1
1
|
# master
|
2
2
|
|
3
|
+
# 0.11.0
|
4
|
+
|
5
|
+
* Add skim command-line interface
|
6
|
+
* Compatibility with Rails 6 and Sprockets 4
|
7
|
+
* Fix "Syntax Error: Unexpected &" bug (#48) -- thanks to @pavelkomiagin!
|
8
|
+
* Update README with CLI documentation and new copyright notice
|
9
|
+
* Update LICENSE for new maintainership
|
10
|
+
* Upgrade Travis infrastructure
|
11
|
+
|
12
|
+
# 0.10.0
|
13
|
+
|
14
|
+
* Compatibility with Rails 4.2, Slim 3, and Sprockets 3
|
15
|
+
|
16
|
+
# 0.9.3
|
17
|
+
|
18
|
+
* Manually append assets path if Rails not available (#33)
|
19
|
+
|
20
|
+
# 0.9.2
|
21
|
+
|
22
|
+
* Performance improvements
|
23
|
+
|
24
|
+
# 0.9.1
|
25
|
+
|
26
|
+
* Fix 'SyntaxError: unexpected LOGIC' bug (#30)
|
27
|
+
|
3
28
|
# 0.9.0
|
4
29
|
|
5
30
|
* Now uses/requires slim 2.0.0
|
data/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2012 John Firebaugh
|
1
|
+
Copyright (c) 2012 John Firebaugh, (c) 2015 AppJudo Inc.
|
2
2
|
|
3
3
|
MIT License
|
4
4
|
|
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
19
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
21
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,21 +1,18 @@
|
|
1
|
-
Skim [ ![Build status](https://travis-ci.org/
|
1
|
+
Skim [ ![Build status](https://travis-ci.org/appjudo/skim.png) ](https://travis-ci.org/appjudo/skim)
|
2
2
|
====
|
3
3
|
|
4
4
|
Take the fat out of your client-side templates with Skim. Skim is the [Slim](http://slim-lang.com/) templating engine
|
5
5
|
with embedded CoffeeScript. It compiles to JavaScript templates (`.jst`), which can then be served by Rails or any other
|
6
6
|
Sprockets-based asset pipeline.
|
7
7
|
|
8
|
-
#
|
8
|
+
# Install
|
9
9
|
|
10
|
-
`gem install skim`, or add `skim` to your `Gemfile
|
10
|
+
`gem install skim`, or add `skim` to your `Gemfile`.
|
11
11
|
|
12
|
-
|
13
|
-
group :assets do
|
14
|
-
gem 'skim'
|
15
|
-
end
|
16
|
-
```
|
12
|
+
# Usage
|
17
13
|
|
18
|
-
Create template files with the extension
|
14
|
+
Create template files with the extension
|
15
|
+
`.jst.skim`. For example, `test.jst.skim`:
|
19
16
|
|
20
17
|
```jade
|
21
18
|
p Hello #{@world}!
|
@@ -27,16 +24,38 @@ In your JavaScript or CoffeeScript, render the result, passing a context object:
|
|
27
24
|
$("body").html(JST["test"]({world: "World"}));
|
28
25
|
```
|
29
26
|
|
30
|
-
|
27
|
+
## Command Line Interface
|
28
|
+
|
29
|
+
The CLI allows Skim to be used in Gulp and Grunt workflows, extending the reach of Skim from the Ruby world into the JS/ES/CoffeeScript communities.
|
30
|
+
|
31
|
+
Features:
|
32
|
+
- Options to output Skim asset and templates separately.
|
33
|
+
- Options to assign template function to `module.exports`, a global function variable, or a global object (keyed by filename, as Sprockets does with its `JST` object).
|
34
|
+
|
35
|
+
Usage: `skim [options]`
|
36
|
+
|
37
|
+
```
|
38
|
+
-s, --stdin Read input from standard input instead of an input file
|
39
|
+
-e, --export Assign to module.exports for CommonJS require
|
40
|
+
-n, --node-global Use Node.js global object for global assignments
|
41
|
+
--jst Assign to global JST object keyed by truncated filename
|
42
|
+
--assign variableName Assign to a global variable
|
43
|
+
--assign-object objectName Assign to a global object keyed by truncated filename
|
44
|
+
--asset-only Output only the Skim preamble asset
|
45
|
+
--omit-asset Omit Skim preamble asset from output
|
46
|
+
--trace Show a full traceback on error
|
47
|
+
-o, --option name=code Set skim option
|
48
|
+
-r, --require library Load library or plugin
|
49
|
+
-h, --help Show this help message
|
50
|
+
-v, --version Print version number
|
51
|
+
```
|
31
52
|
|
32
53
|
# Caveats
|
33
54
|
|
34
55
|
Skim is an early proof-of-concept. Some Slim features are still missing:
|
35
56
|
|
36
|
-
* Skim does not currently support embedded engines. Being a client-side templating languages, it will only be able to
|
37
|
-
|
38
|
-
* Skim does not currently support HTML pretty-printing (Slim's `:pretty` option). This is low priority, as
|
39
|
-
pretty-printing is even less important client-side than server-side.
|
57
|
+
* Skim does not currently support embedded engines. Being a client-side templating languages, it will only be able to support embedded engines with a client-side implementation.
|
58
|
+
* Skim does not currently support HTML pretty-printing (Slim's `:pretty` option). This is low priority, as pretty-printing is even less important client-side than server-side.
|
40
59
|
* Skim does not currently support backslash line continuations.
|
41
60
|
|
42
61
|
# Language reference
|
@@ -60,16 +79,17 @@ string.
|
|
60
79
|
* You will typically want to use the fat arrow `=>` function definition to create callbacks, to preserve the binding of
|
61
80
|
`this` analogously to how `self` behaves in a Ruby block.
|
62
81
|
|
63
|
-
## The
|
82
|
+
## The Context Object
|
64
83
|
|
65
84
|
The context object you pass to the compiled template function becomes the value of this inside your template. You can
|
66
85
|
use CoffeeScript's `@` sigil to easily access properties and call helper methods on the context object.
|
67
86
|
|
68
|
-
## Escaping and
|
87
|
+
## Escaping and Unescaping
|
69
88
|
|
70
89
|
Like Slim, Skim escapes dynamic output by default, and it supports the same `==` and `#{{}}` syntaxes for bypassing
|
71
90
|
escaping. In addition, the special `safe` method on the context object tells Skim that the string can be output without
|
72
91
|
being escaped. You can use this in conjunction with `escape` context method to selectively sanitize parts of the string.
|
92
|
+
|
73
93
|
For example, given the template:
|
74
94
|
|
75
95
|
```jade
|
@@ -93,7 +113,7 @@ to produce:
|
|
93
113
|
<a href='/projects/4'>Crate & Barrel</a>
|
94
114
|
```
|
95
115
|
|
96
|
-
## The Skim
|
116
|
+
## The Skim Asset
|
97
117
|
|
98
118
|
By default, all you need to do to start using Skim is add it to your Gemfile. Skim will embed a small amount of
|
99
119
|
supporting code in each generated template asset. You can remove this duplication by manually including Skim's asset,
|
@@ -111,9 +131,17 @@ And the following in an initializer:
|
|
111
131
|
Skim::Engine.default_options[:use_asset] = true
|
112
132
|
```
|
113
133
|
|
134
|
+
Skim templates also support dependency injection for the Skim asset, instead of using a global Skim variable. Example in Node.js:
|
135
|
+
|
136
|
+
```js
|
137
|
+
var Skim = require('./skim_asset_module.js')
|
138
|
+
var template = require('./template_module.js');
|
139
|
+
console.log(template({Skim: Skim, first_name: 'Dave', last_name: 'Smith'}));
|
140
|
+
```
|
141
|
+
|
114
142
|
# License (MIT)
|
115
143
|
|
116
|
-
Copyright (c) 2012 John Firebaugh
|
144
|
+
Copyright (c) 2012 John Firebaugh, (c) 2015 AppJudo Inc.
|
117
145
|
|
118
146
|
Permission is hereby granted, free of charge, to any person obtaining
|
119
147
|
a copy of this software and associated documentation files (the
|
@@ -136,6 +164,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
136
164
|
|
137
165
|
# Special Thanks
|
138
166
|
|
167
|
+
* John Firebaugh, for creating Skim
|
139
168
|
* Andrew Stone, for Slim
|
140
169
|
* Magnus Holm, for Temple
|
141
|
-
* Daniel Mendler, for maintenance of
|
170
|
+
* Daniel Mendler, for maintenance of Slim and Temple
|
data/bin/skim
ADDED
data/lib/skim.rb
CHANGED
@@ -9,8 +9,5 @@ require "skim/engine"
|
|
9
9
|
require "skim/template"
|
10
10
|
require "skim/version"
|
11
11
|
|
12
|
-
require "skim/rails" if
|
13
|
-
|
14
|
-
require "sprockets"
|
15
|
-
Sprockets::Engines # force autoload
|
16
|
-
Sprockets.register_engine ".skim", Skim::Template
|
12
|
+
require "skim/rails" if defined?(Rails::Engine)
|
13
|
+
require "skim/sprockets"
|
data/lib/skim/command.rb
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
require 'skim'
|
2
|
+
require 'optparse'
|
3
|
+
|
4
|
+
module Skim
|
5
|
+
class Command
|
6
|
+
def initialize(args)
|
7
|
+
@args = args
|
8
|
+
@options = {}
|
9
|
+
end
|
10
|
+
|
11
|
+
# Run command
|
12
|
+
def run
|
13
|
+
@opts = OptionParser.new(&method(:set_opts))
|
14
|
+
@opts.parse!(@args)
|
15
|
+
process
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
# Configure OptionParser
|
21
|
+
def set_opts(opts)
|
22
|
+
opts.on('-s', '--stdin', 'Read input from standard input instead of an input file') do
|
23
|
+
@input = $stdin
|
24
|
+
end
|
25
|
+
|
26
|
+
opts.on('-e', '--export', 'Assign to module.exports for CommonJS require') do
|
27
|
+
@export = true
|
28
|
+
end
|
29
|
+
|
30
|
+
opts.on('-n', '--node-global', 'Use Node.js global object for global assignments') do
|
31
|
+
@node_global = true
|
32
|
+
end
|
33
|
+
|
34
|
+
opts.on('--jst', 'Assign to global JST object keyed by truncated filename') do
|
35
|
+
@assign_object_name = 'JST'
|
36
|
+
end
|
37
|
+
|
38
|
+
opts.on('--assign variableName', 'Assign to a global variable') do |str|
|
39
|
+
@assign_variable_name = str
|
40
|
+
end
|
41
|
+
|
42
|
+
opts.on('--assign-object objectName', 'Assign to a global object keyed by truncated filename') do |str|
|
43
|
+
@assign_object_name = str
|
44
|
+
end
|
45
|
+
|
46
|
+
opts.on('--asset-only', 'Output only the Skim preamble asset') do
|
47
|
+
@asset_only = true
|
48
|
+
end
|
49
|
+
|
50
|
+
opts.on('--omit-asset', 'Omit Skim preamble asset from output') do
|
51
|
+
@options[:use_asset] = true
|
52
|
+
end
|
53
|
+
|
54
|
+
opts.on('--trace', 'Show a full traceback on error') do
|
55
|
+
@trace = true
|
56
|
+
end
|
57
|
+
|
58
|
+
opts.on('-o', '--option name=code', String, 'Set skim option') do |str|
|
59
|
+
parts = str.split('=', 2)
|
60
|
+
Engine.options[parts.first.gsub(/\A:/, '').to_sym] = eval(parts.last)
|
61
|
+
end
|
62
|
+
|
63
|
+
opts.on('-r', '--require library', "Load library or plugin") do |lib|
|
64
|
+
require lib.strip
|
65
|
+
end
|
66
|
+
|
67
|
+
opts.on_tail('-h', '--help', 'Show this help message') do
|
68
|
+
puts opts
|
69
|
+
exit
|
70
|
+
end
|
71
|
+
|
72
|
+
opts.on_tail('-v', '--version', 'Print version number') do
|
73
|
+
puts "Skim #{VERSION}"
|
74
|
+
exit
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# Process command
|
79
|
+
def process
|
80
|
+
args = @args.dup
|
81
|
+
result = if @asset_only
|
82
|
+
CoffeeScript.compile(Skim::Template.skim_src)
|
83
|
+
else
|
84
|
+
unless @input
|
85
|
+
filename = args.shift
|
86
|
+
if filename
|
87
|
+
@filename = filename
|
88
|
+
@input = File.open(filename, 'r')
|
89
|
+
else
|
90
|
+
@filename = 'STDIN'
|
91
|
+
@input = $stdin
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
locals = @options.delete(:locals) || {}
|
96
|
+
Template.new(@filename, @options) { @input.read }.render(nil, locals)
|
97
|
+
end
|
98
|
+
|
99
|
+
result = prepend_assignment(result)
|
100
|
+
|
101
|
+
rescue Exception => ex
|
102
|
+
raise ex if @trace || SystemExit === ex
|
103
|
+
$stderr.print "#{ex.class}: " if ex.class != RuntimeError
|
104
|
+
$stderr.puts ex.message
|
105
|
+
$stderr.puts ' Use --trace for backtrace.'
|
106
|
+
exit 1
|
107
|
+
else
|
108
|
+
unless @options[:output]
|
109
|
+
filename = args.shift
|
110
|
+
@options[:output] = filename ? File.open(filename, 'w') : $stdout
|
111
|
+
end
|
112
|
+
@options[:output].puts(result)
|
113
|
+
exit 0
|
114
|
+
end
|
115
|
+
|
116
|
+
def prepend_assignment(result)
|
117
|
+
assignment = ''
|
118
|
+
initialization = ''
|
119
|
+
|
120
|
+
global = 'this'
|
121
|
+
if @node_global
|
122
|
+
global = 'global'
|
123
|
+
result.sub!(/(this)(\.Skim =)/) {"#{global}#{$2}"}
|
124
|
+
end
|
125
|
+
|
126
|
+
assignment += "module.exports = " if @export
|
127
|
+
assignment += "#{global}.#{@assign_variable_name} = " if @assign_variable_name
|
128
|
+
if @assign_object_name
|
129
|
+
object_name = "#{global}.#{@assign_object_name}"
|
130
|
+
initialization = "#{object_name} || (#{object_name} = {});\n"
|
131
|
+
assignment += "#{object_name}[#{truncated_filename.inspect}] = "
|
132
|
+
end
|
133
|
+
|
134
|
+
assignment.empty? ? result : (initialization + assignment + result)
|
135
|
+
end
|
136
|
+
|
137
|
+
def truncated_filename
|
138
|
+
@filename.sub(/\.[^#{File::SEPARATOR}]*\Z/, '')
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
data/lib/skim/engine.rb
CHANGED
@@ -14,25 +14,25 @@ module Skim
|
|
14
14
|
:default_tag => 'div',
|
15
15
|
:use_asset => false
|
16
16
|
|
17
|
-
filter :Encoding
|
17
|
+
filter :Encoding
|
18
18
|
filter :RemoveBOM
|
19
|
-
use Slim::Parser
|
20
|
-
use Slim::Embedded
|
19
|
+
use Slim::Parser
|
20
|
+
use Slim::Embedded
|
21
21
|
use Skim::Interpolation
|
22
|
-
use Slim::Splat::Filter
|
23
|
-
use Skim::Controls
|
24
|
-
html :AttributeSorter
|
25
|
-
|
26
|
-
use Skim::CodeAttributes
|
22
|
+
use Slim::Splat::Filter
|
23
|
+
use Skim::Controls
|
24
|
+
html :AttributeSorter
|
25
|
+
use Temple::CoffeeScript::AttributeMerger
|
26
|
+
use Skim::CodeAttributes
|
27
27
|
use(:AttributeRemover) { Temple::CoffeeScript::AttributeRemover.new(:remove_empty_attrs => options[:merge_attrs].keys)}
|
28
|
-
html :Pretty
|
29
|
-
use Temple::HTML::Fast
|
30
|
-
use Temple::CoffeeScript::Filters::Escapable
|
28
|
+
html :Pretty
|
29
|
+
use Temple::HTML::Fast
|
30
|
+
use Temple::CoffeeScript::Filters::Escapable
|
31
31
|
use Temple::CoffeeScript::Filters::ControlFlow
|
32
32
|
filter :MultiFlattener
|
33
33
|
use(:Optimizer) { Temple::Filters::StaticMerger.new }
|
34
34
|
use :Generator do
|
35
|
-
options[:generator].new(options.to_hash.reject {|k,v| !options[:generator].
|
35
|
+
options[:generator].new(options.to_hash.reject {|k,v| !options[:generator].options.valid_keys.include?(k) })
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require "sprockets"
|
2
|
+
|
3
|
+
if Sprockets.respond_to?(:register_transformer)
|
4
|
+
Sprockets.register_mime_type 'text/skim', extensions: ['.skim', '.jst.skim'], charset: :unicode
|
5
|
+
Sprockets.register_transformer 'text/skim', 'application/javascript+function', Skim::Template
|
6
|
+
end
|
7
|
+
|
8
|
+
if Sprockets.respond_to?(:register_engine)
|
9
|
+
args = ['.skim', Skim::Template]
|
10
|
+
args << { mime_type: 'application/javascript', silence_deprecation: true } if Sprockets::VERSION.start_with?('3')
|
11
|
+
Sprockets.register_engine(*args)
|
12
|
+
end
|
13
|
+
|
14
|
+
unless defined?(Rails::Engine)
|
15
|
+
Sprockets.append_path File.expand_path('../../../vendor/assets/javascripts', __FILE__)
|
16
|
+
end
|
data/lib/skim/template.rb
CHANGED
@@ -6,6 +6,14 @@ module Skim
|
|
6
6
|
class Template
|
7
7
|
self.default_mime_type = "application/javascript"
|
8
8
|
|
9
|
+
def self.call(input)
|
10
|
+
source = input[:data]
|
11
|
+
context = input[:environment].context_class.new(input)
|
12
|
+
|
13
|
+
result = new { source }.render
|
14
|
+
context.metadata.merge(data: result)
|
15
|
+
end
|
16
|
+
|
9
17
|
def coffee_script_src
|
10
18
|
|
11
19
|
engine = Engine.new(options.merge({
|
@@ -17,7 +25,7 @@ module Skim
|
|
17
25
|
<<-SRC
|
18
26
|
#{self.class.skim_src unless engine.options[:use_asset]}
|
19
27
|
return (context = {}) ->
|
20
|
-
Skim.withContext.call {}, context, ->
|
28
|
+
(context.Skim || Skim).withContext.call {}, context, ->
|
21
29
|
#{src}
|
22
30
|
SRC
|
23
31
|
end
|
data/lib/skim/version.rb
CHANGED
@@ -7,10 +7,7 @@ module Temple
|
|
7
7
|
|
8
8
|
def call(exp)
|
9
9
|
@indent = options[:indent]
|
10
|
-
compile [:multi,
|
11
|
-
[:code, "#{buffer} = []"],
|
12
|
-
exp,
|
13
|
-
[:code, "#{buffer}.join('')"]]
|
10
|
+
compile [:multi, [:code, "#{buffer} = ''"], exp, [:code, "#{buffer}"]]
|
14
11
|
end
|
15
12
|
|
16
13
|
def on_multi(*exp)
|
@@ -41,7 +38,7 @@ module Temple
|
|
41
38
|
end
|
42
39
|
|
43
40
|
def concat(str)
|
44
|
-
indent
|
41
|
+
indent "#{buffer} += #{str}"
|
45
42
|
end
|
46
43
|
|
47
44
|
def indent(str, indent = @indent)
|
data/skim.gemspec
CHANGED
@@ -2,29 +2,31 @@
|
|
2
2
|
require File.expand_path('../lib/skim/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
|
-
gem.authors = [
|
6
|
-
gem.email = [
|
5
|
+
gem.authors = ['AppJudo Inc.']
|
6
|
+
gem.email = ['info@appjudo.com']
|
7
7
|
gem.description = %q{Fat-free client-side templates with Slim and CoffeeScript}
|
8
8
|
gem.summary = %q{Take the fat out of your client-side templates with Skim. Skim is the Slim templating engine
|
9
9
|
with embedded CoffeeScript. It compiles to JavaScript templates (.jst), which can then be served by Rails or any other
|
10
10
|
Sprockets-based asset pipeline.}
|
11
|
-
gem.homepage =
|
11
|
+
gem.homepage = ''
|
12
12
|
|
13
13
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
14
14
|
gem.files = `git ls-files`.split("\n")
|
15
|
+
gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
15
16
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
-
gem.name =
|
17
|
-
gem.require_paths = [
|
17
|
+
gem.name = 'skim'
|
18
|
+
gem.require_paths = ['lib']
|
18
19
|
gem.version = Skim::VERSION
|
20
|
+
gem.license = 'MIT'
|
19
21
|
|
20
|
-
gem.add_dependency "slim",
|
22
|
+
gem.add_dependency "slim", '>= 3.0'
|
21
23
|
gem.add_dependency "coffee-script"
|
22
24
|
gem.add_dependency "coffee-script-source", ">= 1.2.0"
|
23
|
-
gem.add_dependency "sprockets"
|
25
|
+
gem.add_dependency "sprockets", ">= 2.0", "< 5.0"
|
24
26
|
|
25
27
|
gem.add_development_dependency "rake"
|
28
|
+
gem.add_development_dependency "pry"
|
26
29
|
gem.add_development_dependency "execjs"
|
27
|
-
gem.add_development_dependency "minitest-reporters"
|
28
|
-
gem.add_development_dependency "
|
29
|
-
gem.add_development_dependency "libv8", "3.11.8.3"
|
30
|
+
gem.add_development_dependency "minitest-reporters"
|
31
|
+
gem.add_development_dependency "libv8", "~> 8.4"
|
30
32
|
end
|
data/test/helper.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
require "rubygems"
|
2
|
-
require "minitest/
|
2
|
+
require "minitest/autorun"
|
3
3
|
require "minitest/reporters"
|
4
4
|
require "skim"
|
5
5
|
require "coffee_script"
|
6
6
|
require "execjs"
|
7
|
+
require "pry"
|
7
8
|
|
8
9
|
if ENV["RM_INFO"] || ENV["TEAMCITY_VERSION"]
|
9
10
|
MiniTest::Reporters.use! MiniTest::Reporters::RubyMineReporter.new
|
@@ -11,9 +12,9 @@ else
|
|
11
12
|
MiniTest::Reporters.use! MiniTest::Reporters::ProgressReporter.new
|
12
13
|
end
|
13
14
|
|
14
|
-
|
15
|
+
Minitest.autorun
|
15
16
|
|
16
|
-
class TestSkim <
|
17
|
+
class TestSkim < Minitest::Test
|
17
18
|
def context_source
|
18
19
|
File.read(File.expand_path("../context.coffee", __FILE__))
|
19
20
|
end
|
@@ -48,7 +49,7 @@ class TestSkim < MiniTest::Unit::TestCase
|
|
48
49
|
"var template = #{compile(source, options)}",
|
49
50
|
"var evaluate = function () { return template(context); }"
|
50
51
|
]
|
51
|
-
if Skim::Engine.
|
52
|
+
if Skim::Engine.options[:use_asset]
|
52
53
|
code.unshift skim_source
|
53
54
|
end
|
54
55
|
|
@@ -68,10 +69,10 @@ class TestSkim < MiniTest::Unit::TestCase
|
|
68
69
|
yield
|
69
70
|
|
70
71
|
begin
|
71
|
-
Skim::Engine.
|
72
|
+
Skim::Engine.options[:use_asset] = true
|
72
73
|
yield
|
73
74
|
ensure
|
74
|
-
Skim::Engine.
|
75
|
+
Skim::Engine.options[:use_asset] = false
|
75
76
|
end
|
76
77
|
end
|
77
78
|
|
data/test/test_code_blocks.rb
CHANGED
@@ -4,8 +4,7 @@ class TestSkimCodeBlocks < TestSkim
|
|
4
4
|
def test_render_with_output_code_block
|
5
5
|
source = %q{
|
6
6
|
p
|
7
|
-
= @callback "Hello Ruby!", ->
|
8
|
-
| Hello from within a block!
|
7
|
+
= @callback "Hello Ruby!", -> 'Hello from within a block!'
|
9
8
|
}
|
10
9
|
|
11
10
|
assert_html '<p>Hello Ruby! Hello from within a block! Hello Ruby!</p>', source
|
@@ -14,8 +13,7 @@ p
|
|
14
13
|
def test_render_with_output_code_within_block
|
15
14
|
source = %q{
|
16
15
|
p
|
17
|
-
= @callback "Hello Ruby!", =>
|
18
|
-
= @callback "Hello from within a block!"
|
16
|
+
= @callback "Hello Ruby!", => @callback "Hello from within a block!"
|
19
17
|
}
|
20
18
|
|
21
19
|
assert_html '<p>Hello Ruby! Hello from within a block! Hello Ruby!</p>', source
|
@@ -24,9 +22,7 @@ p
|
|
24
22
|
def test_render_with_output_code_within_block_2
|
25
23
|
source = %q{
|
26
24
|
p
|
27
|
-
= @callback "Hello Ruby!", =>
|
28
|
-
= @callback "Hello from within a block!", =>
|
29
|
-
= @callback "And another one!"
|
25
|
+
= @callback "Hello Ruby!", => @callback "Hello from within a block!", => @callback "And another one!"
|
30
26
|
}
|
31
27
|
|
32
28
|
assert_html '<p>Hello Ruby! Hello from within a block! And another one! Hello from within a block! Hello Ruby!</p>', source
|
@@ -35,9 +31,7 @@ p
|
|
35
31
|
def test_output_block_with_arguments
|
36
32
|
source = %q{
|
37
33
|
p
|
38
|
-
= @define_macro 'person', (first_name, last_name) =>
|
39
|
-
.first_name = first_name
|
40
|
-
.last_name = last_name
|
34
|
+
= @define_macro 'person', (first_name, last_name) => "<div class=\"first_name\">#{first_name}</div><div class=\"last_name\">#{last_name}</div>"
|
41
35
|
== @call_macro 'person', 'John', 'Doe'
|
42
36
|
== @call_macro 'person', 'Max', 'Mustermann'
|
43
37
|
}
|
@@ -66,6 +60,15 @@ p
|
|
66
60
|
assert_html '<p>Hey!Hey!Hey!</p>', source
|
67
61
|
end
|
68
62
|
|
63
|
+
def test_render_with_control_code_for_in_loop_without_parent
|
64
|
+
source = %q{
|
65
|
+
- for i in [0..2]
|
66
|
+
p Hey!
|
67
|
+
}
|
68
|
+
|
69
|
+
assert_html '<p>Hey!</p><p>Hey!</p><p>Hey!</p>', source
|
70
|
+
end
|
71
|
+
|
69
72
|
def test_render_with_control_code_for_own_of_loop
|
70
73
|
source = %q{
|
71
74
|
p
|
@@ -78,11 +81,26 @@ p
|
|
78
81
|
|
79
82
|
def test_captured_code_block_with_conditional
|
80
83
|
source = %q{
|
81
|
-
= @callback "Hello Ruby!", ->
|
82
|
-
- if true
|
83
|
-
| Hello from within a block!
|
84
|
+
= @callback "Hello Ruby!", -> 'Hello from within a block!' if true
|
84
85
|
}
|
85
86
|
|
86
87
|
assert_html 'Hello Ruby! Hello from within a block! Hello Ruby!', source
|
87
88
|
end
|
88
|
-
|
89
|
+
|
90
|
+
def test_attribute_merger
|
91
|
+
source = %q{
|
92
|
+
.hello class='ruby' Hello Ruby!
|
93
|
+
}
|
94
|
+
|
95
|
+
assert_html '<div class="hello ruby">Hello Ruby!</div>', source
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_attribute_merger_with_not_static_class_attr
|
99
|
+
source = %q{
|
100
|
+
- class_name = 'ruby'
|
101
|
+
.hello class=class_name Hello Ruby!
|
102
|
+
}
|
103
|
+
|
104
|
+
assert_html '<div class="hello ruby">Hello Ruby!</div>', source
|
105
|
+
end
|
106
|
+
end
|
data/test/test_code_output.rb
CHANGED
@@ -13,7 +13,7 @@ p
|
|
13
13
|
def test_render_with_trailing_whitespace
|
14
14
|
source = %q{
|
15
15
|
p
|
16
|
-
|
16
|
+
=> @hello_world()
|
17
17
|
}
|
18
18
|
|
19
19
|
assert_html '<p>Hello World from @env </p>', source
|
@@ -21,7 +21,7 @@ p
|
|
21
21
|
|
22
22
|
def test_render_with_trailing_whitespace_after_tag
|
23
23
|
source = %q{
|
24
|
-
p
|
24
|
+
p=> @hello_world()
|
25
25
|
}
|
26
26
|
|
27
27
|
assert_html '<p>Hello World from @env</p> ', source
|
@@ -30,7 +30,7 @@ p=' @hello_world()
|
|
30
30
|
def test_no_escape_render_with_trailing_whitespace
|
31
31
|
source = %q{
|
32
32
|
p
|
33
|
-
|
33
|
+
==> @hello_world()
|
34
34
|
}
|
35
35
|
|
36
36
|
assert_html '<p>Hello World from @env </p>', source
|
@@ -38,7 +38,7 @@ p
|
|
38
38
|
|
39
39
|
def test_no_escape_render_with_trailing_whitespace_after_tag
|
40
40
|
source = %q{
|
41
|
-
p
|
41
|
+
p==> @hello_world()
|
42
42
|
}
|
43
43
|
|
44
44
|
assert_html '<p>Hello World from @env</p> ', source
|
@@ -0,0 +1,203 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'helper'
|
3
|
+
require 'open3'
|
4
|
+
require 'tempfile'
|
5
|
+
|
6
|
+
class TestSkimCommands < Minitest::Test
|
7
|
+
# nothing complex
|
8
|
+
STATIC_TEMPLATE = "p Hello World!\n"
|
9
|
+
|
10
|
+
# requires a `name` variable to exist at render time
|
11
|
+
DYNAMIC_TEMPLATE = "p Hello \#{name}!\n"
|
12
|
+
|
13
|
+
# a more complex example
|
14
|
+
LONG_TEMPLATE = "h1 Hello\np\n | World!\n small Tiny text"
|
15
|
+
|
16
|
+
# exception raising example
|
17
|
+
INVALID_TEMPLATE = '- if true'
|
18
|
+
|
19
|
+
def test_option_help
|
20
|
+
out, err = exec_skim '--help'
|
21
|
+
assert err.empty?
|
22
|
+
assert_match /Show this help message/, out
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_option_version
|
26
|
+
out, err = exec_skim '--version'
|
27
|
+
assert err.empty?
|
28
|
+
assert_match /\ASkim #{Regexp.escape Skim::VERSION}$/, out
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_export
|
32
|
+
prepare_common_test STATIC_TEMPLATE, '--export' do |out, err|
|
33
|
+
assert err.empty?
|
34
|
+
assert_equal "<p>Hello World!</p>", evaluate_node(out, 'module.exports()')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_assign_variable
|
39
|
+
prepare_common_test STATIC_TEMPLATE, '--assign', 'myFunction' do |out, err|
|
40
|
+
assert err.empty?
|
41
|
+
assert_equal "<p>Hello World!</p>", evaluate(out, 'myFunction()')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_assign_object
|
46
|
+
with_tempfile STATIC_TEMPLATE do |in_file|
|
47
|
+
out, err = exec_skim '--assign-object', 'myObject', in_file
|
48
|
+
assert err.empty?
|
49
|
+
key = in_file.chomp(File.extname(in_file))
|
50
|
+
assert_equal "<p>Hello World!</p>", evaluate(out, "myObject[#{key.inspect}]()")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_jst
|
55
|
+
with_tempfile STATIC_TEMPLATE do |in_file|
|
56
|
+
out, err = exec_skim '--jst', in_file
|
57
|
+
assert err.empty?
|
58
|
+
key = in_file.chomp(File.extname(in_file))
|
59
|
+
assert_equal "<p>Hello World!</p>", evaluate(out, "JST[#{key.inspect}]()")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_node_global
|
64
|
+
prepare_common_test STATIC_TEMPLATE, '--node-global', '--assign', 'myFunction' do |out, err|
|
65
|
+
assert err.empty?
|
66
|
+
assert_match /global\.Skim/, out
|
67
|
+
assert_equal "<p>Hello World!</p>", evaluate_node(out, 'global.myFunction()')
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_asset_only
|
72
|
+
out, err = exec_skim '--asset-only'
|
73
|
+
assert err.empty?
|
74
|
+
assert_match %r{withContext\: function}, out
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_omit_asset
|
78
|
+
prepare_common_test STATIC_TEMPLATE, '--omit-asset' do |out, err|
|
79
|
+
assert err.empty?
|
80
|
+
refute_match %r{withContext\: function}, out
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_require
|
85
|
+
with_tempfile 'puts "Not in skim"', 'rb' do |lib|
|
86
|
+
prepare_common_test STATIC_TEMPLATE, '--require', lib, stdin_file: false, file_file: false do |out, err|
|
87
|
+
assert err.empty?
|
88
|
+
assert_match %r{\ANot in skim\n}, out
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_error
|
94
|
+
prepare_common_test INVALID_TEMPLATE, stdin_file: false do |out, err|
|
95
|
+
assert out.empty?
|
96
|
+
assert_match /SyntaxError/, err
|
97
|
+
assert_match /Use --trace for backtrace/, err
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_trace_error
|
102
|
+
prepare_common_test INVALID_TEMPLATE, '--trace', stdin_file: false do |out, err|
|
103
|
+
assert out.empty?
|
104
|
+
assert_match /SyntaxError/, err
|
105
|
+
assert_match /bin\/skim/, err
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
private
|
110
|
+
|
111
|
+
# Executes a test (given as block) four times:
|
112
|
+
#
|
113
|
+
# 1. Read from $stdin, write to $stdout
|
114
|
+
# 2. Read from file, write to $stdout
|
115
|
+
# 3. Read from $stdin, write to file
|
116
|
+
# 4. Read from file, write to file
|
117
|
+
#
|
118
|
+
# Each of the above test executions yields a tuple (out, err).
|
119
|
+
# Any args given are passed to the skim command (before input/output args).
|
120
|
+
def prepare_common_test(content, *args)
|
121
|
+
options = Hash === args.last ? args.pop : {}
|
122
|
+
|
123
|
+
# case 1. $stdin → $stdout
|
124
|
+
unless options[:stdin_stdout] == false
|
125
|
+
out, err = exec_skim *args, '--stdin' do |i|
|
126
|
+
i.write content
|
127
|
+
end
|
128
|
+
yield out, err
|
129
|
+
end
|
130
|
+
|
131
|
+
# case 2. file → $stdout
|
132
|
+
unless options[:file_stdout] == false
|
133
|
+
with_tempfile content do |in_file|
|
134
|
+
out, err = exec_skim *args, in_file
|
135
|
+
yield out, err
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
# case 3. $stdin → file
|
140
|
+
unless options[:stdin_file] == false
|
141
|
+
with_tempfile content do |out_file|
|
142
|
+
_, err = exec_skim *args, '--stdin', out_file do |i|
|
143
|
+
i.write content
|
144
|
+
end
|
145
|
+
yield File.read(out_file), err
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
# case 4. file → file
|
150
|
+
unless options[:file_file] == false
|
151
|
+
with_tempfile '' do |out_file|
|
152
|
+
with_tempfile content do |in_file|
|
153
|
+
_, err = exec_skim *args, in_file, out_file do |i|
|
154
|
+
i.write content
|
155
|
+
end
|
156
|
+
yield File.read(out_file), err
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def evaluate(src, expression)
|
163
|
+
ExecJS.compile(src).eval(expression)
|
164
|
+
end
|
165
|
+
|
166
|
+
def evaluate_node(src, expression)
|
167
|
+
evaluate("var module = {};\nvar global = this;\n" + src, expression)
|
168
|
+
end
|
169
|
+
|
170
|
+
# Calls bin/skim as a subprocess.
|
171
|
+
#
|
172
|
+
# Yields $stdin to the caller and returns a tupel (out, err) with the
|
173
|
+
# contents of $stdout and $stderr.
|
174
|
+
def exec_skim(*args)
|
175
|
+
out, err = nil, nil
|
176
|
+
|
177
|
+
Open3.popen3 'ruby', 'bin/skim', *args do |stdin, stdout, stderr, wait_thread|
|
178
|
+
yield stdin if block_given?
|
179
|
+
stdin.close
|
180
|
+
out, err = stdout.read, stderr.read
|
181
|
+
end
|
182
|
+
|
183
|
+
return out, err
|
184
|
+
end
|
185
|
+
|
186
|
+
# Creates a temporary file with the given content and yield the path
|
187
|
+
# to this file. The file itself is only available inside the block and
|
188
|
+
# will be deleted afterwards.
|
189
|
+
def with_tempfile(content=nil, extname='skim')
|
190
|
+
f = Tempfile.new ['skim', ".#{extname}"]
|
191
|
+
if content
|
192
|
+
f.write content
|
193
|
+
f.flush # ensure content is actually saved to disk
|
194
|
+
f.rewind
|
195
|
+
end
|
196
|
+
|
197
|
+
yield f.path
|
198
|
+
ensure
|
199
|
+
f.close
|
200
|
+
f.unlink
|
201
|
+
end
|
202
|
+
|
203
|
+
end
|
data/test/test_html_escaping.rb
CHANGED
data/test/test_html_structure.rb
CHANGED
@@ -358,7 +358,7 @@ p<id="marvin"
|
|
358
358
|
class="martian"
|
359
359
|
data-info="Illudium Q-36"> = @output_number()
|
360
360
|
}
|
361
|
-
Slim::Parser
|
361
|
+
Slim::Parser.options[:attr_list_delims].each do |k,v|
|
362
362
|
str = source.sub('<',k).sub('>',v)
|
363
363
|
assert_html '<p class="martian" data-info="Illudium Q-36" id="marvin">1337</p>', str
|
364
364
|
end
|
@@ -370,7 +370,7 @@ p<id="marvin"
|
|
370
370
|
class="martian"
|
371
371
|
data-info="Illudium Q-36"> THE space modulator
|
372
372
|
}
|
373
|
-
Slim::Parser
|
373
|
+
Slim::Parser.options[:attr_list_delims].each do |k,v|
|
374
374
|
str = source.sub('<',k).sub('>',v)
|
375
375
|
assert_html '<p class="martian" data-info="Illudium Q-36" id="marvin">THE space modulator</p>', str
|
376
376
|
end
|
@@ -383,7 +383,7 @@ p<id="marvin"
|
|
383
383
|
data-info="Illudium Q-36">
|
384
384
|
| THE space modulator
|
385
385
|
}
|
386
|
-
Slim::Parser
|
386
|
+
Slim::Parser.options[:attr_list_delims].each do |k,v|
|
387
387
|
str = source.sub('<',k).sub('>',v)
|
388
388
|
assert_html '<p class="martian" data-info="Illudium Q-36" id="marvin">THE space modulator</p>', str
|
389
389
|
end
|
@@ -396,7 +396,7 @@ p<id=@id_helper()
|
|
396
396
|
data-info="Illudium Q-36">
|
397
397
|
| THE space modulator
|
398
398
|
}
|
399
|
-
Slim::Parser
|
399
|
+
Slim::Parser.options[:attr_list_delims].each do |k,v|
|
400
400
|
str = source.sub('<',k).sub('>',v)
|
401
401
|
assert_html '<p class="martian" data-info="Illudium Q-36" id="notice">THE space modulator</p>', str
|
402
402
|
end
|
@@ -410,7 +410,7 @@ p<id=@id_helper()
|
|
410
410
|
span.emphasis THE
|
411
411
|
| space modulator
|
412
412
|
}
|
413
|
-
Slim::Parser
|
413
|
+
Slim::Parser.options[:attr_list_delims].each do |k,v|
|
414
414
|
str = source.sub('<',k).sub('>',v)
|
415
415
|
assert_html '<p class="martian" data-info="Illudium Q-36" id="notice"><span class="emphasis">THE</span> space modulator</p>', str
|
416
416
|
end
|
@@ -423,7 +423,7 @@ li< id="myid"
|
|
423
423
|
data-info="myinfo">
|
424
424
|
a href="link" My Link
|
425
425
|
}
|
426
|
-
Slim::Parser
|
426
|
+
Slim::Parser.options[:attr_list_delims].each do |k,v|
|
427
427
|
str = source.sub('<',k).sub('>',v)
|
428
428
|
assert_html '<li class="myclass" data-info="myinfo" id="myid"><a href="link">My Link</a></li>', str
|
429
429
|
end
|
data/test/test_skim_template.rb
CHANGED
@@ -11,11 +11,11 @@ class TestSkimTemplate < TestSkim
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def test_sprockets_integration_with_asset
|
14
|
-
Skim::Engine.
|
14
|
+
Skim::Engine.options[:use_asset] = true
|
15
15
|
compiled = ExecJS.compile(skim_source + ";" + asset_source('test.js'))
|
16
16
|
assert_equal "<p>Hello World, meet Skim</p>", compiled.eval("JST.test({name: 'Skim'})")
|
17
17
|
ensure
|
18
|
-
Skim::Engine.
|
18
|
+
Skim::Engine.options[:use_asset] = false
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_sprockets_require_directive
|
@@ -35,11 +35,13 @@ this.Skim =
|
|
35
35
|
|
36
36
|
context.escape ||= @escape || (string) ->
|
37
37
|
return '' unless string?
|
38
|
-
|
39
|
-
|
38
|
+
if string.skimSafe or not /[&<>\"]/.test(string)
|
39
|
+
return string
|
40
|
+
|
41
|
+
@safe(('' + string)
|
40
42
|
.replace(/&/g, '&')
|
41
43
|
.replace(/</g, '<')
|
42
44
|
.replace(/>/g, '>')
|
43
|
-
.replace(/"/g, '"')
|
45
|
+
.replace(/"/g, '"'))
|
44
46
|
|
45
47
|
block.call(context)
|
metadata
CHANGED
@@ -1,180 +1,172 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.11.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
|
-
-
|
7
|
+
- AppJudo Inc.
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2021-03-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: slim
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
19
|
+
version: '3.0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
26
|
+
version: '3.0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: coffee-script
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: coffee-script-source
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: 1.2.0
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: 1.2.0
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: sprockets
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - ">="
|
68
60
|
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
61
|
+
version: '2.0'
|
62
|
+
- - "<"
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '5.0'
|
70
65
|
type: :runtime
|
71
66
|
prerelease: false
|
72
67
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
68
|
requirements:
|
75
|
-
- -
|
69
|
+
- - ">="
|
76
70
|
- !ruby/object:Gem::Version
|
77
|
-
version: '0'
|
71
|
+
version: '2.0'
|
72
|
+
- - "<"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '5.0'
|
78
75
|
- !ruby/object:Gem::Dependency
|
79
76
|
name: rake
|
80
77
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
78
|
requirements:
|
83
|
-
- -
|
79
|
+
- - ">="
|
84
80
|
- !ruby/object:Gem::Version
|
85
81
|
version: '0'
|
86
82
|
type: :development
|
87
83
|
prerelease: false
|
88
84
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
85
|
requirements:
|
91
|
-
- -
|
86
|
+
- - ">="
|
92
87
|
- !ruby/object:Gem::Version
|
93
88
|
version: '0'
|
94
89
|
- !ruby/object:Gem::Dependency
|
95
|
-
name:
|
90
|
+
name: pry
|
96
91
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
92
|
requirements:
|
99
|
-
- -
|
93
|
+
- - ">="
|
100
94
|
- !ruby/object:Gem::Version
|
101
95
|
version: '0'
|
102
96
|
type: :development
|
103
97
|
prerelease: false
|
104
98
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
99
|
requirements:
|
107
|
-
- -
|
100
|
+
- - ">="
|
108
101
|
- !ruby/object:Gem::Version
|
109
102
|
version: '0'
|
110
103
|
- !ruby/object:Gem::Dependency
|
111
|
-
name:
|
104
|
+
name: execjs
|
112
105
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
106
|
requirements:
|
115
|
-
- -
|
107
|
+
- - ">="
|
116
108
|
- !ruby/object:Gem::Version
|
117
|
-
version: '0
|
109
|
+
version: '0'
|
118
110
|
type: :development
|
119
111
|
prerelease: false
|
120
112
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
113
|
requirements:
|
123
|
-
- -
|
114
|
+
- - ">="
|
124
115
|
- !ruby/object:Gem::Version
|
125
|
-
version: '0
|
116
|
+
version: '0'
|
126
117
|
- !ruby/object:Gem::Dependency
|
127
|
-
name:
|
118
|
+
name: minitest-reporters
|
128
119
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
120
|
requirements:
|
131
|
-
- -
|
121
|
+
- - ">="
|
132
122
|
- !ruby/object:Gem::Version
|
133
123
|
version: '0'
|
134
124
|
type: :development
|
135
125
|
prerelease: false
|
136
126
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
127
|
requirements:
|
139
|
-
- -
|
128
|
+
- - ">="
|
140
129
|
- !ruby/object:Gem::Version
|
141
130
|
version: '0'
|
142
131
|
- !ruby/object:Gem::Dependency
|
143
132
|
name: libv8
|
144
133
|
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
134
|
requirements:
|
147
|
-
- -
|
135
|
+
- - "~>"
|
148
136
|
- !ruby/object:Gem::Version
|
149
|
-
version:
|
137
|
+
version: '8.4'
|
150
138
|
type: :development
|
151
139
|
prerelease: false
|
152
140
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
141
|
requirements:
|
155
|
-
- -
|
142
|
+
- - "~>"
|
156
143
|
- !ruby/object:Gem::Version
|
157
|
-
version:
|
144
|
+
version: '8.4'
|
158
145
|
description: Fat-free client-side templates with Slim and CoffeeScript
|
159
146
|
email:
|
160
|
-
-
|
161
|
-
executables:
|
147
|
+
- info@appjudo.com
|
148
|
+
executables:
|
149
|
+
- skim
|
162
150
|
extensions: []
|
163
151
|
extra_rdoc_files: []
|
164
152
|
files:
|
165
|
-
- .gitignore
|
166
|
-
- .
|
153
|
+
- ".gitignore"
|
154
|
+
- ".ruby-version"
|
155
|
+
- ".travis.yml"
|
167
156
|
- Gemfile
|
168
157
|
- History.md
|
169
158
|
- LICENSE
|
170
159
|
- README.md
|
171
160
|
- Rakefile
|
161
|
+
- bin/skim
|
172
162
|
- lib/skim.rb
|
173
163
|
- lib/skim/code_attributes.rb
|
164
|
+
- lib/skim/command.rb
|
174
165
|
- lib/skim/controls.rb
|
175
166
|
- lib/skim/engine.rb
|
176
167
|
- lib/skim/interpolation.rb
|
177
168
|
- lib/skim/rails.rb
|
169
|
+
- lib/skim/sprockets.rb
|
178
170
|
- lib/skim/template.rb
|
179
171
|
- lib/skim/version.rb
|
180
172
|
- lib/temple/coffee_script.rb
|
@@ -196,34 +188,34 @@ files:
|
|
196
188
|
- test/test_code_evaluation.rb
|
197
189
|
- test/test_code_output.rb
|
198
190
|
- test/test_code_structure.rb
|
191
|
+
- test/test_commands.rb
|
199
192
|
- test/test_html_escaping.rb
|
200
193
|
- test/test_html_structure.rb
|
201
194
|
- test/test_skim_template.rb
|
202
195
|
- test/test_text_interpolation.rb
|
203
196
|
- vendor/assets/javascripts/skim.js.coffee
|
204
197
|
homepage: ''
|
205
|
-
licenses:
|
198
|
+
licenses:
|
199
|
+
- MIT
|
200
|
+
metadata: {}
|
206
201
|
post_install_message:
|
207
202
|
rdoc_options: []
|
208
203
|
require_paths:
|
209
204
|
- lib
|
210
205
|
required_ruby_version: !ruby/object:Gem::Requirement
|
211
|
-
none: false
|
212
206
|
requirements:
|
213
|
-
- -
|
207
|
+
- - ">="
|
214
208
|
- !ruby/object:Gem::Version
|
215
209
|
version: '0'
|
216
210
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
217
|
-
none: false
|
218
211
|
requirements:
|
219
|
-
- -
|
212
|
+
- - ">="
|
220
213
|
- !ruby/object:Gem::Version
|
221
214
|
version: '0'
|
222
215
|
requirements: []
|
223
|
-
|
224
|
-
rubygems_version: 1.8.23
|
216
|
+
rubygems_version: 3.0.3
|
225
217
|
signing_key:
|
226
|
-
specification_version:
|
218
|
+
specification_version: 4
|
227
219
|
summary: Take the fat out of your client-side templates with Skim. Skim is the Slim
|
228
220
|
templating engine with embedded CoffeeScript. It compiles to JavaScript templates
|
229
221
|
(.jst), which can then be served by Rails or any other Sprockets-based asset pipeline.
|
@@ -238,6 +230,7 @@ test_files:
|
|
238
230
|
- test/test_code_evaluation.rb
|
239
231
|
- test/test_code_output.rb
|
240
232
|
- test/test_code_structure.rb
|
233
|
+
- test/test_commands.rb
|
241
234
|
- test/test_html_escaping.rb
|
242
235
|
- test/test_html_structure.rb
|
243
236
|
- test/test_skim_template.rb
|