actionview 4.1.16 → 4.2.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of actionview might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +85 -483
- data/README.rdoc +7 -2
- data/lib/action_view.rb +0 -1
- data/lib/action_view/base.rb +2 -10
- data/lib/action_view/digestor.rb +1 -1
- data/lib/action_view/gem_version.rb +3 -3
- data/lib/action_view/helpers/asset_tag_helper.rb +32 -25
- data/lib/action_view/helpers/asset_url_helper.rb +29 -18
- data/lib/action_view/helpers/cache_helper.rb +2 -2
- data/lib/action_view/helpers/capture_helper.rb +1 -12
- data/lib/action_view/helpers/date_helper.rb +16 -12
- data/lib/action_view/helpers/debug_helper.rb +7 -11
- data/lib/action_view/helpers/form_helper.rb +65 -13
- data/lib/action_view/helpers/form_options_helper.rb +3 -3
- data/lib/action_view/helpers/form_tag_helper.rb +137 -28
- data/lib/action_view/helpers/javascript_helper.rb +7 -1
- data/lib/action_view/helpers/number_helper.rb +8 -10
- data/lib/action_view/helpers/output_safety_helper.rb +6 -6
- data/lib/action_view/helpers/rendering_helper.rb +6 -6
- data/lib/action_view/helpers/sanitize_helper.rb +67 -109
- data/lib/action_view/helpers/tag_helper.rb +15 -5
- data/lib/action_view/helpers/tags/base.rb +1 -1
- data/lib/action_view/helpers/tags/collection_check_boxes.rb +5 -1
- data/lib/action_view/helpers/tags/collection_helpers.rb +1 -1
- data/lib/action_view/helpers/tags/datetime_field.rb +10 -2
- data/lib/action_view/helpers/tags/label.rb +3 -3
- data/lib/action_view/helpers/tags/placeholderable.rb +32 -0
- data/lib/action_view/helpers/tags/text_area.rb +4 -0
- data/lib/action_view/helpers/tags/text_field.rb +4 -1
- data/lib/action_view/helpers/tags/week_field.rb +1 -1
- data/lib/action_view/helpers/text_helper.rb +25 -8
- data/lib/action_view/helpers/translation_helper.rb +29 -25
- data/lib/action_view/helpers/url_helper.rb +13 -14
- data/lib/action_view/log_subscriber.rb +5 -5
- data/lib/action_view/lookup_context.rb +6 -12
- data/lib/action_view/model_naming.rb +1 -1
- data/lib/action_view/path_set.rb +7 -19
- data/lib/action_view/renderer/abstract_renderer.rb +5 -3
- data/lib/action_view/renderer/partial_renderer.rb +76 -38
- data/lib/action_view/renderer/renderer.rb +0 -4
- data/lib/action_view/renderer/template_renderer.rb +5 -6
- data/lib/action_view/rendering.rb +7 -6
- data/lib/action_view/routing_url_for.rb +13 -5
- data/lib/action_view/tasks/dependencies.rake +7 -9
- data/lib/action_view/template/handlers.rb +9 -0
- data/lib/action_view/template/resolver.rb +7 -24
- data/lib/action_view/test_case.rb +13 -7
- data/lib/action_view/testing/resolvers.rb +2 -2
- data/lib/action_view/view_paths.rb +26 -15
- metadata +52 -18
- data/lib/action_view/vendor/html-scanner.rb +0 -20
- data/lib/action_view/vendor/html-scanner/html/document.rb +0 -68
- data/lib/action_view/vendor/html-scanner/html/node.rb +0 -532
- data/lib/action_view/vendor/html-scanner/html/sanitizer.rb +0 -188
- data/lib/action_view/vendor/html-scanner/html/selector.rb +0 -830
- data/lib/action_view/vendor/html-scanner/html/tokenizer.rb +0 -107
- data/lib/action_view/vendor/html-scanner/html/version.rb +0 -11
@@ -1,107 +0,0 @@
|
|
1
|
-
require 'strscan'
|
2
|
-
|
3
|
-
module HTML #:nodoc:
|
4
|
-
|
5
|
-
# A simple HTML tokenizer. It simply breaks a stream of text into tokens, where each
|
6
|
-
# token is a string. Each string represents either "text", or an HTML element.
|
7
|
-
#
|
8
|
-
# This currently assumes valid XHTML, which means no free < or > characters.
|
9
|
-
#
|
10
|
-
# Usage:
|
11
|
-
#
|
12
|
-
# tokenizer = HTML::Tokenizer.new(text)
|
13
|
-
# while token = tokenizer.next
|
14
|
-
# p token
|
15
|
-
# end
|
16
|
-
class Tokenizer #:nodoc:
|
17
|
-
|
18
|
-
# The current (byte) position in the text
|
19
|
-
attr_reader :position
|
20
|
-
|
21
|
-
# The current line number
|
22
|
-
attr_reader :line
|
23
|
-
|
24
|
-
# Create a new Tokenizer for the given text.
|
25
|
-
def initialize(text)
|
26
|
-
text.encode!
|
27
|
-
@scanner = StringScanner.new(text)
|
28
|
-
@position = 0
|
29
|
-
@line = 0
|
30
|
-
@current_line = 1
|
31
|
-
end
|
32
|
-
|
33
|
-
# Returns the next token in the sequence, or +nil+ if there are no more tokens in
|
34
|
-
# the stream.
|
35
|
-
def next
|
36
|
-
return nil if @scanner.eos?
|
37
|
-
@position = @scanner.pos
|
38
|
-
@line = @current_line
|
39
|
-
if @scanner.check(/<\S/)
|
40
|
-
update_current_line(scan_tag)
|
41
|
-
else
|
42
|
-
update_current_line(scan_text)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
private
|
47
|
-
|
48
|
-
# Treat the text at the current position as a tag, and scan it. Supports
|
49
|
-
# comments, doctype tags, and regular tags, and ignores less-than and
|
50
|
-
# greater-than characters within quoted strings.
|
51
|
-
def scan_tag
|
52
|
-
tag = @scanner.getch
|
53
|
-
if @scanner.scan(/!--/) # comment
|
54
|
-
tag << @scanner.matched
|
55
|
-
tag << (@scanner.scan_until(/--\s*>/) || @scanner.scan_until(/\Z/))
|
56
|
-
elsif @scanner.scan(/!\[CDATA\[/)
|
57
|
-
tag << @scanner.matched
|
58
|
-
tag << (@scanner.scan_until(/\]\]>/) || @scanner.scan_until(/\Z/))
|
59
|
-
elsif @scanner.scan(/!/) # doctype
|
60
|
-
tag << @scanner.matched
|
61
|
-
tag << consume_quoted_regions
|
62
|
-
else
|
63
|
-
tag << consume_quoted_regions
|
64
|
-
end
|
65
|
-
tag
|
66
|
-
end
|
67
|
-
|
68
|
-
# Scan all text up to the next < character and return it.
|
69
|
-
def scan_text
|
70
|
-
"#{@scanner.getch}#{@scanner.scan(/[^<]*/)}"
|
71
|
-
end
|
72
|
-
|
73
|
-
# Counts the number of newlines in the text and updates the current line
|
74
|
-
# accordingly.
|
75
|
-
def update_current_line(text)
|
76
|
-
text.scan(/\r?\n/) { @current_line += 1 }
|
77
|
-
end
|
78
|
-
|
79
|
-
# Skips over quoted strings, so that less-than and greater-than characters
|
80
|
-
# within the strings are ignored.
|
81
|
-
def consume_quoted_regions
|
82
|
-
text = ""
|
83
|
-
loop do
|
84
|
-
match = @scanner.scan_until(/['"<>]/) or break
|
85
|
-
|
86
|
-
delim = @scanner.matched
|
87
|
-
if delim == "<"
|
88
|
-
match = match.chop
|
89
|
-
@scanner.pos -= 1
|
90
|
-
end
|
91
|
-
|
92
|
-
text << match
|
93
|
-
break if delim == "<" || delim == ">"
|
94
|
-
|
95
|
-
# consume the quoted region
|
96
|
-
while match = @scanner.scan_until(/[\\#{delim}]/)
|
97
|
-
text << match
|
98
|
-
break if @scanner.matched == delim
|
99
|
-
break if @scanner.eos?
|
100
|
-
text << @scanner.getch # skip the escaped character
|
101
|
-
end
|
102
|
-
end
|
103
|
-
text
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
end
|