erb 4.0.4-java → 5.0.0-java
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.
- checksums.yaml +4 -4
- data/.document +6 -0
- data/.rdoc_options +1 -0
- data/BDSL +22 -0
- data/COPYING +56 -0
- data/LICENSE.txt +2 -22
- data/NEWS.md +6 -0
- data/_doc/cgi.rb +3 -0
- data/erb.gemspec +3 -5
- data/ext/erb/escape/escape.c +6 -3
- data/lib/erb/compiler.rb +20 -4
- data/lib/erb/def_method.rb +1 -1
- data/lib/erb/util.rb +28 -16
- data/lib/erb/version.rb +1 -2
- data/lib/erb.rb +5 -7
- metadata +10 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cea2169d298aa80a07ecd3fd30b0a47abbe3e011fcf1657d0af8ede665fb4bcc
|
4
|
+
data.tar.gz: 279bb65262f9d7162a81e4f8e3bee44954b38de7356f1f94910953dbfb7d3b9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90d38912df1058a68b7bac9da4d6b2a9dda9dce703d25cf7d29dbec458d08d0063b882d448b6d3b5fb5a79c6f7e8b313ee1e22903d1fede9f8e39d6c8bd7f435
|
7
|
+
data.tar.gz: 7bb7b9c1c6bad447846fd476f0eecaf04028b96d4393ed9d36cf666d9a8bf1257cbfd8721124a27f5fe6babe9a6106f738f49081b85b078c3ccd0acb1c9f2ad7
|
data/.document
ADDED
data/.rdoc_options
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
main_page: README.md
|
data/BDSL
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (C) 1993-2013 Yukihiro Matsumoto. All rights reserved.
|
2
|
+
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
4
|
+
modification, are permitted provided that the following conditions
|
5
|
+
are met:
|
6
|
+
1. Redistributions of source code must retain the above copyright
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
8
|
+
2. Redistributions in binary form must reproduce the above copyright
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
10
|
+
documentation and/or other materials provided with the distribution.
|
11
|
+
|
12
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
13
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
14
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
15
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
16
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
17
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
18
|
+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
19
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
20
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
21
|
+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
22
|
+
SUCH DAMAGE.
|
data/COPYING
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
|
2
|
+
You can redistribute it and/or modify it under either the terms of the
|
3
|
+
2-clause BSDL (see the file BSDL), or the conditions below:
|
4
|
+
|
5
|
+
1. You may make and give away verbatim copies of the source form of the
|
6
|
+
software without restriction, provided that you duplicate all of the
|
7
|
+
original copyright notices and associated disclaimers.
|
8
|
+
|
9
|
+
2. You may modify your copy of the software in any way, provided that
|
10
|
+
you do at least ONE of the following:
|
11
|
+
|
12
|
+
a. place your modifications in the Public Domain or otherwise
|
13
|
+
make them Freely Available, such as by posting said
|
14
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
15
|
+
the author to include your modifications in the software.
|
16
|
+
|
17
|
+
b. use the modified software only within your corporation or
|
18
|
+
organization.
|
19
|
+
|
20
|
+
c. give non-standard binaries non-standard names, with
|
21
|
+
instructions on where to get the original software distribution.
|
22
|
+
|
23
|
+
d. make other distribution arrangements with the author.
|
24
|
+
|
25
|
+
3. You may distribute the software in object code or binary form,
|
26
|
+
provided that you do at least ONE of the following:
|
27
|
+
|
28
|
+
a. distribute the binaries and library files of the software,
|
29
|
+
together with instructions (in the manual page or equivalent)
|
30
|
+
on where to get the original distribution.
|
31
|
+
|
32
|
+
b. accompany the distribution with the machine-readable source of
|
33
|
+
the software.
|
34
|
+
|
35
|
+
c. give non-standard binaries non-standard names, with
|
36
|
+
instructions on where to get the original software distribution.
|
37
|
+
|
38
|
+
d. make other distribution arrangements with the author.
|
39
|
+
|
40
|
+
4. You may modify and include the part of the software into any other
|
41
|
+
software (possibly commercial). But some files in the distribution
|
42
|
+
are not written by the author, so that they are not under these terms.
|
43
|
+
|
44
|
+
For the list of those files and their copying conditions, see the
|
45
|
+
file LEGAL.
|
46
|
+
|
47
|
+
5. The scripts and library files supplied as input to or produced as
|
48
|
+
output from the software do not automatically fall under the
|
49
|
+
copyright of the software, but belong to whomever generated them,
|
50
|
+
and may be sold commercially, and may be aggregated with this
|
51
|
+
software.
|
52
|
+
|
53
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
54
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
55
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
56
|
+
PURPOSE.
|
data/LICENSE.txt
CHANGED
@@ -1,22 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Redistribution and use in source and binary forms, with or without
|
4
|
-
modification, are permitted provided that the following conditions
|
5
|
-
are met:
|
6
|
-
1. Redistributions of source code must retain the above copyright
|
7
|
-
notice, this list of conditions and the following disclaimer.
|
8
|
-
2. Redistributions in binary form must reproduce the above copyright
|
9
|
-
notice, this list of conditions and the following disclaimer in the
|
10
|
-
documentation and/or other materials provided with the distribution.
|
11
|
-
|
12
|
-
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
13
|
-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
14
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
15
|
-
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
16
|
-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
17
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
18
|
-
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
19
|
-
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
20
|
-
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
21
|
-
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
22
|
-
SUCH DAMAGE.
|
1
|
+
All the files in this distribution are covered under either the Ruby's
|
2
|
+
license (see the file COPYING) or BSD-2-Clause license (see the file BSDL).
|
data/NEWS.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 5.0.0
|
4
|
+
|
5
|
+
* Bump `required_ruby_version` to Ruby 3.2+ [#60](https://github.com/ruby/erb/pull/60)
|
6
|
+
* Drop `cgi` from runtime dependencies [#59](https://github.com/ruby/erb/pull/59)
|
7
|
+
* Make `ERB::VERSION` public
|
8
|
+
|
3
9
|
## 4.0.4
|
4
10
|
|
5
11
|
* Skip building the C extension for JRuby [#52](https://github.com/ruby/erb/pull/52)
|
data/_doc/cgi.rb
ADDED
data/erb.gemspec
CHANGED
@@ -7,14 +7,13 @@ end
|
|
7
7
|
|
8
8
|
Gem::Specification.new do |spec|
|
9
9
|
spec.name = 'erb'
|
10
|
-
spec.version = ERB
|
10
|
+
spec.version = ERB::VERSION
|
11
11
|
spec.authors = ['Masatoshi SEKI', 'Takashi Kokubun']
|
12
12
|
spec.email = ['seki@ruby-lang.org', 'k0kubun@ruby-lang.org']
|
13
13
|
|
14
14
|
spec.summary = %q{An easy to use but powerful templating system for Ruby.}
|
15
15
|
spec.description = %q{An easy to use but powerful templating system for Ruby.}
|
16
16
|
spec.homepage = 'https://github.com/ruby/erb'
|
17
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
|
18
17
|
spec.licenses = ['Ruby', 'BSD-2-Clause']
|
19
18
|
|
20
19
|
spec.metadata['homepage_uri'] = spec.homepage
|
@@ -27,12 +26,11 @@ Gem::Specification.new do |spec|
|
|
27
26
|
spec.executables = ['erb']
|
28
27
|
spec.require_paths = ['lib']
|
29
28
|
|
29
|
+
spec.required_ruby_version = '>= 3.2.0'
|
30
|
+
|
30
31
|
if RUBY_ENGINE == 'jruby'
|
31
32
|
spec.platform = 'java'
|
32
33
|
else
|
33
|
-
spec.required_ruby_version = '>= 2.7.0'
|
34
34
|
spec.extensions = ['ext/erb/escape/extconf.rb']
|
35
35
|
end
|
36
|
-
|
37
|
-
spec.add_dependency 'cgi', '>= 0.3.3'
|
38
36
|
end
|
data/ext/erb/escape/escape.c
CHANGED
@@ -65,9 +65,12 @@ optimized_escape_html(VALUE str)
|
|
65
65
|
return escaped;
|
66
66
|
}
|
67
67
|
|
68
|
-
|
69
|
-
|
70
|
-
|
68
|
+
/*
|
69
|
+
* ERB::Util.html_escape is similar to CGI.escapeHTML but different in the following two parts:
|
70
|
+
*
|
71
|
+
* * ERB::Util.html_escape converts an argument with #to_s first (only if it's not T_STRING)
|
72
|
+
* * ERB::Util.html_escape does not allocate a new string when nothing needs to be escaped
|
73
|
+
*/
|
71
74
|
static VALUE
|
72
75
|
erb_escape_html(VALUE self, VALUE str)
|
73
76
|
{
|
data/lib/erb/compiler.rb
CHANGED
@@ -80,10 +80,16 @@ class ERB::Compiler # :nodoc:
|
|
80
80
|
end
|
81
81
|
|
82
82
|
class Scanner # :nodoc:
|
83
|
-
@scanner_map = {}
|
83
|
+
@scanner_map = defined?(Ractor) ? Ractor.make_shareable({}) : {}
|
84
84
|
class << self
|
85
|
-
|
86
|
-
|
85
|
+
if defined?(Ractor)
|
86
|
+
def register_scanner(klass, trim_mode, percent)
|
87
|
+
@scanner_map = Ractor.make_shareable({ **@scanner_map, [trim_mode, percent] => klass })
|
88
|
+
end
|
89
|
+
else
|
90
|
+
def register_scanner(klass, trim_mode, percent)
|
91
|
+
@scanner_map[[trim_mode, percent]] = klass
|
92
|
+
end
|
87
93
|
end
|
88
94
|
alias :regist_scanner :register_scanner
|
89
95
|
end
|
@@ -466,7 +472,17 @@ class ERB::Compiler # :nodoc:
|
|
466
472
|
return enc, frozen
|
467
473
|
end
|
468
474
|
|
475
|
+
# :stopdoc:
|
476
|
+
WARNING_UPLEVEL = Class.new {
|
477
|
+
attr_reader :c
|
478
|
+
def initialize from
|
479
|
+
@c = caller.length - from.length
|
480
|
+
end
|
481
|
+
}.new(caller(0)).c
|
482
|
+
private_constant :WARNING_UPLEVEL
|
483
|
+
# :startdoc:
|
484
|
+
|
469
485
|
def warn_invalid_trim_mode(mode, uplevel:)
|
470
|
-
warn "Invalid ERB trim mode: #{mode.inspect} (trim_mode: nil, 0, 1, 2, or String composed of '%' and/or '-', '>', '<>')", uplevel: uplevel +
|
486
|
+
warn "Invalid ERB trim mode: #{mode.inspect} (trim_mode: nil, 0, 1, 2, or String composed of '%' and/or '-', '>', '<>')", uplevel: uplevel + WARNING_UPLEVEL
|
471
487
|
end
|
472
488
|
end
|
data/lib/erb/def_method.rb
CHANGED
data/lib/erb/util.rb
CHANGED
@@ -1,17 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
2
|
+
|
3
|
+
# Load CGI.escapeHTML and CGI.escapeURIComponent.
|
4
|
+
# CRuby:
|
5
|
+
# cgi.gem v0.1.0+ (Ruby 2.7-3.4) and Ruby 3.5+ stdlib have 'cgi/escape' and CGI.escapeHTML.
|
6
|
+
# cgi.gem v0.3.3+ (Ruby 3.2-3.4) and Ruby 3.5+ stdlib have CGI.escapeURIComponent.
|
7
|
+
# JRuby: cgi.gem has a Java extension 'cgi/escape'.
|
8
|
+
# TruffleRuby: lib/truffle/cgi/escape.rb requires 'cgi/util'.
|
9
|
+
require 'cgi/escape'
|
10
|
+
|
11
|
+
# Load or define ERB::Escape#html_escape.
|
12
|
+
# We don't build the C extention 'cgi/escape' for JRuby, TruffleRuby, and WASM.
|
13
|
+
if $LOAD_PATH.resolve_feature_path('erb/escape')
|
14
|
+
require 'erb/escape'
|
15
|
+
else
|
16
|
+
# ERB::Escape
|
17
|
+
#
|
18
|
+
# A subset of ERB::Util. Unlike ERB::Util#html_escape, we expect/hope
|
19
|
+
# Rails will not monkey-patch ERB::Escape#html_escape.
|
15
20
|
module ERB::Escape
|
16
21
|
def html_escape(s)
|
17
22
|
CGI.escapeHTML(s.to_s)
|
@@ -20,7 +25,6 @@ unless defined?(ERB::Escape)
|
|
20
25
|
end
|
21
26
|
end
|
22
27
|
|
23
|
-
#--
|
24
28
|
# ERB::Util
|
25
29
|
#
|
26
30
|
# A utility module for conversion routines, often handy in HTML generation.
|
@@ -54,8 +58,16 @@ module ERB::Util
|
|
54
58
|
#
|
55
59
|
# Programming%20Ruby%3A%20%20The%20Pragmatic%20Programmer%27s%20Guide
|
56
60
|
#
|
57
|
-
|
58
|
-
|
61
|
+
if CGI.respond_to?(:escapeURIComponent)
|
62
|
+
def url_encode(s)
|
63
|
+
CGI.escapeURIComponent(s.to_s)
|
64
|
+
end
|
65
|
+
else # cgi.gem <= v0.3.2
|
66
|
+
def url_encode(s)
|
67
|
+
s.to_s.b.gsub(/[^a-zA-Z0-9_\-.~]/n) do |m|
|
68
|
+
sprintf("%%%02X", m.unpack1("C"))
|
69
|
+
end
|
70
|
+
end
|
59
71
|
end
|
60
72
|
alias u url_encode
|
61
73
|
module_function :u
|
data/lib/erb/version.rb
CHANGED
data/lib/erb.rb
CHANGED
@@ -12,7 +12,6 @@
|
|
12
12
|
#
|
13
13
|
# You can redistribute it and/or modify it under the same terms as Ruby.
|
14
14
|
|
15
|
-
require 'cgi/util'
|
16
15
|
require 'erb/version'
|
17
16
|
require 'erb/compiler'
|
18
17
|
require 'erb/def_method'
|
@@ -294,7 +293,7 @@ class ERB
|
|
294
293
|
# # build data class
|
295
294
|
# class Listings
|
296
295
|
# PRODUCT = { :name => "Chicken Fried Steak",
|
297
|
-
# :desc => "A well
|
296
|
+
# :desc => "A well messaged pattie, breaded and fried.",
|
298
297
|
# :cost => 9.95 }
|
299
298
|
#
|
300
299
|
# attr_reader :product, :price
|
@@ -327,10 +326,10 @@ class ERB
|
|
327
326
|
# _Generates_
|
328
327
|
#
|
329
328
|
# Chicken Fried Steak
|
330
|
-
# A well
|
329
|
+
# A well massaged pattie, breaded and fried.
|
331
330
|
#
|
332
331
|
# Chicken Fried Steak -- 9.95
|
333
|
-
# A well
|
332
|
+
# A well massaged pattie, breaded and fried.
|
334
333
|
#
|
335
334
|
def initialize(str, safe_level=NOT_GIVEN, legacy_trim_mode=NOT_GIVEN, legacy_eoutvar=NOT_GIVEN, trim_mode: nil, eoutvar: '_erbout')
|
336
335
|
# Complex initializer for $SAFE deprecation at [Feature #14256]. Use keyword arguments to pass trim_mode or eoutvar.
|
@@ -353,7 +352,7 @@ class ERB
|
|
353
352
|
@lineno = 0
|
354
353
|
@_init = self.class.singleton_class
|
355
354
|
end
|
356
|
-
NOT_GIVEN = Object.new
|
355
|
+
NOT_GIVEN = defined?(Ractor) ? Ractor.make_shareable(Object.new) : Object.new
|
357
356
|
private_constant :NOT_GIVEN
|
358
357
|
|
359
358
|
##
|
@@ -416,8 +415,7 @@ class ERB
|
|
416
415
|
|
417
416
|
#
|
418
417
|
# Executes the generated ERB code to produce a completed template, returning
|
419
|
-
# the results of that code.
|
420
|
-
# can be affected by _safe_level_.)
|
418
|
+
# the results of that code.
|
421
419
|
#
|
422
420
|
# _b_ accepts a Binding object which is used to set the context of
|
423
421
|
# code evaluation.
|
metadata
CHANGED
@@ -1,30 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: erb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Masatoshi SEKI
|
8
8
|
- Takashi Kokubun
|
9
|
-
autorequire:
|
10
9
|
bindir: libexec
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 0.3.3
|
20
|
-
name: cgi
|
21
|
-
prerelease: false
|
22
|
-
type: :runtime
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: 0.3.3
|
11
|
+
date: 2025-05-13 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
28
13
|
description: An easy to use but powerful templating system for Ruby.
|
29
14
|
email:
|
30
15
|
- seki@ruby-lang.org
|
@@ -34,14 +19,19 @@ executables:
|
|
34
19
|
extensions: []
|
35
20
|
extra_rdoc_files: []
|
36
21
|
files:
|
22
|
+
- ".document"
|
37
23
|
- ".github/dependabot.yml"
|
38
24
|
- ".github/workflows/test.yml"
|
39
25
|
- ".gitignore"
|
26
|
+
- ".rdoc_options"
|
27
|
+
- BDSL
|
28
|
+
- COPYING
|
40
29
|
- Gemfile
|
41
30
|
- LICENSE.txt
|
42
31
|
- NEWS.md
|
43
32
|
- README.md
|
44
33
|
- Rakefile
|
34
|
+
- _doc/cgi.rb
|
45
35
|
- bin/console
|
46
36
|
- bin/setup
|
47
37
|
- erb.gemspec
|
@@ -60,7 +50,6 @@ licenses:
|
|
60
50
|
metadata:
|
61
51
|
homepage_uri: https://github.com/ruby/erb
|
62
52
|
source_code_uri: https://github.com/ruby/erb
|
63
|
-
post_install_message:
|
64
53
|
rdoc_options: []
|
65
54
|
require_paths:
|
66
55
|
- lib
|
@@ -68,15 +57,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
57
|
requirements:
|
69
58
|
- - ">="
|
70
59
|
- !ruby/object:Gem::Version
|
71
|
-
version: 2.
|
60
|
+
version: 3.2.0
|
72
61
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
62
|
requirements:
|
74
63
|
- - ">="
|
75
64
|
- !ruby/object:Gem::Version
|
76
65
|
version: '0'
|
77
66
|
requirements: []
|
78
|
-
rubygems_version: 3.3
|
79
|
-
signing_key:
|
67
|
+
rubygems_version: 3.6.3
|
80
68
|
specification_version: 4
|
81
69
|
summary: An easy to use but powerful templating system for Ruby.
|
82
70
|
test_files: []
|