html_validation 0.6.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -13,13 +13,13 @@ barring that, review and accept any errors and warnings.
13
13
 
14
14
  == HTML 5
15
15
 
16
- The current (as of March 2013) default version of Tidy doesn't support HTML 5.
16
+ The current (as of May 2013) default version of Tidy doesn't support HTML 5.
17
17
  To get HTML 5 support, install this fork of tidy: https://github.com/w3c/tidy-html5
18
18
 
19
- Be sure to get rid of the old tidy first if you have it already. on Debian variants: sudo apt-get remove tidy
20
-
21
19
  Download the repo as a zip file and extract somewhere, then follow the instructions
22
- given on the page (using sudo for make commands if on Linux).
20
+ given on the page (using sudo for make commands if on Linux). Add it to the PATH.
21
+ Note that OS X and Debian like to install the old version of tidy in /usr/bin so
22
+ if you don't remove it or place the newer one earlier on the PATH, sadness may ensue.
23
23
 
24
24
  On linux/OS X machines, confirm the right installation path using: which tidy
25
25
 
@@ -33,18 +33,22 @@ On linux/OS X machines, confirm the right installation path using: which tidy
33
33
 
34
34
  page.should have_valid_html
35
35
 
36
+ or with the new syntax:
37
+
38
+ expect(page).to have_valid_html
39
+
36
40
  It can be convenient to see the html printed in the RSpec failure messages.
37
41
  To set this feature (globally for all):
38
42
 
39
43
  HaveValidHTML.show_html_in_failures = true
40
44
 
41
45
 
42
- All tidy flags, including using a config file can be handled.
46
+ All Tidy flags, including using a config file can be handled.
43
47
 
44
48
  A shortcut to disable Tidy Warning messages (they are on by default)
45
49
  has been created for your convenience. However, some things that might be
46
50
  called "errors" show up as warnings, so the recommended approach is
47
- run, then accept the errors / warnings that are noted. The shortcut
51
+ run, then accept the errors / warnings that are noted. At your peril, the shortcut
48
52
  is:
49
53
 
50
54
  HTMLValidation.show_warnings = false
@@ -107,7 +111,9 @@ On linux/OS X machines, confirm the right installation path using: which tidy
107
111
 
108
112
  == Requirements
109
113
 
110
- HTML Tidy needs to be either installed at /usr/bin/tidy or on the PATH.
114
+ HTML Tidy needs to be on the PATH.
115
+
116
+ Make sure the right Tidy is being picked up with: which tidy
111
117
 
112
118
 
113
119
  == Contributing to html_validation
data/bin/html_validation CHANGED
@@ -9,7 +9,7 @@ class HTMLValidationReview < Thor
9
9
  include PageValidations
10
10
  desc "review", "Review and Accept (or fix and rerun) HTML Validation errors"
11
11
 
12
- method_option :data_path, :aliases => "-d", :desc => "Optional custom data path (if not default of /spec/.validate)"
12
+ method_option :data_path, :aliases => "-d", :desc => "Optional custom data path (if not default of .validation in project root)"
13
13
  def review
14
14
  data_path = options[:data_path] || File.join(Dir.getwd, '.validation')
15
15
  $stdout.puts "Reviewing validation results in: #{data_path}"
@@ -22,6 +22,7 @@ class HTMLValidationReview < Thor
22
22
  result.accept!
23
23
  $stdout.puts "Accepted!"
24
24
  else
25
+ result.reject!
25
26
  $stdout.puts "Rejected!"
26
27
  end
27
28
  exit if sin.downcase == 'exit' or sin.downcase == 'quit' or sin.downcase == 'q'
@@ -57,12 +57,21 @@ class HTMLValidationResult
57
57
  File.open(data_path("accepted"), 'w') {|f| f.write(@exceptions) }
58
58
  end
59
59
 
60
+ def reject!
61
+ if File.exists?(data_path("accepted"))
62
+ File.delete data_path("accepted")
63
+ end
64
+ end
65
+
60
66
  private
61
- # We specifically prefer /usr/bin/tidy by default on *nix as there is another "tidy" program
62
- # that could end up earlier on the path. tidy was installed at this location for me by default.
67
+ # We used to specifically prefer /usr/bin/tidy by default on *nix as there is another "tidy" program
68
+ # that could end up earlier on the path. Tidy was installed at this location for me by default.
69
+ # The norm is now to custom install the tidy fork for HTML 5, though, and respecting the PATH is
70
+ # better philosophically. Now we expect the PATH to be correct. ie,
71
+ # if which Tidy being used is an issue, put the right tidy first on the PATH.
63
72
  def tidy_command
64
73
  is_windows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)
65
- bin = (is_windows or !File.exists?("/usr/bin/tidy")) ? 'tidy' : '/usr/bin/tidy'
74
+ bin = is_windows ? 'tidy.exe' : 'tidy'
66
75
  cmd = "#{bin} #{@tidy_flags.join(' ')}"
67
76
  cmd
68
77
  end
@@ -1,3 +1,3 @@
1
1
  module PageValidations
2
- HTML_VALIDATOR_VERSION = "0.6.0"
2
+ HTML_VALIDATOR_VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html_validation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-12 00:00:00.000000000 Z
12
+ date: 2013-07-17 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: HTML Validation lets you validate html locally. Lets you build html validation
15
15
  into your test suite, but break the rules if you must.
@@ -68,3 +68,4 @@ test_files:
68
68
  - spec/html_validation_matcher_spec.rb
69
69
  - spec/html_validation_spec.rb
70
70
  - spec/spec_helper.rb
71
+ has_rdoc: