9 | 9 |
Basic Usage
|
10 | 10 |
-----------
|
11 | 11 |
|
12 | |
The main tool is `lexeduct.js`. You can run it from the `src` directory.
|
|
12 |
The main tool is `lexeduct.js`. You can `cd` into the `src` directory and run
|
|
13 |
it as `./lexeduct.js`, or you can put the `src` directory on your executable
|
|
14 |
search path (e.g. `export PATH=$PATH:/path/to/lexeduct/src`) and run it as
|
|
15 |
`lexeduct.js` from anywhere on your system. (YMMV on Windows.)
|
|
16 |
|
13 | 17 |
The basic usage is
|
14 | 18 |
|
15 | |
./lexeduct.js {filter}
|
|
19 |
lexeduct.js {filter}
|
16 | 20 |
|
17 | |
So, for example, go into the `src` directory and run
|
|
21 |
So, for example,
|
18 | 22 |
|
19 | |
./lexeduct.js upper <../README.md
|
|
23 |
lexeduct.js upper <input.txt
|
20 | 24 |
|
21 | |
and an uppercased version of this document will be dumped to standard output.
|
|
25 |
and an uppercased version of the contents of `input.txt` will be dumped to
|
|
26 |
the standard output.
|
22 | 27 |
|
23 | 28 |
You can of course use shell pipelines to compose filters:
|
24 | 29 |
|
25 | |
./lexeduct.js upper <../README.md | ./lexeduct.js double-space
|
|
30 |
cat input.txt | lexeduct.js upper | lexeduct.js double-space
|
26 | 31 |
|
27 | |
Or you can name multiple filters on `lexeduct.js`'s command line to compose
|
|
32 |
*Or* you can name multiple filters on `lexeduct.js`'s command line to compose
|
28 | 33 |
them:
|
29 | 34 |
|
30 | |
./lexeduct.js upper double-space <../README.md
|
|
35 |
lexeduct.js upper double-space <input.txt
|
31 | 36 |
|
32 | 37 |
Filters
|
33 | 38 |
-------
|
34 | 39 |
|
35 | 40 |
The idea is that this repository will eventually contain a giant catalogue
|
36 | |
of possible text filters that can be composed. Or at least, more than three.
|
|
41 |
of possible text filters that can be composed. Or at least, more than four.
|
37 | 42 |
|
38 | 43 |
Each filter is in a seperate Javascript file in the `src/filter` directory
|
39 | 44 |
which exports, node-style, a single function called `filter` which takes
|
|
49 | 54 |
`state` is an object whose members may be read or written to store ancillary
|
50 | 55 |
state. (Doing so will make it an 'impure' pipeline.)
|
51 | 56 |
|
|
57 |
**NOTE**: this interface is likely to change real soon now, to support passing
|
|
58 |
parameters to filters.
|
|
59 |
|
52 | 60 |
TODO
|
53 | 61 |
----
|
54 | 62 |
|
55 | |
* Add a shell script wrapper which allows `lexeduct.js` to be run from
|
56 | |
any directory, via your executable search path.
|
57 | 63 |
* Allow filters to take parameters, possibly.
|
58 | 64 |
* Allow filters to do something at the very end, maybe.
|
59 | 65 |
* Many, many other things.
|