mirror of https://github.com/lammps/lammps.git
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:
parent
dd76ac5010
commit
fc9eebb936
|
@ -1,4 +1,5 @@
|
|||
/html
|
||||
/spelling
|
||||
/LAMMPS.epub
|
||||
/LAMMPS.mobi
|
||||
/Manual.pdf
|
||||
|
|
17
doc/Makefile
17
doc/Makefile
|
@ -22,7 +22,7 @@ endif
|
|||
SOURCES=$(wildcard src/*.txt)
|
||||
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:
|
||||
rm -rf $(RSTDIR) html
|
||||
rm -rf spelling
|
||||
|
||||
clean-spelling:
|
||||
rm -rf spelling
|
||||
|
||||
html: $(OBJECTS)
|
||||
@(\
|
||||
|
@ -64,6 +68,17 @@ html: $(OBJECTS)
|
|||
@rm -rf html/USER/*/*.[sg]*
|
||||
@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)
|
||||
@mkdir -p epub
|
||||
@rm -f LAMMPS.epub
|
||||
|
|
|
@ -299,4 +299,11 @@ more information about the code and its uses.
|
|||
|
||||
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'
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue