trenni 3.8.0 → 3.9.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.
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
5
+ #
6
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ # of this software and associated documentation files (the "Software"), to deal
8
+ # in the Software without restriction, including without limitation the rights
9
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ # copies of the Software, and to permit persons to whom the Software is
11
+ # furnished to do so, subject to the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be included in
14
+ # all copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ # THE SOFTWARE.
23
+
24
+ require 'trenni/reference'
25
+
26
+ RSpec.describe Trenni::Reference do
27
+ describe Trenni::Reference('path with spaces/image.jpg') do
28
+ it "encodes whitespace" do
29
+ expect(subject.to_s).to be == "path%20with%20spaces/image.jpg"
30
+ end
31
+ end
32
+
33
+ describe Trenni::Reference('path', array: [1, 2, 3]) do
34
+ it "encodes array" do
35
+ expect(subject.to_s).to be == "path?array[]=1&array[]=2&array[]=3"
36
+ end
37
+ end
38
+
39
+ describe Trenni::Reference('path_with_underscores/image.jpg') do
40
+ it "doesn't touch underscores" do
41
+ expect(subject.to_s).to be == "path_with_underscores/image.jpg"
42
+ end
43
+ end
44
+
45
+ describe Trenni::Reference('index', :'my name' => 'Bob Dole') do
46
+ it "encodes query" do
47
+ expect(subject.to_s).to be == "index?my%20name=Bob%20Dole"
48
+ end
49
+ end
50
+
51
+ describe Trenni::Reference('index#All Your Base') do
52
+ it "encodes fragment" do
53
+ expect(subject.to_s).to be == "index\#All%20Your%20Base"
54
+ end
55
+ end
56
+
57
+ describe Trenni::Reference('I/❤️/UNICODE', face: '😀') do
58
+ it "encodes unicode" do
59
+ expect(subject.to_s).to be == "I/%E2%9D%A4%EF%B8%8F/UNICODE?face=%F0%9F%98%80"
60
+ end
61
+ end
62
+
63
+ it "can be an attribute" do
64
+ tag = Trenni::Tag.closed('img', src: Trenni::Reference('image.jpg', x: 10))
65
+
66
+ expect(tag.to_s).to be == '<img src="image.jpg?x=10"/>'
67
+ end
68
+
69
+ describe Trenni::Reference("foo?bar=10&baz=20", yes: 'no') do
70
+ it "can use existing query parameters" do
71
+ expect(subject.to_s).to be == "foo?bar=10&baz=20&yes=no"
72
+ end
73
+ end
74
+
75
+ describe Trenni::Reference("foo?yes=yes", yes: 'no') do
76
+ it "overrides existing parameters" do
77
+ expect(subject.to_s).to be == "foo?yes=no"
78
+ end
79
+ end
80
+
81
+ describe Trenni::Reference('foo#frag') do
82
+ it "can use existing fragment" do
83
+ expect(subject.fragment).to be == "frag"
84
+ expect(subject.to_s).to be == 'foo#frag'
85
+ end
86
+ end
87
+ end
@@ -4,6 +4,7 @@ require_relative 'lib/trenni/version'
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = "trenni"
6
6
  spec.platform = Gem::Platform::RUBY
7
+ spec.license = "MIT"
7
8
  spec.version = Trenni::VERSION
8
9
  spec.authors = ["Samuel Williams"]
9
10
  spec.email = ["samuel.williams@oriontransfer.co.nz"]
@@ -30,6 +31,7 @@ Gem::Specification.new do |spec|
30
31
  spec.extensions = %w[ext/Rakefile]
31
32
  spec.add_dependency "rake-compiler"
32
33
 
34
+ spec.add_development_dependency "rack"
33
35
  spec.add_development_dependency "bundler"
34
36
  spec.add_development_dependency "rspec", "~> 3.4"
35
37
  spec.add_development_dependency "rake"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trenni
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.8.0
4
+ version: 3.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-01 00:00:00.000000000 Z
11
+ date: 2020-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rack
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -77,9 +91,9 @@ extensions:
77
91
  - ext/Rakefile
