slight-lang 1.1.0 → 1.1.6

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/lib/slight/tilt.rb CHANGED
@@ -1,26 +1,25 @@
1
- require 'tilt'
2
- require 'tilt/template'
3
- require 'slight'
4
-
5
- module Tilt
6
- class SlightTemplate < Template
7
- self.default_mime_type = 'text/html'
8
-
9
- def prepare
10
- @engine = ::Slight::Engine.new
11
- #@engine = ::ERB.new(data, options[:safe], options[:trim], @outvar)
12
- end
13
-
14
- def evaluate(scope, locals, &block)
15
- #scope_vars = scope.instance_variables
16
- #scope_vars.each do |var|
17
- # @engine.instance_variable_set(var, scope.instance_variable_get(var))
18
- #end
19
- locals[:__scope] = scope
20
- @output ||= @engine.render(file, data, locals)
21
- end
22
- end
23
-
24
- register_lazy "SlightTemplate", 'slight/tilt', 'slight', 'rb'
25
-
26
- end
1
+ require 'tilt'
2
+ require 'tilt/template'
3
+ require 'slight'
4
+
5
+ module Tilt
6
+ class SlightTemplate < Template
7
+ self.default_mime_type = 'text/html'
8
+
9
+ def prepare
10
+ @engine = ::Slight::Engine.new
11
+ #@engine = ::ERB.new(data, options[:safe], options[:trim], @outvar)
12
+ end
13
+
14
+ def evaluate(scope, locals, &block)
15
+ #scope_vars = scope.instance_variables
16
+ #scope_vars.each do |var|
17
+ # @engine.instance_variable_set(var, scope.instance_variable_get(var))
18
+ #end
19
+ locals[:__scope] = scope
20
+ @output ||= @engine.render(file, data, locals)
21
+ end
22
+ end
23
+
24
+ register_lazy "SlightTemplate", 'slight/tilt', 'slight', 'rb'
25
+ end
data/lib/slight/utils.rb CHANGED
@@ -1,38 +1,38 @@
1
- # Borrow from ERB Source
2
- # ERB::Util
3
- module Slight
4
- module Utils
5
- public
6
- # A utility method for escaping HTML tag characters in _s_.
7
- #
8
- # require "erb"
9
- # include ERB::Util
10
- #
11
- # puts html_escape("is a > 0 & a < 10?")
12
- #
13
- # _Generates_
14
- #
15
- # is a &gt; 0 &amp; a &lt; 10?
16
- #
17
- # [Slight] => Add: gsub(/[[:blank:]]/,"&nbsp;") to support space.
18
- def html_escape(s)
19
- s.to_s.gsub(/&/, "&amp;").gsub(/[[:blank:]]/,"&nbsp;").gsub(/\"/, "&quot;").gsub(/>/, "&gt;").gsub(/</, "&lt;")
20
- end
21
- module_function :html_escape
22
- # A utility method for encoding the String _s_ as a URL.
23
- #
24
- # require "erb"
25
- # include ERB::Util
26
- #
27
- # puts url_encode("Programming Ruby: The Pragmatic Programmer's Guide")
28
- #
29
- # _Generates_
30
- #
31
- # Programming%20Ruby%3A%20%20The%20Pragmatic%20Programmer%27s%20Guide
32
- #
33
- def url_encode(s)
34
- s.to_s.gsub(/[^a-zA-Z0-9_\-.]/n){ sprintf("%%%02X", $&.unpack("C")[0]) }
35
- end
36
- module_function :url_encode
37
- end
38
- end
1
+ # Borrow from ERB Source
2
+ # ERB::Util
3
+ module Slight
4
+ module Utils
5
+ public
6
+ # A utility method for escaping HTML tag characters in _s_.
7
+ #
8
+ # require "erb"
9
+ # include ERB::Util
10
+ #
11
+ # puts html_escape("is a > 0 & a < 10?")
12
+ #
13
+ # _Generates_
14
+ #
15
+ # is a &gt; 0 &amp; a &lt; 10?
16
+ #
17
+ # [Slight] => Add: gsub(/[[:blank:]]/,"&nbsp;") to support space.
18
+ def html_escape(s)
19
+ s.to_s.gsub(/&/, "&amp;").gsub(/[[:blank:]]/,"&nbsp;").gsub(/\"/, "&quot;").gsub(/>/, "&gt;").gsub(/</, "&lt;")
20
+ end
21
+ module_function :html_escape
22
+ # A utility method for encoding the String _s_ as a URL.
23
+ #
24
+ # require "erb"
25
+ # include ERB::Util
26
+ #
27
+ # puts url_encode("Programming Ruby: The Pragmatic Programmer's Guide")
28
+ #
29
+ # _Generates_
30
+ #
31
+ # Programming%20Ruby%3A%20%20The%20Pragmatic%20Programmer%27s%20Guide
32
+ #
33
+ def url_encode(s)
34
+ s.to_s.gsub(/[^a-zA-Z0-9_\-.]/n){ sprintf("%%%02X", $&.unpack("C")[0]) }
35
+ end
36
+ module_function :url_encode
37
+ end
38
+ end
data/lib/slight.rb CHANGED
@@ -1,9 +1,12 @@
1
- require 'slight/engine'
2
- module Slight
3
- # Slight version string
4
- # @api public
5
- VERSION = '1.1.0'
6
- # 1.0.0 => Basic Template features | 201703
7
- # 1.0.5 => Support Tilt | 201704
8
- # 1.1.0 => Doc Update | 201705
9
- end
1
+ require 'slight/const'
2
+ require 'slight/engine'
3
+ module Slight
4
+ # Slight version string
5
+ # @api public
6
+ VERSION = '1.1.6'
7
+ # 1.0.0 => Basic Template features | 201703
8
+ # 1.0.5 => Support Tilt | 201704
9
+ # 1.1.0 => Doc Update | 201705
10
+ # 1.1.5 => Add CONST | 20180101
11
+ # 1.1.6 => Fix CLI | 20180217
12
+ end
data/slight.gemspec CHANGED
@@ -1,21 +1,21 @@
1
- # -*- encoding: utf-8
2
- $:.unshift File.expand_path('../lib', __FILE__)
3
- require 'slight'
4
-
5
- Gem::Specification.new do |gem|
6
- gem.authors = ["oliver.yu"]
7
- gem.email = ["nemo1023@gmail.com"]
8
- gem.description = %q{A light and sweet template language}
9
- gem.summary = %q{The goal of this is to use pure ruby syntax to write template.}
10
- gem.homepage = "https://github.com/OliversCat/Slight"
11
- gem.files = `git ls-files`.split($\)
12
- #gem.files = dir('.')
13
- #gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) unless f.end_with? ".rb" }
14
- gem.executables = ["slsh","slight"]
15
- #gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
16
- gem.test_files = ["spec"]
17
- gem.name = "slight-lang"
18
- gem.require_paths = ["lib"]
19
- gem.version = Slight::VERSION
20
- gem.license = "MIT"
21
- end
1
+ # -*- encoding: utf-8
2
+ $:.unshift File.expand_path('../lib', __FILE__)
3
+ require 'slight'
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.authors = ["oliver.yu"]
7
+ gem.email = ["nemo1023@gmail.com"]
8
+ gem.description = %q{A light and sweet template language}
9
+ gem.summary = %q{The goal of this is to use pure ruby syntax to write template.}
10
+ gem.homepage = "https://github.com/OliversCat/Slight"
11
+ gem.files = `git ls-files`.split($\)
12
+ #gem.files = dir('.')
13
+ #gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) unless f.end_with? ".rb" }
14
+ gem.executables = ["slsh","slight"]
15
+ #gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
16
+ gem.test_files = ["spec"]
17
+ gem.name = "slight-lang"
18
+ gem.require_paths = ["lib"]
19
+ gem.version = Slight::VERSION
20
+ gem.license = "MIT"
21
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slight-lang
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - oliver.yu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-10 00:00:00.000000000 Z
11
+ date: 2018-02-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A light and sweet template language
14
14
  email:
@@ -35,6 +35,7 @@ files:
35
35
  - example/tilt_example.rb
36
36
  - lib/slight.rb
37
37
  - lib/slight/config.rb
38
+ - lib/slight/const.rb
38
39
  - lib/slight/dsl.rb
39
40
  - lib/slight/engine.rb
40
41
  - lib/slight/template.rb
@@ -64,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
65
  version: '0'
65
66
  requirements: []
66
67
  rubyforge_project:
67
- rubygems_version: 2.6.11
68
+ rubygems_version: 2.5.2
68
69
  signing_key:
69
70
  specification_version: 4
70
71
  summary: The goal of this is to use pure ruby syntax to write template.