inversion 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/History.rdoc +11 -0
- data/lib/inversion.rb +1 -1
- data/lib/inversion/mixins.rb +25 -0
- data/lib/inversion/template/configtag.rb +8 -2
- data/lib/inversion/template/uriencodetag.rb +2 -4
- data/spec/data/unknown-tag.tmpl +1 -1
- data/spec/inversion/mixins_spec.rb +14 -4
- metadata +43 -29
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de95b723b4e1d977b915f72d99659c4b73f6ca222afe91b4536c5e3e2c12bd73
|
4
|
+
data.tar.gz: 62b09f236668d37f6e33757d7cc7db174374ae5663ad42c6bd20aa9b55c40835
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ad4969a736b028863e67d56e5b85b0ad887dcbba2313d9fe90f65f4a982216285c0dc988ba7852f23b157281395ad3dc43c78864fab233f82510d77a49bf284
|
7
|
+
data.tar.gz: 5c50d1f6636a0de6c65616a4996806d20bf50ba26d4da7295edf6d7d7e4eb6fdeb1bbff6b8148bd408137ceaf4a8ed465d87ba6e2fc4ba80f2df37d7d2224ef5
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/History.rdoc
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
= Release History for inversion
|
2
|
+
|
3
|
+
---
|
4
|
+
|
5
|
+
== v1.3.1 [2020-09-29] Michael Granger <ged@faeriemud.org>
|
6
|
+
|
7
|
+
Improvements:
|
8
|
+
|
9
|
+
- Only use SafeYAML if it's already loaded
|
10
|
+
- Handle HTML encoding for uriencoding tag ourselves
|
11
|
+
|
1
12
|
|
2
13
|
== v1.3.0 [2020-04-08] Mahlon E. Smith <mahlon@martini.nu>
|
3
14
|
|
data/lib/inversion.rb
CHANGED
data/lib/inversion/mixins.rb
CHANGED
@@ -130,6 +130,20 @@ module Inversion
|
|
130
130
|
# The fallback escape format
|
131
131
|
DEFAULT_ESCAPE_FORMAT = :none
|
132
132
|
|
133
|
+
# Unreserved characters from section 2.3 of RFC 3986
|
134
|
+
# ALPHA / DIGIT / "-" / "." / "_" / "~"
|
135
|
+
URI_ENCODED_CHARACTERS = /[^\w\-\.~]/
|
136
|
+
|
137
|
+
|
138
|
+
### Inclusion callback; add Loggability if it isn't already present
|
139
|
+
def self::included( mod )
|
140
|
+
super
|
141
|
+
unless mod < Loggability
|
142
|
+
mod.extend( Loggability )
|
143
|
+
mod.log_to( :inversion )
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
133
147
|
|
134
148
|
### Escape the +output+ using the format specified by the given +render_state+'s config.
|
135
149
|
def escape( output, render_state )
|
@@ -154,6 +168,17 @@ module Inversion
|
|
154
168
|
gsub( />/, '>' )
|
155
169
|
end
|
156
170
|
|
171
|
+
|
172
|
+
### Escape the given +output+ using the encoding specified in RFC3986 (URIs)
|
173
|
+
def escape_uri( output )
|
174
|
+
return output.to_s.gsub( URI_ENCODED_CHARACTERS ) do |m|
|
175
|
+
bytes = m[ 0 ].each_byte
|
176
|
+
bytes.inject( String.new ) do |buf, char|
|
177
|
+
buf + sprintf( '%%%0X', char )
|
178
|
+
end
|
179
|
+
end.force_encoding( Encoding::US_ASCII )
|
180
|
+
end
|
181
|
+
|
157
182
|
end # Escaping
|
158
183
|
|
159
184
|
|
@@ -2,7 +2,8 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
# vim: set noet nosta sw=4 ts=4 :
|
4
4
|
|
5
|
-
require '
|
5
|
+
require 'yaml'
|
6
|
+
|
6
7
|
require 'inversion/mixins'
|
7
8
|
require 'inversion/template' unless defined?( Inversion::Template )
|
8
9
|
require 'inversion/template/tag'
|
@@ -36,7 +37,12 @@ class Inversion::Template::ConfigTag < Inversion::Template::Tag
|
|
36
37
|
raise Inversion::ParseError, 'Empty config settings' if
|
37
38
|
body.nil? || body.strip.empty?
|
38
39
|
|
39
|
-
opts =
|
40
|
+
opts = if defined?( SafeYAML ) then
|
41
|
+
YAML.load( body, safe: true )
|
42
|
+
else
|
43
|
+
YAML.load( body )
|
44
|
+
end
|
45
|
+
|
40
46
|
@options = symbolify_keys( opts )
|
41
47
|
|
42
48
|
super
|
@@ -16,16 +16,14 @@ require 'inversion/template/attrtag'
|
|
16
16
|
# <?uriencode foo.bar ?>
|
17
17
|
#
|
18
18
|
class Inversion::Template::UriencodeTag < Inversion::Template::AttrTag
|
19
|
+
include Inversion::Escaping
|
19
20
|
|
20
|
-
# Unreserved characters from section 2.3 of RFC 3986
|
21
|
-
# ALPHA / DIGIT / "-" / "." / "_" / "~"
|
22
|
-
DEFAULT_ENCODED_CHARACTERS = /[^\w\-\.~]/
|
23
21
|
|
24
22
|
### Render the method chains against the attributes of the specified +render_state+
|
25
23
|
### and return them.
|
26
24
|
def render( render_state )
|
27
25
|
raw = super
|
28
|
-
return
|
26
|
+
return escape_uri( raw.to_s )
|
29
27
|
end
|
30
28
|
|
31
29
|
end # class Inversion::Template::UriencodeTag
|
data/spec/data/unknown-tag.tmpl
CHANGED
@@ -108,7 +108,7 @@ describe Inversion, "mixins" do
|
|
108
108
|
include Inversion::Escaping
|
109
109
|
|
110
110
|
def render( state )
|
111
|
-
return self.escape( "
|
111
|
+
return self.escape( "</something>", state )
|
112
112
|
end
|
113
113
|
end
|
114
114
|
@obj = objclass.new
|
@@ -116,18 +116,28 @@ describe Inversion, "mixins" do
|
|
116
116
|
|
117
117
|
it "adds configurable escaping to including classes" do
|
118
118
|
render_state = Inversion::RenderState.new( {}, :escape_format => :html )
|
119
|
-
expect( @obj.render( render_state ) ).to eq( "<
|
119
|
+
expect( @obj.render( render_state ) ).to eq( "</something>" )
|
120
120
|
end
|
121
121
|
|
122
122
|
it "doesn't escape anything if escaping is disabled" do
|
123
123
|
render_state = Inversion::RenderState.new( {}, :escape_format => nil )
|
124
|
-
expect( @obj.render( render_state ) ).to eq( "
|
124
|
+
expect( @obj.render( render_state ) ).to eq( "</something>" )
|
125
125
|
end
|
126
126
|
|
127
127
|
it "doesn't escape anything if escaping is set to ':none'" do
|
128
128
|
render_state = Inversion::RenderState.new( {}, :escape_format => :none )
|
129
|
-
expect( @obj.render( render_state ) ).to eq( "
|
129
|
+
expect( @obj.render( render_state ) ).to eq( "</something>" )
|
130
130
|
end
|
131
|
+
|
132
|
+
it "supports URI escaping" do
|
133
|
+
render_state = Inversion::RenderState.new( {}, :escape_format => :uri )
|
134
|
+
|
135
|
+
rval = @obj.render( render_state )
|
136
|
+
|
137
|
+
expect( rval.encoding ).to eq( Encoding::US_ASCII )
|
138
|
+
expect( rval ).to eq( "%3C%2Fsomething%3E" )
|
139
|
+
end
|
140
|
+
|
131
141
|
end
|
132
142
|
|
133
143
|
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inversion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Granger
|
8
8
|
- Mahlon E. Smith
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain:
|
12
12
|
- |
|
13
13
|
-----BEGIN CERTIFICATE-----
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
14
|
+
MIIENDCCApygAwIBAgIBATANBgkqhkiG9w0BAQsFADAiMSAwHgY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x/PNB/6JIbIV3B9Uq8aTZx4uOjK7r8vMl1/t
|
30
|
+
ZfY7r6HejJfXlcO2m6JDMbpdyEVv916LncBkzZRz6vnnNCx+31f15FKddxujpAFd
|
31
|
+
qpn3JRQY+oj7ZkoccL/IUiDpxQWeS3oOoz9qr2kVTp8R50InZimt79FqCl/1m66W
|
32
|
+
kdOuf+wM3DDx7Rt4IVNHrhGlyfMr7xjKW1Q3gll+pMN1DT6Ajx/t3JDSEg7BnnEW
|
33
|
+
r7AciSO6J4ApUdqyG+coLFlGdtgFTgRHv7ihbQtDI7Z/LV7A4Spn1j2PK3j0Omri
|
34
|
+
kSl1hPVigRytfgdVGiLXzvkkrkgj9EknCaj5UHbac7XvVBrljXj9hsnnqTANaKsg
|
35
|
+
jBZSA+N+xUTgUWpXjjwsLZjzJkhWATJWq+krNXcqpwXo6HsjmdUxoFMt63RBb+sI
|
36
|
+
XrxOxp8o0uOkU7FdLSGsyqJ2LzsR4obN
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2020-
|
38
|
+
date: 2020-09-29 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: highline
|
@@ -205,6 +205,20 @@ dependencies:
|
|
205
205
|
- - "~>"
|
206
206
|
- !ruby/object:Gem::Version
|
207
207
|
version: '2.0'
|
208
|
+
- !ruby/object:Gem::Dependency
|
209
|
+
name: safe_yaml
|
210
|
+
requirement: !ruby/object:Gem::Requirement
|
211
|
+
requirements:
|
212
|
+
- - "~>"
|
213
|
+
- !ruby/object:Gem::Version
|
214
|
+
version: '1.0'
|
215
|
+
type: :development
|
216
|
+
prerelease: false
|
217
|
+
version_requirements: !ruby/object:Gem::Requirement
|
218
|
+
requirements:
|
219
|
+
- - "~>"
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '1.0'
|
208
222
|
description: Inversion is a templating system for Ruby. It uses the “Inversion of
|
209
223
|
Control” principle to decouple the contents and structure of templates from the
|
210
224
|
code that uses them, making it easier to separate concerns, keep your tests simple,
|
@@ -311,7 +325,7 @@ metadata:
|
|
311
325
|
documentation_uri: http://deveiate.org/code/Inversion
|
312
326
|
source_uri: https://hg.sr.ht/~ged/Inversion/browse
|
313
327
|
bug_tracker_uri: https://todo.sr.ht/~ged/Inversion/browse
|
314
|
-
post_install_message:
|
328
|
+
post_install_message:
|
315
329
|
rdoc_options: []
|
316
330
|
require_paths:
|
317
331
|
- lib
|
@@ -326,8 +340,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
326
340
|
- !ruby/object:Gem::Version
|
327
341
|
version: '0'
|
328
342
|
requirements: []
|
329
|
-
rubygems_version: 3.
|
330
|
-
signing_key:
|
343
|
+
rubygems_version: 3.1.2
|
344
|
+
signing_key:
|
331
345
|
specification_version: 4
|
332
346
|
summary: Inversion is a templating system for Ruby.
|
333
347
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|