mirror of
https://git.rtems.org/rtems-docs/
synced 2025-05-14 23:39:47 +08:00
Add support for spellchecking with a custom dictionary.
To use: 1. Install aspell 2. waf spell <list of files> * waf spell mydoc.rst * waf spell *.rst This uses a custom dictionary stored in common/spell/dict/. We should add all RTEMS and programming terms to this to ensure we are consistent. Amar.
This commit is contained in:
parent
d389819eea
commit
f916fcaaae
@ -2,7 +2,7 @@ from sys import path
|
|||||||
from os.path import abspath, exists
|
from os.path import abspath, exists
|
||||||
path.append(abspath('../common/'))
|
path.append(abspath('../common/'))
|
||||||
|
|
||||||
from waf import cmd_configure_path, cmd_build_path, cmd_options_path
|
from waf import cmd_configure_path, cmd_build_path, cmd_options_path, spell, cmd_spell
|
||||||
|
|
||||||
|
|
||||||
def options(ctx):
|
def options(ctx):
|
||||||
|
@ -2,7 +2,7 @@ from sys import path
|
|||||||
from os.path import abspath
|
from os.path import abspath
|
||||||
path.append(abspath('../common/'))
|
path.append(abspath('../common/'))
|
||||||
|
|
||||||
from waf import cmd_configure, cmd_build
|
from waf import cmd_configure, cmd_build, spell, cmd_spell
|
||||||
|
|
||||||
def configure(ctx):
|
def configure(ctx):
|
||||||
cmd_configure(ctx)
|
cmd_configure(ctx)
|
||||||
|
@ -2,7 +2,7 @@ from sys import path
|
|||||||
from os.path import abspath
|
from os.path import abspath
|
||||||
path.append(abspath('../common/'))
|
path.append(abspath('../common/'))
|
||||||
|
|
||||||
from waf import cmd_configure, cmd_build
|
from waf import cmd_configure, cmd_build, spell, cmd_spell
|
||||||
|
|
||||||
def configure(ctx):
|
def configure(ctx):
|
||||||
cmd_configure(ctx)
|
cmd_configure(ctx)
|
||||||
|
15
common/spell/dict/rtems
Normal file
15
common/spell/dict/rtems
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
personal_ws-1.1 en 14
|
||||||
|
lseek
|
||||||
|
rtems
|
||||||
|
fstat
|
||||||
|
filesystems
|
||||||
|
filesystem
|
||||||
|
API
|
||||||
|
chown
|
||||||
|
pathname
|
||||||
|
APIs
|
||||||
|
unmount
|
||||||
|
TFTP
|
||||||
|
instantiation
|
||||||
|
IMFS
|
||||||
|
POSIX
|
BIN
common/spell/en_GB-ise-w_accents-only.rws
Normal file
BIN
common/spell/en_GB-ise-w_accents-only.rws
Normal file
Binary file not shown.
3
common/spell/en_GB-ise-w_accents.multi
Normal file
3
common/spell/en_GB-ise-w_accents.multi
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Generated with Aspell Dicts "proc" script version 0.60.4
|
||||||
|
add en-common.rws
|
||||||
|
add en_GB-ise-w_accents-only.rws
|
@ -1,9 +1,40 @@
|
|||||||
import sys, os
|
import sys, os
|
||||||
|
from waflib.Build import BuildContext
|
||||||
|
|
||||||
|
def cmd_spell(ctx):
|
||||||
|
from waflib import Options
|
||||||
|
from sys import argv
|
||||||
|
from subprocess import call
|
||||||
|
|
||||||
|
Options.commands = None # stop warnings about knowing commands.
|
||||||
|
|
||||||
|
if not ctx.env.BIN_ASPELL:
|
||||||
|
ctx.fatal("'aspell' is required please add binary to your path and re-run configure.")
|
||||||
|
|
||||||
|
if len(argv) < 3:
|
||||||
|
ctx.fatal("Please supply at least one file name")
|
||||||
|
|
||||||
|
files = argv[2:]
|
||||||
|
|
||||||
|
path = ctx.path.parent.abspath()
|
||||||
|
|
||||||
|
# XXX: add error checking eg check if file exists.
|
||||||
|
for file in files:
|
||||||
|
cmd = ctx.env.BIN_ASPELL + ["-c", "--personal=%s/common/spell/dict/rtems" % path, "--extra-dicts=%s/common/spell/en_GB-ise-w_accents.multi" % path, file]
|
||||||
|
|
||||||
|
print "running:", cmd
|
||||||
|
call(cmd)
|
||||||
|
|
||||||
|
|
||||||
|
class spell(BuildContext):
|
||||||
|
__doc__ = "Check spelling. Supply a list of files or a glob (*.rst)"
|
||||||
|
cmd = 'spell'
|
||||||
|
fun = 'cmd_spell'
|
||||||
|
|
||||||
|
|
||||||
def cmd_configure(ctx):
|
def cmd_configure(ctx):
|
||||||
ctx.find_program("sphinx-build", var="SPHINX_BUILD")
|
ctx.find_program("sphinx-build", var="BIN_SPHINX_BUILD")
|
||||||
|
ctx.find_program("aspell", var="BIN_ASPELL", mandatory=False)
|
||||||
|
|
||||||
def cmd_build(ctx, conf_dir=".", source_dir="."):
|
def cmd_build(ctx, conf_dir=".", source_dir="."):
|
||||||
srcnode = ctx.srcnode.abspath()
|
srcnode = ctx.srcnode.abspath()
|
||||||
@ -21,7 +52,7 @@ def cmd_build(ctx, conf_dir=".", source_dir="."):
|
|||||||
)
|
)
|
||||||
|
|
||||||
ctx(
|
ctx(
|
||||||
rule = "${SPHINX_BUILD} -b html -c %s -j %d -d build/doctrees %s build/html" % (conf_dir, ctx.options.jobs, source_dir),
|
rule = "${BIN_SPHINX_BUILD} -b html -c %s -j %d -d build/doctrees %s build/html" % (conf_dir, ctx.options.jobs, source_dir),
|
||||||
cwd = ctx.path.abspath(),
|
cwd = ctx.path.abspath(),
|
||||||
source = ctx.path.ant_glob('**/*.rst'),# + ctx.path.ant_glob('conf.py'),
|
source = ctx.path.ant_glob('**/*.rst'),# + ctx.path.ant_glob('conf.py'),
|
||||||
target = ctx.path.find_or_declare('html/index.html')
|
target = ctx.path.find_or_declare('html/index.html')
|
||||||
@ -66,3 +97,5 @@ def cmd_build_path(ctx):
|
|||||||
)
|
)
|
||||||
|
|
||||||
cmd_build(ctx, conf_dir="build", source_dir="build")
|
cmd_build(ctx, conf_dir="build", source_dir="build")
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ from sys import path
|
|||||||
from os.path import abspath
|
from os.path import abspath
|
||||||
path.append(abspath('../common/'))
|
path.append(abspath('../common/'))
|
||||||
|
|
||||||
from waf import cmd_configure, cmd_build
|
from waf import cmd_configure, cmd_build, spell, cmd_spell
|
||||||
|
|
||||||
def configure(ctx):
|
def configure(ctx):
|
||||||
cmd_configure(ctx)
|
cmd_configure(ctx)
|
||||||
|
@ -2,7 +2,7 @@ from sys import path
|
|||||||
from os.path import abspath
|
from os.path import abspath
|
||||||
path.append(abspath('../common/'))
|
path.append(abspath('../common/'))
|
||||||
|
|
||||||
from waf import cmd_configure, cmd_build
|
from waf import cmd_configure, cmd_build, spell, cmd_spell
|
||||||
|
|
||||||
def configure(ctx):
|
def configure(ctx):
|
||||||
cmd_configure(ctx)
|
cmd_configure(ctx)
|
||||||
|
@ -2,7 +2,7 @@ from sys import path
|
|||||||
from os.path import abspath
|
from os.path import abspath
|
||||||
path.append(abspath('../common/'))
|
path.append(abspath('../common/'))
|
||||||
|
|
||||||
from waf import cmd_configure, cmd_build
|
from waf import cmd_configure, cmd_build, spell, cmd_spell
|
||||||
|
|
||||||
def configure(ctx):
|
def configure(ctx):
|
||||||
cmd_configure(ctx)
|
cmd_configure(ctx)
|
||||||
|
@ -2,7 +2,7 @@ from sys import path
|
|||||||
from os.path import abspath
|
from os.path import abspath
|
||||||
path.append(abspath('../common/'))
|
path.append(abspath('../common/'))
|
||||||
|
|
||||||
from waf import cmd_configure, cmd_build
|
from waf import cmd_configure, cmd_build, spell, cmd_spell
|
||||||
|
|
||||||
def configure(ctx):
|
def configure(ctx):
|
||||||
cmd_configure(ctx)
|
cmd_configure(ctx)
|
||||||
|
@ -2,7 +2,7 @@ from sys import path
|
|||||||
from os.path import abspath
|
from os.path import abspath
|
||||||
path.append(abspath('../common/'))
|
path.append(abspath('../common/'))
|
||||||
|
|
||||||
from waf import cmd_configure, cmd_build
|
from waf import cmd_configure, cmd_build, spell, cmd_spell
|
||||||
|
|
||||||
def configure(ctx):
|
def configure(ctx):
|
||||||
cmd_configure(ctx)
|
cmd_configure(ctx)
|
||||||
|
@ -2,7 +2,7 @@ from sys import path
|
|||||||
from os.path import abspath
|
from os.path import abspath
|
||||||
path.append(abspath('../common/'))
|
path.append(abspath('../common/'))
|
||||||
|
|
||||||
from waf import cmd_configure, cmd_build
|
from waf import cmd_configure, cmd_build, spell, cmd_spell
|
||||||
|
|
||||||
def configure(ctx):
|
def configure(ctx):
|
||||||
cmd_configure(ctx)
|
cmd_configure(ctx)
|
||||||
|
@ -2,7 +2,7 @@ from sys import path
|
|||||||
from os.path import abspath
|
from os.path import abspath
|
||||||
path.append(abspath('../common/'))
|
path.append(abspath('../common/'))
|
||||||
|
|
||||||
from waf import cmd_configure, cmd_build
|
from waf import cmd_configure, cmd_build, spell, cmd_spell
|
||||||
|
|
||||||
def configure(ctx):
|
def configure(ctx):
|
||||||
cmd_configure(ctx)
|
cmd_configure(ctx)
|
||||||
|
@ -2,7 +2,7 @@ from sys import path
|
|||||||
from os.path import abspath
|
from os.path import abspath
|
||||||
path.append(abspath('../common/'))
|
path.append(abspath('../common/'))
|
||||||
|
|
||||||
from waf import cmd_options_path, cmd_configure_path, cmd_build_path
|
from waf import cmd_options_path, cmd_configure_path, cmd_build_path, spell, cmd_spell
|
||||||
|
|
||||||
|
|
||||||
def options(ctx):
|
def options(ctx):
|
||||||
|
@ -2,7 +2,7 @@ from sys import path
|
|||||||
from os.path import abspath
|
from os.path import abspath
|
||||||
path.append(abspath('../common/'))
|
path.append(abspath('../common/'))
|
||||||
|
|
||||||
from waf import cmd_configure, cmd_build
|
from waf import cmd_configure, cmd_build, spell, cmd_spell
|
||||||
|
|
||||||
def configure(ctx):
|
def configure(ctx):
|
||||||
cmd_configure(ctx)
|
cmd_configure(ctx)
|
||||||
|
@ -2,7 +2,7 @@ from sys import path
|
|||||||
from os.path import abspath
|
from os.path import abspath
|
||||||
path.append(abspath('../common/'))
|
path.append(abspath('../common/'))
|
||||||
|
|
||||||
from waf import cmd_configure, cmd_build
|
from waf import cmd_configure, cmd_build, spell, cmd_spell
|
||||||
|
|
||||||
def configure(ctx):
|
def configure(ctx):
|
||||||
cmd_configure(ctx)
|
cmd_configure(ctx)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user