aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2015-02-07 14:28:42 -0500
committerWaylan Limberg <waylan.limberg@icloud.com>2015-02-07 14:28:42 -0500
commit32df5ad916626b0ddd6f0d980f350c6485f23867 (patch)
tree0f5539243138abd0a77bda9a234885c45836ad04
parent93dad08ca9967d75e5bb2b2e6e6301a98b900bfd (diff)
downloadmarkdown-32df5ad916626b0ddd6f0d980f350c6485f23867.tar.gz
markdown-32df5ad916626b0ddd6f0d980f350c6485f23867.tar.bz2
markdown-32df5ad916626b0ddd6f0d980f350c6485f23867.zip
Add Docs spellchecking Test.
Not sure this is the best way to go, but it works. I'm not crazy about running the spellcheck against the built docs, but aspell has a builtin option to easily ignore everything in `<code>` tags which greatly simplfies things. I looked at Doug Hellmans' sphinxcontrib-spelling package which does something similar for Sphinx. However, as Sphinx uses rST and the rST parser outputs a parse tree, Doug is essentially taking that parse tree and running the spellcheck on the appropriate parts (skipping code, etc.). He did a nice [writeup][5] of his development process if you are interested. As Python-Markdown's parse tree is represented as HTML (through ElementTree) I would have to use HTML anyway. And [PyEnchant][2] doesn't currently have good support for HTML. So I used [aspell][3], with inspiration from the [git-spell-check][4] hook. [1]: http://sphinxcontrib-spelling.readthedocs.org/en/latest/index.html [2]: https://pythonhosted.org/pyenchant/ [3]: http://aspell.net/ [4]: https://github.com/mprpic/git-spell-check [5]: http://doughellmann.com/2011/05/26/creating-a-spelling-checker-for-restructuredtext-documents.html
-rw-r--r--.spell-dict118
-rw-r--r--.travis.yml2
-rwxr-xr-xcheckspelling.sh32
-rw-r--r--tox.ini6
4 files changed, 157 insertions, 1 deletions
diff --git a/.spell-dict b/.spell-dict
new file mode 100644
index 0000000..148c7dd
--- /dev/null
+++ b/.spell-dict
@@ -0,0 +1,118 @@
+Abrahamsen
+Altmayer
+API
+Artem
+Babelmark
+backtick
+backticks
+Balogh
+BlockParser
+Blockprocessor
+Blockprocessors
+blockquote
+blockquotes
+CamelCase
+Chodarev
+CLI
+CodeHilite
+Cogumbreiro
+CSS
+Dmitry
+ElementTree
+extendMarkdown
+Fauske
+Formatter
+Fortin
+GitHub
+Gruber
+GSoC
+hacky
+HeaderId
+HTTPS
+implementers
+InlineProcessor
+Jiryu
+JSON
+Kjell
+Krech
+kwargs
+Limberg
+Magne
+MAILTO
+makeExtension
+Manfed
+markdownFromFile
+Maruku
+multi
+MultiMarkdown
+munge
+namespace
+NanoDOM
+Neale
+nosetests
+OrderedDict
+OrderedDicts
+OSX
+Ph
+PHP
+Postprocessor
+Postprocessors
+Preprocessor
+Preprocessors
+Pygments
+PyPI
+PyPy
+PYTHONPATH
+PyTidyLib
+PyYAML
+rc
+refactor
+refactored
+refactors
+registerExtension
+RSS
+rST
+ryneeverett
+sanitizer
+sanitizers
+Sauder
+schemeless
+Sergej
+serializer
+serializers
+Shachnev
+slugify
+SmartyPants
+Sourceforge
+StackOverflow
+Stansifer
+stdout
+Stelios
+Stienstra
+subclasses
+svn
+Swartz
+Szakmeister
+Takteyev
+Tiago
+tokenized
+tox
+Trac
+traceback
+Tredinnick
+Treeprocessor
+Treeprocessors
+tuples
+unordered
+untrusted
+UTF
+uTidylib
+versa
+Waylan
+WikiLink
+WikiLinks
+Wolever
+Xanthakis
+XHTML
+YAML
+Yunusov
diff --git a/.travis.yml b/.travis.yml
index 89ec558..cd0bbef 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -6,9 +6,11 @@ env:
- TOXENV=py34
- TOXENV=pypy
- TOXENV=flake8
+ - TOXENV=checkspelling
before_install:
- sudo apt-get update -qq
- sudo apt-get install libtidy-0.99-0
+ - sudo apt-get install aspell
install:
- pip install tox
- pip install coveralls
diff --git a/checkspelling.sh b/checkspelling.sh
new file mode 100755
index 0000000..4ae20cc
--- /dev/null
+++ b/checkspelling.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+echo "Building docs..."
+python setup.py --quiet build_docs --force
+echo "Compiling Dictionary..."
+aspell --lang=en create master ./tmp <.spell-dict
+echo "Checking spelling...\n"
+
+let "fails=0"
+
+for file in $(find build/docs/ -type f -name "*.html"); do
+ words=$(aspell list --lang=en --mode=html --add-html-skip=code --extra-dicts=./tmp <$file)
+ if [ "$words" ]; then
+ uniquewords=$(tr ' ' '\n' <<< "${words[@]}" | sort -u | tr '\n' ' ')
+ let "fails++"
+ echo "Misspelled words in '$file':"
+ echo "-----------------------------------------------------------------"
+ for word in ${uniquewords[@]}; do
+ echo $word
+ done
+ echo "-----------------------------------------------------------------"
+ fi
+done
+rm -f ./tmp
+rm -rf build
+
+if [ $fails -gt 0 ]; then
+ echo "$fails files with misspelled words."
+ exit 1
+else
+ exit 0
+fi
diff --git a/tox.ini b/tox.ini
index 9d62ff2..c4384a2 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = py27, py32, py33, py34, pypy, flake8
+envlist = py27, py32, py33, py34, pypy, flake8, checkspelling
[testenv]
downloadcache = {toxworkdir}/cache
@@ -11,5 +11,9 @@ commands = coverage run --source=markdown {toxinidir}/run-tests.py {posargs}
deps = flake8
commands = flake8 {toxinidir}/markdown {toxinidir}/tests {toxinidir}/setup.py {toxinidir}/run-tests.py
+[testenv:checkspelling]
+deps =
+commands = {toxinidir}/checkspelling.sh
+
[flake8]
max-line-length = 119 \ No newline at end of file