[doc] support building with spell check

This commit is contained in:
Quantum 2021-09-01 19:14:58 -04:00 committed by Geoffrey McRae
parent 1b58f2592c
commit 753b44e34f
3 changed files with 96 additions and 0 deletions

View File

@ -36,6 +36,22 @@ rst_prolog = """
extensions = [ extensions = [
] ]
try:
from sphinxcontrib import spelling
except ImportError:
pass
else:
del spelling
extensions += ['sphinxcontrib.spelling']
import sys, os
sys.path.append(os.path.dirname(__file__))
spelling_filters = [
'lgspell.OptionFilter', 'lgspell.PackageFilter', 'lgspell.PathFilter',
'lgspell.CryptoAddressFilter'
]
spelling_word_list_filename = [os.path.join(os.path.dirname(__file__), 'words.txt')]
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
# templates_path = ['_templates'] # templates_path = ['_templates']

29
doc/lgspell.py Normal file
View File

@ -0,0 +1,29 @@
import re
from enchant.tokenize import Filter
reoption = re.compile(r'^[a-z]+:\w+$')
recamel = re.compile(r'^[a-z]+[A-Z]\w+$')
repackage = re.compile(r'^[\w-]+-(?:dev|bin)$|^fonts-[\w-]+-ttf$|^virt-manager$')
repath = re.compile(r'^/dev/')
recrypto = re.compile(r'^[13][A-Za-z0-9]{25,34}$|^0x[0-9a-fA-F]{40}$')
class OptionFilter(Filter):
def _skip(self, word):
return reoption.match(word) or recamel.match(word)
class PackageFilter(Filter):
def _skip(self, word):
return repackage.match(word)
class PathFilter(Filter):
def _skip(self, word):
return repath.match(word)
class CryptoAddressFilter(Filter):
def _skip(self, word):
return recrypto.match(word)

51
doc/words.txt Normal file
View File

@ -0,0 +1,51 @@
backtrace
borderless
cgroups
clang
cmake
config
deuteranope
distros
dmabuf
fullscreen
gcc
gnif
imgui
ini
kvmfr
laggy
libdecor
libvirt
linux
LookingGlass
mingw
mipmapping
modprobe
msys
multisampling
Nvidia
pacman
passthrough
pre
protanope
QEMU
radeon
realtime
renderer
repo
submodule
submodules
systemd
toolchain
tritanope
udev
UEFI
uncheck
uncomment
Unigine
unix
VM
vsync
wayland
xdg
xyene