Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up HTML::Proofer #104

Merged
merged 4 commits into from
Oct 23, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,12 @@ changes, type in a commit message, and click the `Propose File Change` button.
That’s it!

For more advanced changes, check out [the bootstrap instructions](https://github.com/github/choosealicense.com#run-it-on-your-machine) in the [project's readme](https://github.com/github/choosealicense.com/blob/master/README.md).

## Testing

[HTML::Proofer](https://github.com/gjtorikian/html-proofer) is set up to validate all links within the project. You can run this locally to ensure that your changes are valid:

```shell
./script/bootstrap
./script/cibuild
```
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ source 'https://rubygems.org'
ruby File.read('.ruby-version').strip

gem "github-pages"

group :test do
gem "html-proofer"
gem "rake"
end
18 changes: 18 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ GEM
classifier (1.3.3)
fast-stemmer (>= 1.0.0)
colorator (0.1)
colored (1.2)
commander (4.1.5)
highline (~> 1.6.11)
directory_watcher (1.4.1)
ethon (0.6.1)
ffi (>= 1.3.0)
mime-types (~> 1.18)
fast-stemmer (1.0.2)
ffi (1.9.0)
github-pages (4)
RedCloth (= 4.2.9)
jekyll (= 1.1.2)
Expand All @@ -18,6 +23,10 @@ GEM
rdiscount (= 1.6.8)
redcarpet (= 2.2.2)
highline (1.6.19)
html-proofer (0.1.1)
colored (~> 1.2)
nokogiri (= 1.6.0)
typhoeus (~> 0.6.3)
jekyll (1.1.2)
classifier (~> 1.3)
colorator (~> 0.1)
Expand All @@ -33,18 +42,27 @@ GEM
liquid (2.5.1)
maruku (0.6.1)
syntax (>= 1.0.0)
mime-types (1.25)
mini_portile (0.5.1)
nokogiri (1.6.0)
mini_portile (~> 0.5.0)
posix-spawn (0.3.6)
pygments.rb (0.5.2)
posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.1.0)
rake (10.1.0)
rdiscount (1.6.8)
redcarpet (2.2.2)
safe_yaml (0.7.1)
syntax (1.0.0)
typhoeus (0.6.5)
ethon (~> 0.6.1)
yajl-ruby (1.1.0)

PLATFORMS
ruby

DEPENDENCIES
github-pages
html-proofer
rake
7 changes: 7 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require "html/proofer"

task :test do
sh "bundle exec jekyll build --trace"
# ignore href="#" for the "Copy to clipboard" button
HTML::Proofer.new("./_site", :href_ignore => ["#"]).run
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do we link to #?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<a href="#" data-clipboard-target="license-text" class="js-clipboard-button button">Copy license text to clipboard</a>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think blanket ignoring # is dangerous. There have been times when that's been used as a placeholder (when it shouldn't have).

Why not use a <button> instead of an <a>?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another alternative I've heard is injecting that "copy to clipboard" button via JS, so that, if they have JS disabled (for some reason), there isn't a link/button that doesn't do anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...which would get around the HTML::Proofer.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gjtorikian/html-proofer#7 may solve this... just need to find time to implement.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No excuses now! gjtorikian/html-proofer#12

Really though, :href_ignore => ["#"] is dangerous.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gjtorikian You want to do a PR making those changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(or I can)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@afeld any chance we could add html-proofer-ignore to those URLs and drop the href_ignore? essentially defeats the entire point of HTML Proofer.

end
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h2>
<ul class="triptych situations cf">
<li class='whatever'>
<a href="licenses/mit">
<img height='57' src='images/three-arrows@2x.png' width='72'>
<img height='57' src='images/three-arrows@2x.png' width='72' alt='three arrows'>
<h3>I want it simple and permissive.</h3>
</a>
<p>
Expand All @@ -26,7 +26,7 @@ <h3>I want it simple and permissive.</h3>
</li>
<li class='patents'>
<a href="licenses/apache">
<img height='72' src='images/lightbulb@2x.png' width='43'>
<img height='72' src='images/lightbulb@2x.png' width='43' alt='light bulb'>
<h3>I’m concerned about patents.</h3>
</a>
<p>
Expand All @@ -38,7 +38,7 @@ <h3>I’m concerned about patents.</h3>
</li>
<li class='copyleft'>
<a href="licenses/gpl-v2">
<img height='69' src='images/circular@2x.png' width='72'>
<img height='69' src='images/circular@2x.png' width='72' alt='circular arrows'>
<h3>I care about sharing improvements.</h3>
</a>
<p>
Expand Down
2 changes: 1 addition & 1 deletion script/cibuild
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ echo "compiling javascript..."
./node_modules/.bin/coffee -c javascripts/app.coffee

echo "building the site..."
bundle exec jekyll build --trace
bundle exec rake test