78
92
  extra_rdoc_files: []
79
93
  files:
94
+ - ".editorconfig"
80
95
  - ".gitignore"
81
96
  - ".rspec"
82
- - ".simplecov"
83
97
  - ".travis.yml"
84
98
  - Gemfile
85
99
  - README.md
@@ -95,6 +109,9 @@ files:
95
109
  - ext/trenni/markup.c
96
110
  - ext/trenni/markup.h
97
111
  - ext/trenni/markup.rl
112
+ - ext/trenni/query.c
113
+ - ext/trenni/query.h
114
+ - ext/trenni/query.rl
98
115
  - ext/trenni/tag.c
99
116
  - ext/trenni/tag.h
100
117
  - ext/trenni/template.c
@@ -107,15 +124,19 @@ files:
107
124
  - lib/trenni/builder.rb
108
125
  - lib/trenni/entities.rb
109
126
  - lib/trenni/entities.trenni
127
+ - lib/trenni/error.rb
110
128
  - lib/trenni/fallback/markup.rb
111
129
  - lib/trenni/fallback/markup.rl
130
+ - lib/trenni/fallback/query.rb
131
+ - lib/trenni/fallback/query.rl
112
132
  - lib/trenni/fallback/template.rb
113
133
  - lib/trenni/fallback/template.rl
114
134
  - lib/trenni/markup.rb
115
135
  - lib/trenni/native.rb
116
136
  - lib/trenni/parse_delegate.rb
117
- - lib/trenni/parse_error.rb
118
137
  - lib/trenni/parsers.rb
138
+ - lib/trenni/query.rb
139
+ - lib/trenni/reference.rb
119
140
  - lib/trenni/strings.rb
120
141
  - lib/trenni/tag.rb
121
142
  - lib/trenni/template.rb
@@ -123,6 +144,7 @@ files:
123
144
  - lib/trenni/version.rb
124
145
  - parsers/trenni/entities.rl
125
146
  - parsers/trenni/markup.rl
147
+ - parsers/trenni/query.rl
126
148
  - parsers/trenni/template.rl
127
149
  - spec/spec_helper.rb
128
150
  - spec/trenni/builder_spec.rb
@@ -132,6 +154,8 @@ files:
132
154
  - spec/trenni/markup_performance_spec.rb
133
155
  - spec/trenni/markup_spec.rb
134
156
  - spec/trenni/parsers_performance_spec.rb
157
+ - spec/trenni/query_spec.rb
158
+ - spec/trenni/reference_spec.rb
135
159
  - spec/trenni/strings_spec.rb
136
160
  - spec/trenni/tag_spec.rb
137
161
  - spec/trenni/template_error_spec.rb
@@ -153,7 +177,8 @@ files:
153
177
  - tasks/parsers.rake
154
178
  - trenni.gemspec
155
179
  homepage: https://github.com/ioquatix/trenni
156
- licenses: []
180
+ licenses:
181
+ - MIT
157
182
  metadata:
158
183
  funding_uri: https://github.com/sponsors/ioquatix
159
184
  post_install_message:
@@ -184,6 +209,8 @@ test_files:
184
209
  - spec/trenni/markup_performance_spec.rb
185
210
  - spec/trenni/markup_spec.rb
186
211
  - spec/trenni/parsers_performance_spec.rb
212
+ - spec/trenni/query_spec.rb
213
+ - spec/trenni/reference_spec.rb
187
214
  - spec/trenni/strings_spec.rb
188
215
  - spec/trenni/tag_spec.rb
189
216
  - spec/trenni/template_error_spec.rb
data/.simplecov DELETED
@@ -1,9 +0,0 @@
1
-
2
- SimpleCov.start do
3
- add_filter "/spec/"
4
- end
5
-
6
- if ENV['TRAVIS']
7
- require 'coveralls'
8
- Coveralls.wear!
9
- end