Added spellcheck utility to documentation build
Uses the sphinxcontrib-spelling extension and requires PyEnchant and aspell-en to be installed. Adds the optional make target 'spelling' which produces the file spelling/output.txt. It contains all words it detects. Due to the large number of false positives, words in utils/sphinx-config/false_positives.txt are ignored.
This commit is contained in:
1
doc/.gitignore
vendored
1
doc/.gitignore
vendored
@ -1,4 +1,5 @@
|
|||||||
/html
|
/html
|
||||||
|
/spelling
|
||||||
/LAMMPS.epub
|
/LAMMPS.epub
|
||||||
/LAMMPS.mobi
|
/LAMMPS.mobi
|
||||||
/Manual.pdf
|
/Manual.pdf
|
||||||
|
|||||||
17
doc/Makefile
17
doc/Makefile
@ -22,7 +22,7 @@ endif
|
|||||||
SOURCES=$(wildcard src/*.txt)
|
SOURCES=$(wildcard src/*.txt)
|
||||||
OBJECTS=$(SOURCES:src/%.txt=$(RSTDIR)/%.rst)
|
OBJECTS=$(SOURCES:src/%.txt=$(RSTDIR)/%.rst)
|
||||||
|
|
||||||
.PHONY: help clean-all clean epub html pdf old venv
|
.PHONY: help clean-all clean epub html pdf old venv spelling
|
||||||
|
|
||||||
# ------------------------------------------
|
# ------------------------------------------
|
||||||
|
|
||||||
@ -44,6 +44,10 @@ clean-all:
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(RSTDIR) html
|
rm -rf $(RSTDIR) html
|
||||||
|
rm -rf spelling
|
||||||
|
|
||||||
|
clean-spelling:
|
||||||
|
rm -rf spelling
|
||||||
|
|
||||||
html: $(OBJECTS)
|
html: $(OBJECTS)
|
||||||
@(\
|
@(\
|
||||||
@ -64,6 +68,17 @@ html: $(OBJECTS)
|
|||||||
@rm -rf html/USER/*/*.[sg]*
|
@rm -rf html/USER/*/*.[sg]*
|
||||||
@echo "Build finished. The HTML pages are in doc/html."
|
@echo "Build finished. The HTML pages are in doc/html."
|
||||||
|
|
||||||
|
spelling: $(OBJECTS) utils/sphinx-config/false_positives.txt
|
||||||
|
@(\
|
||||||
|
. $(VENV)/bin/activate ;\
|
||||||
|
pip install sphinxcontrib-spelling ;\
|
||||||
|
cp -r src/* $(RSTDIR)/ ;\
|
||||||
|
cp utils/sphinx-config/false_positives.txt $(RSTDIR)/ ;\
|
||||||
|
sphinx-build -b spelling -c utils/sphinx-config -d $(BUILDDIR)/doctrees $(RSTDIR) spelling ;\
|
||||||
|
deactivate ;\
|
||||||
|
)
|
||||||
|
@echo "Spell check finished."
|
||||||
|
|
||||||
epub: $(OBJECTS)
|
epub: $(OBJECTS)
|
||||||
@mkdir -p epub
|
@mkdir -p epub
|
||||||
@rm -f LAMMPS.epub
|
@rm -f LAMMPS.epub
|
||||||
|
|||||||
@ -299,4 +299,11 @@ more information about the code and its uses.
|
|||||||
|
|
||||||
epub_author = 'The LAMMPS Developers'
|
epub_author = 'The LAMMPS Developers'
|
||||||
|
|
||||||
|
# configure spelling extension if present
|
||||||
|
import importlib.util
|
||||||
|
spelling_spec = importlib.util.find_spec("sphinxcontrib.spelling")
|
||||||
|
if spelling_spec:
|
||||||
|
extensions.append('sphinxcontrib.spelling')
|
||||||
|
|
||||||
|
spelling_lang='en_US'
|
||||||
|
spelling_word_list_filename='false_positives.txt'
|
||||||
|
|||||||
2183
doc/utils/sphinx-config/false_positives.txt
Normal file
2183
doc/utils/sphinx-config/false_positives.txt
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user