Add htmlproofer to verify links (#252)

* Add htmlproofer to verify links

Partially addresses #247

* Make htmlproofer a Rake task

* Verify that we don't have leftover Markdown links

* Don't build the full Ruby Sass docs before running htmlproofer

* Don't check generated documentation

* Fix a few more broken links

* Add another URL exception

* Limit which branches we run tests for

* Add more URL exceptions
This commit is contained in:
Natalie Weizenbaum 2018-12-27 17:32:59 -08:00 committed by Jina Anne
parent d0c41df567
commit b67fc7928b
17 changed files with 80 additions and 38 deletions

9
.travis.yml Normal file
View File

@ -0,0 +1,9 @@
language: ruby
script: bundle exec rake test
branches:
only:
- master
# Feature branches beginning with "feature."
- "/^feature\\..*/"

View File

@ -3,6 +3,7 @@ ruby '2.4.1'
gem 'breakpoint', '~> 2.5.0'
gem 'builder', '~> 3.2.2'
gem 'html-proofer', '~> 3.9'
gem 'middleman', '~> 3.4.1'
gem 'middleman-autoprefixer', '~> 2.6.2'
gem 'middleman-livereload', '~> 3.4.5'

View File

@ -6,6 +6,8 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
autoprefixer-rails (6.2.3)
execjs
json
@ -24,6 +26,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.12.2)
colorize (0.8.1)
compass (1.0.3)
chunky_png (~> 1.2)
compass-core (~> 1.0.2)
@ -40,6 +43,8 @@ GEM
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
erubis (2.7.0)
ethon (0.11.0)
ffi (>= 1.3.0)
eventmachine (1.2.5)
execjs (2.7.0)
ffi (1.9.23)
@ -49,6 +54,15 @@ GEM
hike (1.2.3)
hooks (0.4.1)
uber (~> 0.0.14)
html-proofer (3.9.2)
activesupport (>= 4.2, < 6.0)
addressable (~> 2.3)
colorize (~> 0.8)
mercenary (~> 0.3.2)
nokogiri (~> 1.8.1)
parallel (~> 1.3)
typhoeus (~> 1.3)
yell (~> 2.0)
htmlcompressor (0.2.0)
http_parser.rb (0.6.0)
i18n (0.7.0)
@ -58,6 +72,7 @@ GEM
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
mercenary (0.3.6)
middleman (3.4.1)
coffee-script (~> 2.2)
compass (>= 1.0.0, < 2.0.0)
@ -116,6 +131,8 @@ GEM
tilt (>= 1.4.1, < 3)
padrino-support (0.12.9)
activesupport (>= 3.1)
parallel (1.12.1)
public_suffix (3.0.3)
puma (3.11.3)
rack (1.6.9)
rack-contrib (1.8.0)
@ -156,6 +173,8 @@ GEM
thor (0.20.0)
thread_safe (0.3.6)
tilt (1.4.1)
typhoeus (1.3.0)
ethon (>= 0.9.0)
typogruby (1.0.18)
rubypants
tzinfo (1.2.5)
@ -167,6 +186,7 @@ GEM
xpath (2.1.0)
nokogiri (~> 1.3)
yard (0.9.12)
yell (2.0.7)
PLATFORMS
ruby
@ -174,6 +194,7 @@ PLATFORMS
DEPENDENCIES
breakpoint (~> 2.5.0)
builder (~> 3.2.2)
html-proofer (~> 3.9)
middleman (~> 3.4.1)
middleman-autoprefixer (~> 2.6.2)
middleman-livereload (~> 3.4.5)
@ -200,4 +221,4 @@ RUBY VERSION
ruby 2.4.1p111
BUNDLED WITH
1.16.1
1.16.2

View File

@ -1,7 +1,25 @@
require 'html-proofer'
require 'semantic'
require 'yaml'
require 'yard'
require File.dirname(__FILE__) + '/lib/raw_markdown_link'
task :test => ["sass:dart:version", "sass:libsass:version", "sass:ruby:version", :middleman] do
HTMLProofer.check_directory("./build",
url_ignore: [
/file\.SASS/, # We don't want to verify reference links.
"https://www.drupal.org/dcoc", # This doesn't allow automated requests.
# These fail on Travis only.
"https://dnomak.com/flexiblegs/",
"https://incident57.com/codekit/",
"https://daringfireball.net/projects/markdown/",
],
file_ignore: [%r{^\./build/documentation}],
assume_extension: true
).run
end
namespace :sass do
# Adds an implementation's version number to data/version.yml.
def add_version(impl, version)

View File

