From 5cc767fb7d4cf569b849a1c91c54eeb593dc5ef1 Mon Sep 17 00:00:00 2001 From: Matthew Wilson Date: Fri, 20 Nov 2015 11:47:50 -0500 Subject: [PATCH] Added spellchecking during build - closes #948 Using gem middleman-spellcheck Added allowed wordlist Added info to README --- .travis.yml | 4 + Gemfile | 1 + Gemfile.lock | 13 ++ README.md | 17 ++- config.rb | 2 + data/spelling-exceptions.txt | 254 +++++++++++++++++++++++++++++++++++ 6 files changed, 290 insertions(+), 1 deletion(-) create mode 100644 data/spelling-exceptions.txt diff --git a/.travis.yml b/.travis.yml index 256bb027c..7a9768a41 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,4 +2,8 @@ language: ruby sudo: false rvm: - "1.9.3" +addons: + apt: + packages: + - aspell-en script: bundle exec rspec spec && bundle exec middleman build --verbose diff --git a/Gemfile b/Gemfile index f7e9322e5..fd8f52f3a 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,6 @@ source 'https://rubygems.org' +gem 'middleman-spellcheck',:git => "https://github.com/mwils/middleman-spellcheck.git", :branch => 'class' gem "redcarpet" gem "activesupport", '~> 4.1.11' gem "highline" diff --git a/Gemfile.lock b/Gemfile.lock index 6816ee5b7..5fcbb3f89 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -14,6 +14,15 @@ GIT specs: coderay (1.1.0.rc1) +GIT + remote: https://github.com/mwils/middleman-spellcheck.git + revision: 9edeaa3d7ef793f2eded94eacd3fb48d3b64a3de + branch: class + specs: + middleman-spellcheck (0.8.0) + middleman-core (~> 3.2) + nokogiri + GEM remote: https://rubygems.org/ remote: https://rails-assets.org/ @@ -209,6 +218,7 @@ DEPENDENCIES listen middleman (~> 3.0) middleman-alias + middleman-spellcheck! middleman-swiftype! poltergeist pry @@ -222,3 +232,6 @@ DEPENDENCIES tzinfo-data underscore-rails wdm (>= 0.1.0) + +BUNDLED WITH + 1.10.6 diff --git a/README.md b/README.md index 8de6fa859..476020bb6 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,21 @@ The Guides' content is in the `source` folder. The left nav bar is produced from `data/pages.yml`. `lib` contains Middleman plugins, and `spec` contains tests for those plugins. -## Developing with the Guides +## Dependencies The Guides are built with Middleman, which runs on Ruby 1.9.3 or newer (2.0.0 recommended). +During build, Middleman will require Aspell to look for misspellings. On Macs, it can be installed via Homebrew: + +``` sh +brew install aspell --with-lang-en +``` + +On Windows, you can download an [installer](http://aspell.net/win32/), but unfortunately it is unmaintained. On Linux, you can install with your distribution's package manager. On all platforms, you can also [build the most recent version from source](http://aspell.net/man-html/Installing.html). + +## Developing with the Guides + To get started: ``` sh @@ -28,6 +38,11 @@ bundle exec middleman Then visit [http://localhost:4567/](http://localhost:4567/). +### Spellchecking + +If you have a false hit during spellchecking, you can add the word to `/data/spelling-exceptions.txt`. +Words are line seperated and case insensitive. + ### Troubleshooting tips for Windows devs For Windows developers using [RubyInstaller](http://rubyinstaller.org/), you'll need to [download the DevKit](http://rubyinstaller.org/downloads) and install it using instructions: diff --git a/config.rb b/config.rb index 3b0888aea..30d19807a 100644 --- a/config.rb +++ b/config.rb @@ -59,6 +59,8 @@ def current_chapter(mm_instance, current_page) # Build ### configure :build do + set :spellcheck_allow_file, "./data/spelling-exceptions.txt" + activate :spellcheck, ignore_selector: '.CodeRay', page: /^(?!.*stylesheets|.*javascript|.*fonts|.*images|.*analytics).*$/ activate :minify_css activate :minify_javascript, ignore: /.*examples.*js/ end diff --git a/data/spelling-exceptions.txt b/data/spelling-exceptions.txt new file mode 100644 index 000000000..049bb0d4f --- /dev/null +++ b/data/spelling-exceptions.txt @@ -0,0 +1,254 @@ +foo +accessor +actionhttp +activesupport +addon +addons +ajax +allget +amd +americentric +api +apis +app's +async +asynchronicity +asynchrony +attribute's +autocomplete +autofocus +autoruns +autosave +backburner +backend +backends +beforeeach +belongsto +bindingsee +bookmarklet +boolean +breakpoint +bugfix +bugfixes +camelcase +camelize +chainable +checkbox +checkboxes +cli +clickable +cli's +config +consolesending +controllerslog +createpost +css +customevents +customizations +dasherize +dasherized +data's +databinding +datatype +datepicker +de +debounce +deletedelete +dependenciesnode +deprecations +deserialization +deserialize +deserializer +deserializing +destructuring +django +dom +draggable +ds +durations +ebryn +ECMAScript +embeddedrecordmixin +embeddedrecordsmixin +emberjs +enumerables +env +erroring +evented +facto +falsy +fastboot +filename +findget +firefox +fixesurgent +formaction +formenctype +formmethod +formnovalidate +formtarget +frontend +fullname +gc +geolocation +github +github's +globals +globbing +google +hardcode +hashchange +hasmany +hoc +homebrew +html +htmlbars +http +https +iframe +iframes +indexeddb +inflector +initializer +initializers +inline +inputmode +instantiation +interop +ios +javascript +JavaScript's +jquery +jquery's +js +jshint +json +jsonapi +jsonapiadapter +jsonapiserializer +jsonserializer +keycode +laravel +li +lifecycle +login +lookup +lookups +maxlength +metadata +metamorph +methodobservable +minifying +miscellaneousturn +mixin +mixins +modularity +Mozilla +mut +mysql +namespace +nav +naïve +normalizeresponse +npm +onerror +online +ons +optimizations +param +param's +params +pascalcased +performant +phantomjs +pipelining +pluralizations +polyfill +polyfills +poppopobject +popups +postgresql +pre +preload +prepend +promise's +prs +pseudocode +pushpushobject +qunit +readme +readonly +recordarrays +refactor +relayout +repo +rerender +rerendering +restadapter +reversereverseobjects +routinglog +rsvp +runloop +runloops +runtime +sandboxed +selectiondirection +semver +serializer +serializer's +serializers +shiftshiftobject +sideload +sideloaded +sideloading +spellcheck +sql +stacktraces +stateful +stylesheets +subclassing +subexpression +suboptimal +substate +substates +tabindex +teardown +templates's +templateshovering +templateslog +templating +testee +testem +textarea +textfield +tildeio +todo +todo's +tomhuda +tomster +tradeoffs +transitionto +truthiness +typeahead +ui +ul +unshiftunshiftobject +unsilence +untrusted +updatepatch +upvote +uri +url +url's +urls +usecase +verburl +versa +versioning +viewport +websocket +websockets +wildcard +workflow +xhr +xss \ No newline at end of file