[doc] Version no longer gets spellchecked

This commit is contained in:
Jonathan Rubenstein 2021-12-26 07:00:49 +02:00 committed by Geoffrey McRae
parent 02ec25b008
commit 6ef3fea05e
3 changed files with 36 additions and 20 deletions

View File

@ -4,8 +4,13 @@
# list see the documentation: # list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html # https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup -------------------------------------------------------------- # -- Release import
from pathlib import Path
import sys, os
sys.path.append(os.path.dirname(__file__))
from lgrelease import release
# If extensions (or modules to document with autodoc) are in another directory, # If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the # add these directories to sys.path here. If the directory is relative to the
@ -22,30 +27,17 @@ project = 'Looking Glass'
copyright = '2021, Looking Glass team' copyright = '2021, Looking Glass team'
author = 'Geoffrey McRae and the Looking Glass team' author = 'Geoffrey McRae and the Looking Glass team'
# The full version, including alpha/beta/rc tags
try:
with open(Path(__file__).parent.parent / 'VERSION') as f:
release = f.read().strip()
except IOError:
import subprocess
try:
release = subprocess.check_output([
'git', 'describe', '--always', '--abbrev=10', '--dirty=+', '--tags'
]).decode('utf-8').strip()
except (subprocess.CalledProcessError, OSError):
release = '(unknown version)'
del subprocess
rst_prolog = """ rst_prolog = """
.. |license| replace:: GPLv2 .. |license| replace:: GPLv2
""" """
# -- General configuration --------------------------------------------------- # -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be # Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones. # ones.
extensions = [ extensions = [
'sphinx_rtd_theme', 'sphinx_rtd_theme',
] ]
@ -58,11 +50,9 @@ else:
del spelling del spelling
extensions += ['sphinxcontrib.spelling'] extensions += ['sphinxcontrib.spelling']
import sys, os
sys.path.append(os.path.dirname(__file__))
spelling_filters = [ spelling_filters = [
'lgspell.OptionFilter', 'lgspell.PackageFilter', 'lgspell.PathFilter', 'lgspell.OptionFilter', 'lgspell.PackageFilter', 'lgspell.PathFilter',
'lgspell.CryptoAddressFilter' 'lgspell.CryptoAddressFilter', 'lgspell.VersionFilter'
] ]
spelling_word_list_filename = [os.path.join(os.path.dirname(__file__), 'words.txt')] spelling_word_list_filename = [os.path.join(os.path.dirname(__file__), 'words.txt')]

17
doc/lgrelease.py Normal file
View File

@ -0,0 +1,17 @@
# -- Path setup --------------------------------------------------------------
from pathlib import Path
release = None
try:
with open(Path(__file__).parent.parent / 'VERSION') as f:
release = f.read().strip()
except IOError:
import subprocess
try:
release = subprocess.check_output([
'git', 'describe', '--always', '--abbrev=10', '--dirty=+', '--tags'
]).decode('utf-8').strip()
except (subprocess.CalledProcessError, OSError):
release = '(unknown version)'
del subprocess

View File

@ -1,5 +1,9 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import re import re
import sys, os
sys.path.append(os.path.dirname(__file__))
from lgrelease import release
from enchant.tokenize import Filter from enchant.tokenize import Filter
@ -36,6 +40,11 @@ class CryptoAddressFilter(Filter):
return recrypto.match(word) return recrypto.match(word)
class VersionFilter(Filter):
def _skip(self, word):
return word == release
if __name__ == '__main__': if __name__ == '__main__':
import os import os
import sys import sys