@ -27,12 +27,8 @@ blogs:
url: "http://css-tricks.com/search-results/?q=sass"
- name: "Ben Frain"
url: "http://benfrain.com/tag/sass/"
- name: "Zurb"
url: "http://zurb.com/blog/sass"
- name: "NetTuts"
url: "http://net.tutsplus.com/?s=sass"
- name: "Viget Inspire"
url: "http://viget.com/inspire/search/YTo2OntzOjg6ImtleXdvcmRzIjtzOjQ6InNhc3MiO3M6MTE6InNlYXJjaF9tb2RlIjtzOjM6ImFsbCI7czoxMToicmVzdWx0X3BhZ2UiO3M6MTQ6Imluc3BpcmUvc2VhcmNoIjtzOjEwOiJjb2xsZWN0aW9uIjthOjE6e2k6MDtzOjE6IjEiO31zOjEwOiJsb29zZV9lbmRzIjtiOjE7czo4OiJjYXRlZ29yeSI7czozOiIxMjUiO30"
- name: "Unmatched Style"
url: "http://www.google.com/cse?cx=partner-pub-1988806651014029%3A4kuybaak597&ie=ISO-8859-1&q=sass#gsc.tab=0&gsc.q=sass&gsc.page=1"
- name: "Sass Bites"
@ -71,9 +67,6 @@ projects:
- name: "Bootstrap"
url: "https://github.com/twbs/bootstrap-sass"
description: "the ubiquitous framework&hellip; this time written in Sass!"
- name: "Gravity"
url: "https://github.com/owainlewis/gravity"
description: "a framework for making HTML5 websites with Sass"
- name: "Inuit.css"
url: "http://inuitcss.com/"
description: "a powerful, scalable, Sass-based, BEM, OOCSS framework"
@ -97,9 +90,6 @@ articles:
- name: "Redesigning with Sass"
url: "http://css-tricks.com/redesigning-with-sass/"
description: "by David Walsh, from CSS Tricks, October 2012"
- name: "Using Bower with Sass & Compass"
url: "http://anthonyshort.me/using-bower-with-sass-and-compass/"
description: "by Anthony Short, October 2012"
- name: "Preprocess THIS!"
url: "http://cognition.happycog.com/article/preprocess-this"
description: "by Allison Wagner, from Cognition, September 2012"
@ -112,9 +102,6 @@ articles:
- name: "Stop the Pain of Vanilla CSS and Get Relief by Adding Toppings with Sass"
url: "http://www.zurb.com/article/1031/stop-the-pain-of-vanilla-css-and-get-reli"
description: "by Chris, from the Zurb blog, July 2012"
- name: "Building a Nested Responsive Grid with Sass & Compass"
url: "http://viget.com/inspire/building-a-nested-responsive-grid-with-sass-compass"
description: "by Trevor Davis, from Viget, May 2012"
- name: "Nested Selectors: The Inception Rule"
url: "http://thesassway.com/beginner/the-inception-rule"
description: "by Mario 'Kuroir' Ricalde, from The Sass Way, November 2011"

View File

@ -3,7 +3,7 @@ resources:
url: "http://benfrain.com/lightning-fast-sass-compiling-with-libsass-node-sass-and-grunt-sass/"
description: "by Ben Frain, August 2013"
- name: "Node, Express and libSass"
url: "https://www.gitbook.io/book/anotheruiguy/nodeexpreslibsass_from-scratch"
url: "https://www.gitbooks.io/book/anotheruiguy/nodeexpreslibsass_from-scratch"
description: "Node, Express and libSass: a project from scratch workshop"

View File

@ -11,5 +11,3 @@ core:
link: http://chriseppstein.github.io/
- name: Hampton Catlin
link: http://www.hamptoncatlin.com/
- name: Michael Catlin
link: http://www.mjlcatlin.com/

13
lib/raw_markdown_link.rb Normal file
View File

@ -0,0 +1,13 @@
require 'html-proofer'
class RawMarkdownLink < HTMLProofer::Check
def run
@html.search('//text()').each do |node|
text = create_element(node)
if node.text =~ /(\[[^\]]+\](\[[^\]]*\]|\([^)]+\)))/
add_issue "Broken Markdown link #{$1}.", line: text.line
end
end
end
end

View File

