Changeset f916fca in rtems-docs for common


Ignore:
Timestamp:
Jan 18, 2016, 10:53:44 PM (5 years ago)
Author:
Amar Takhar <amar@…>
Branches:
4.11, 5, am, master
Children:
4f81ff1
Parents:
d389819
git-author:
Amar Takhar <amar@…> (01/18/16 22:53:44)
git-committer:
Amar Takhar <verm@…> (05/03/16 00:51:24)
Message:

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.

Location:
common
Files:
3 added
1 edited

Legend:

Unmodified
Added
Removed
  • common/waf.py

    rd389819 rf916fca  
    11import sys, os
     2from waflib.Build import BuildContext
    23
     4def cmd_spell(ctx):
     5        from waflib import Options
     6        from sys import argv
     7        from subprocess import call
     8
     9        Options.commands = None # stop warnings about knowing commands.
     10
     11        if not ctx.env.BIN_ASPELL:
     12                ctx.fatal("'aspell' is required please add binary to your path and re-run configure.")
     13
     14        if len(argv) < 3:
     15                ctx.fatal("Please supply at least one file name")
     16
     17        files = argv[2:]
     18
     19        path = ctx.path.parent.abspath()
     20
     21        # XXX: add error checking eg check if file exists.
     22        for file in files:
     23                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]
     24
     25                print "running:", cmd
     26                call(cmd)
     27
     28
     29class spell(BuildContext):
     30        __doc__ = "Check spelling.  Supply a list of files or a glob (*.rst)"
     31        cmd = 'spell'
     32        fun = 'cmd_spell'
    333
    434
    535def cmd_configure(ctx):
    6         ctx.find_program("sphinx-build", var="SPHINX_BUILD")
     36        ctx.find_program("sphinx-build", var="BIN_SPHINX_BUILD")
     37        ctx.find_program("aspell", var="BIN_ASPELL", mandatory=False)
    738
    839def cmd_build(ctx, conf_dir=".", source_dir="."):
     
    2253
    2354        ctx(
    24                 rule   = "${SPHINX_BUILD} -b html -c %s -j %d -d build/doctrees %s build/html" % (conf_dir, ctx.options.jobs, source_dir),
     55                rule   = "${BIN_SPHINX_BUILD} -b html -c %s -j %d -d build/doctrees %s build/html" % (conf_dir, ctx.options.jobs, source_dir),
    2556                cwd     = ctx.path.abspath(),
    2657                source =  ctx.path.ant_glob('**/*.rst'),# + ctx.path.ant_glob('conf.py'),
     
    6798
    6899        cmd_build(ctx, conf_dir="build", source_dir="build")
     100
     101
Note: See TracChangeset for help on using the changeset viewer.