html_acceptance 0.1.17 → 0.1.18
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.
- data/VERSION +1 -1
- data/html_acceptance.gemspec +1 -1
- data/lib/html_acceptance/html_acceptance_result.rb +2 -0
- data/lib/html_acceptance.rb +5 -1
- data/spec/html_acceptance_spec.rb +12 -2
- metadata +2 -2
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.18
|
data/html_acceptance.gemspec
CHANGED
|
@@ -10,6 +10,7 @@ class HTMLAcceptanceResult
|
|
|
10
10
|
@exceptions = ''
|
|
11
11
|
@datapath=datapath
|
|
12
12
|
@tidyopts = options[:tidy_opts] || "-qi"
|
|
13
|
+
@ignore_proprietary = options[:ignore_proprietary]
|
|
13
14
|
valid?
|
|
14
15
|
end
|
|
15
16
|
|
|
@@ -73,6 +74,7 @@ class HTMLAcceptanceResult
|
|
|
73
74
|
# accepted exception strings will remain valid.
|
|
74
75
|
def filter(str)
|
|
75
76
|
str.gsub!(/^line.*trimming empty.*\n/, '') # the messages about empty are overzealous, and not invalid
|
|
77
|
+
str.gsub!(/^line.*proprietary.*\n/, '') if @ignore_proprietary # if you use IE only attributes like wrap, or spellcheck or things not in standard
|
|
76
78
|
str.gsub(/line [0-9]+ column [0-9]+ -/, '')
|
|
77
79
|
# /line [0-9]+ column [0-9]+ - / + =~ "line 1 column 1 - Warning: missing <!DOCTYPE> declaration"
|
|
78
80
|
end
|
data/lib/html_acceptance.rb
CHANGED
|
@@ -27,11 +27,15 @@ class HTMLAcceptance
|
|
|
27
27
|
# what else you might use for this string instead of "-qi", however "-qi" is probably what
|
|
28
28
|
# you want 95% of the time.
|
|
29
29
|
|
|
30
|
+
# You may also pass :ignore_proprietary=>true as an option to suppress messages like:
|
|
31
|
+
# line 1 column 176 - Warning: <textarea> proprietary attribute "wrap"
|
|
32
|
+
# line 1 column 176 - Warning: <textarea> proprietary attribute "spellcheck"
|
|
33
|
+
|
|
30
34
|
# It may be useful to pass a subfolder in your project as the data_folder, so your
|
|
31
35
|
# html acceptance status and validation results are stored along with your source.
|
|
32
36
|
def initialize(data_folder, options={})
|
|
33
37
|
@data_folder = data_folder
|
|
34
|
-
@options=options
|
|
38
|
+
@options = options
|
|
35
39
|
end
|
|
36
40
|
|
|
37
41
|
# For each stored exception, yield an HTMLAcceptanceResult object to allow the user to
|
|
@@ -63,6 +63,14 @@ describe "HtmlAcceptance" do
|
|
|
63
63
|
result=@h.validator("<html></body></html>", "http://mycoolsite.com").valid?.should be_false
|
|
64
64
|
end
|
|
65
65
|
|
|
66
|
+
it "should ignore proprietary tags when ignore_proprietary is passed" do
|
|
67
|
+
html_with_proprietary=good_html.gsub('<body>','<body><textarea wrap="true" spellcheck="true">hi</textarea>')
|
|
68
|
+
result=@h.validator(html_with_proprietary, "http://mycrosoft.com")
|
|
69
|
+
result.valid?.should be_false
|
|
70
|
+
@h=HTMLAcceptance.new('/tmp/validation', :ignore_proprietary=>true)
|
|
71
|
+
result=@h.validator(html_with_proprietary, "http://mycrosoft.com")
|
|
72
|
+
result.valid?.should be_true
|
|
73
|
+
end
|
|
66
74
|
|
|
67
75
|
describe "when launching HTML Tidy" do
|
|
68
76
|
|
|
@@ -94,6 +102,8 @@ describe "HtmlAcceptance" do
|
|
|
94
102
|
|
|
95
103
|
end
|
|
96
104
|
|
|
105
|
+
|
|
106
|
+
|
|
97
107
|
private
|
|
98
108
|
|
|
99
109
|
def bad_html
|
|
@@ -101,9 +111,9 @@ describe "HtmlAcceptance" do
|
|
|
101
111
|
end
|
|
102
112
|
|
|
103
113
|
def good_html
|
|
104
|
-
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><title>the title</title></head><body><p>a paragraph</body></html>'
|
|
114
|
+
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><title>the title</title></head><body><p>a paragraph</p></body></html>'
|
|
105
115
|
end
|
|
106
|
-
|
|
116
|
+
|
|
107
117
|
def tmp_path
|
|
108
118
|
is_windows=(RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)
|
|
109
119
|
is_windows ? 'c:\temp\validation' : '/tmp/validation'
|
metadata
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: html_acceptance
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease:
|
|
5
|
-
version: 0.1.
|
|
5
|
+
version: 0.1.18
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
8
8
|
- Eric Beland
|
|
@@ -97,7 +97,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
97
97
|
requirements:
|
|
98
98
|
- - ">="
|
|
99
99
|
- !ruby/object:Gem::Version
|
|
100
|
-
hash: -
|
|
100
|
+
hash: -2658959921504484896
|
|
101
101
|
segments:
|
|
102
102
|
- 0
|
|
103
103
|
version: "0"
|