@ -26,7 +26,7 @@ title: "#teamSass"
%li
:markdown
The Sass community is amazing. There are a number of
[frameworks](#Frameworks) that make using Sass simple. Want to try Sass in
[frameworks](#Projects) that make using Sass simple. Want to try Sass in
Node, Python, or another framework? Check out the
[libSass&nbsp;resources](/libsass).

View File

@ -18,7 +18,7 @@ title: Dart Sass
Dart Sass's stand-alone command-line executable uses the blazing-fast Dart
VM to compile your stylesheets. To install Dart Sass on the command line,
check out the #{link_to "installation instructions", "install"}. Once
check out the #{link_to "installation instructions", "/install"}. Once
you've got it running, you can use it compile files:
sass source/stylesheets/index.scss build/stylesheets/index.css

View File

@ -15,7 +15,7 @@ title: Install Sass
%ul.list-feature
%li
= link_to "CodeKit", "http://incident57.com/codekit/"
= link_to "CodeKit", "https://incident57.com/codekit/"
%span.info (Paid)
%span.mac-icon
%li

View File

@ -4,24 +4,24 @@
%li Current Releases:
%li
%span.release-name<
= link_to "Dart Sass", "dart-sass"
= link_to "Dart Sass", "/dart-sass"
-# Force space between the two links.
&#32;
= link_to impl_version(:dart) || "???", release_url(:dart)
%li
%span.release-name<
= link_to "LibSass", "libsass"
= link_to "LibSass", "/libsass"
-# Force space between the two links.
&#32;
= link_to impl_version(:libsass) || "???", release_url(:libsass)
%li
%span.release-name<
= link_to "Ruby Sass", "ruby-sass"
= link_to "Ruby Sass", "/ruby-sass"
-# Force space between the two links.
&#32;
= link_to impl_version(:ruby) || "???", |
"/documentation/file.SASS_CHANGELOG.html" |
%li= link_to "Implementation Guide", "implementation"
%li= link_to "Implementation Guide", "/implementation"

View File

@ -42,10 +42,6 @@
%p.visually-hidden
%button.primary(type="submit") Submit
- content_for :js_foot do
= javascript_include_tag "tools/styleguide/responsive/test"
- if content_for?(:section_middle)
%section.section-middle
.container= yield_content :section_middle

View File

@ -123,9 +123,9 @@ title: LibSass
:markdown
### Python
There are two Python projects that are updated regularly. The
[libsass-python](https://github.com/dahlia/libsass-python) project (there
[libsass-python](https://github.com/sass/libsass-python) project (there
are more details on
[its own website](http://hongminhee.org/libsass-python/)) and the
[its own website](https://sass.github.io/libsass-python/)) and the
[python-scss](https://github.com/pistolero/python-scss) project.
Two other Python projects,

View File

@ -27,7 +27,7 @@ title: Ruby Sass
Sass. Ongoing maintenance includes adding any warnings for new behavioral
differences, if they come up.
[Dart Sass]: #{url_for "dart-sass"}
[Dart Sass]: #{url_for "/dart-sass"}
Once the maintenance period ends, Ruby Sass's repository will be archived,
no more changes of any kind will be made, and no new releases will be cut.
@ -43,7 +43,7 @@ title: Ruby Sass
designed by the language team. But it would also be an opportunity to work
on a project that's used by thousands of people every day.
[LibSass]: #{url_for "libsass"}
[LibSass]: #{url_for "/libsass"}
If you're interested in adopting Ruby Sass, send an email to
[Natalie](mailto:nex342@gmail.com) and [Chris](mailto:chris@eppsteins.net)
@ -58,7 +58,7 @@ title: Ruby Sass
instead. The interface isn't identical, but most options work the same
way.
[install]: #{url_for "install"}
[install]: #{url_for "/install"}
If you use the `sass` gem as a library, the [`sassc`][] gem is the most
seamless way to move away from Ruby Sass. It uses [LibSass][] to provide
@ -68,14 +68,14 @@ title: Ruby Sass
use the [`sassc-rails`][] gem to plug smoothly into Ruby on Rails.
[`sassc`]: http://rubygems.org/gems/sassc
[LibSass]: #{url_for "libsass"}
[LibSass]: #{url_for "/libsass"}
[sassc#72]: https://github.com/sass/sassc-ruby/issues/72
[`sassc-rails`]: https://rubygems.org/gems/sassc-rails
Alternately, if you're using a JS build system, you can integrate that
with [Dart Sass][] as a JavaScript library.
[Dart Sass]: #{url_for "dart-sass"}
[Dart Sass]: #{url_for "/dart-sass"}
### Installing

View File

@ -14,7 +14,7 @@ title: Code Style Guide
## Markup
For the most part, we use [Haml](http://haml.info/) and
[Markdown](http://daringfireball.net/projects/markdown/) for writing markup.
[Markdown](https://daringfireball.net/projects/markdown/) for writing markup.
If you need to use regular HTML anywhere, write HTML5, but favor a strict
XHTML style:

View File

@ -30,6 +30,5 @@ title: Team Sass Design
%li= link_to member.name, member.link
%p
Additionally, many people attending
<a href="http://sassconf.com">SassConf 2013</a> jumped in and helped get the
Additionally, many people attending SassConf 2013 jumped in and helped get the
site deployed. Many thanks for that.