actionview 8.0.0.1 → 8.0.1
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/CHANGELOG.md +14 -0
- data/lib/action_view/gem_version.rb +2 -2
- data/lib/action_view/template/handlers/erb.rb +45 -37
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 111f783f129e091360fda6855c5b59986da5993a50d6b5d697e4290479b5f4cd
|
4
|
+
data.tar.gz: 007a3ee46b5b521c25a0a8092b9912b0189755d08621f880fdf0c9e57e874c4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b50d059c4d5110e652c612a35b28a71f007d3dc0d24aa7599b4aa64b7204fbbaa3bfac761e5f126347d47040002b16a3a4ed51d10105a9e653af1b13e47660ec
|
7
|
+
data.tar.gz: 46ef12173f11a26c6791d15a7c5b0d1600e786830bb96a837cc504c05da53aa2f69ed2f662b335bb13cd90f06ae128a0bf92d74bf6d2a2c279ed34ebc2567a9d
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## Rails 8.0.1 (December 13, 2024) ##
|
2
|
+
|
3
|
+
* Fix a crash in ERB template error highlighting when the error occurs on a
|
4
|
+
line in the compiled template that is past the end of the source template.
|
5
|
+
|
6
|
+
*Martin Emde*
|
7
|
+
|
8
|
+
* Improve reliability of ERB template error highlighting.
|
9
|
+
Fix infinite loops and crashes in highlighting and
|
10
|
+
improve tolerance for alternate ERB handlers.
|
11
|
+
|
12
|
+
*Martin Emde*
|
13
|
+
|
14
|
+
|
1
15
|
## Rails 8.0.0.1 (December 10, 2024) ##
|
2
16
|
|
3
17
|
* No changes.
|
@@ -42,7 +42,9 @@ module ActionView
|
|
42
42
|
# source location inside the template.
|
43
43
|
def translate_location(spot, backtrace_location, source)
|
44
44
|
# Tokenize the source line
|
45
|
-
|
45
|
+
source_lines = source.lines
|
46
|
+
return nil if source_lines.size < backtrace_location.lineno
|
47
|
+
tokens = ::ERB::Util.tokenize(source_lines[backtrace_location.lineno - 1])
|
46
48
|
new_first_column = find_offset(spot[:snippet], tokens, spot[:first_column])
|
47
49
|
lineno_delta = spot[:first_lineno] - backtrace_location.lineno
|
48
50
|
spot[:first_lineno] -= lineno_delta
|
@@ -51,7 +53,7 @@ module ActionView
|
|
51
53
|
column_delta = spot[:first_column] - new_first_column
|
52
54
|
spot[:first_column] -= column_delta
|
53
55
|
spot[:last_column] -= column_delta
|
54
|
-
spot[:script_lines] =
|
56
|
+
spot[:script_lines] = source_lines
|
55
57
|
|
56
58
|
spot
|
57
59
|
rescue NotImplementedError, LocationParsingError
|
@@ -105,51 +107,57 @@ module ActionView
|
|
105
107
|
raise WrongEncodingError.new(string, string.encoding)
|
106
108
|
end
|
107
109
|
|
110
|
+
# Find which token in the source template spans the byte range that
|
111
|
+
# contains the error_column, then return the offset compared to the
|
112
|
+
# original source template.
|
113
|
+
#
|
114
|
+
# Iterate consecutive pairs of CODE or TEXT tokens, requiring
|
115
|
+
# a match of the first token before matching either token.
|
116
|
+
#
|
117
|
+
# For example, if we want to find tokens A, B, C, we do the following:
|
118
|
+
# 1. Find a match for A: test error_column or advance scanner.
|
119
|
+
# 2. Find a match for B or A:
|
120
|
+
# a. If B: start over with next token set (B, C).
|
121
|
+
# b. If A: test error_column or advance scanner.
|
122
|
+
# c. Otherwise: Advance 1 byte
|
123
|
+
#
|
124
|
+
# Prioritize matching the next token over the current token once
|
125
|
+
# a match for the current token has been found. This is to prevent
|
126
|
+
# the current token from looping past the next token if they both
|
127
|
+
# match (i.e. if the current token is a single space character).
|
108
128
|
def find_offset(compiled, source_tokens, error_column)
|
109
129
|
compiled = StringScanner.new(compiled)
|
130
|
+
offset_source_tokens(source_tokens).each_cons(2) do |(name, str, offset), (_, next_str, _)|
|
131
|
+
matched_str = false
|
110
132
|
|
111
|
-
|
133
|
+
until compiled.eos?
|
134
|
+
if matched_str && next_str && compiled.match?(next_str)
|
135
|
+
break
|
136
|
+
elsif compiled.match?(str)
|
137
|
+
matched_str = true
|
112
138
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
when :TEXT
|
117
|
-
loop do
|
118
|
-
break if compiled.match?(str)
|
119
|
-
compiled.getch
|
120
|
-
end
|
121
|
-
raise LocationParsingError unless compiled.scan(str)
|
122
|
-
when :CODE
|
123
|
-
if compiled.pos > error_column
|
124
|
-
raise LocationParsingError, "We went too far"
|
125
|
-
end
|
139
|
+
if name == :CODE && compiled.pos <= error_column && compiled.pos + str.bytesize >= error_column
|
140
|
+
return error_column - compiled.pos + offset
|
141
|
+
end
|
126
142
|
|
127
|
-
|
128
|
-
offset = error_column - compiled.pos
|
129
|
-
return passed_tokens.map(&:last).join.bytesize + offset
|
143
|
+
compiled.pos += str.bytesize
|
130
144
|
else
|
131
|
-
|
132
|
-
raise LocationParsingError, "Couldn't find code snippet"
|
133
|
-
end
|
134
|
-
end
|
135
|
-
when :OPEN
|
136
|
-
next_tok = source_tokens.first.last
|
137
|
-
loop do
|
138
|
-
break if compiled.match?(next_tok)
|
139
|
-
compiled.getch
|
145
|
+
compiled.pos += 1
|
140
146
|
end
|
141
|
-
when :CLOSE
|
142
|
-
next_tok = source_tokens.first.last
|
143
|
-
loop do
|
144
|
-
break if compiled.match?(next_tok)
|
145
|
-
compiled.getch
|
146
|
-
end
|
147
|
-
else
|
148
|
-
raise LocationParsingError, "Not implemented: #{tok.first}"
|
149
147
|
end
|
148
|
+
end
|
149
|
+
|
150
|
+
raise LocationParsingError, "Couldn't find code snippet"
|
151
|
+
end
|
150
152
|
|
151
|
-
|
153
|
+
def offset_source_tokens(source_tokens)
|
154
|
+
source_offset = 0
|
155
|
+
with_offset = source_tokens.filter_map do |(name, str)|
|
156
|
+
result = [name, str, source_offset] if name == :CODE || name == :TEXT
|
157
|
+
source_offset += str.bytesize
|
158
|
+
result
|
152
159
|
end
|
160
|
+
with_offset << [:EOS, nil, source_offset]
|
153
161
|
end
|
154
162
|
end
|
155
163
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actionview
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.0.
|
4
|
+
version: 8.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 8.0.
|
19
|
+
version: 8.0.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 8.0.
|
26
|
+
version: 8.0.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: builder
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,28 +86,28 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - '='
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 8.0.
|
89
|
+
version: 8.0.1
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - '='
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 8.0.
|
96
|
+
version: 8.0.1
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: activemodel
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - '='
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 8.0.
|
103
|
+
version: 8.0.1
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - '='
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 8.0.
|
110
|
+
version: 8.0.1
|
111
111
|
description: Simple, battle-tested conventions and helpers for building web pages.
|
112
112
|
email: david@loudthinking.com
|
113
113
|
executables: []
|
@@ -247,10 +247,10 @@ licenses:
|
|
247
247
|
- MIT
|
248
248
|
metadata:
|
249
249
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
250
|
-
changelog_uri: https://github.com/rails/rails/blob/v8.0.
|
251
|
-
documentation_uri: https://api.rubyonrails.org/v8.0.
|
250
|
+
changelog_uri: https://github.com/rails/rails/blob/v8.0.1/actionview/CHANGELOG.md
|
251
|
+
documentation_uri: https://api.rubyonrails.org/v8.0.1/
|
252
252
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
253
|
-
source_code_uri: https://github.com/rails/rails/tree/v8.0.
|
253
|
+
source_code_uri: https://github.com/rails/rails/tree/v8.0.1/actionview
|
254
254
|
rubygems_mfa_required: 'true'
|
255
255
|
post_install_message:
|
256
256
|
rdoc_options: []
|