Preprocessor for Foliant to run arbitrary external commands.
Project description
# RunCommands
RunCommands is a preprocessor that allows to execute a sequence of arbitrary external commands.
## Installation
```bash
$ pip install foliantcontrib.runcommands
```
## Usage
To enable the preprocessor, add `runcommands` to `preprocessors` section in the project config, and specify the commands to run:
```yaml
preprocessors:
- runcommands:
commands:
- ./build.sh
- echo "Hello World" > ${WORKING_DIR}/hello.txt
- targets:
- pre
- tex
- pdf
- docx
```
`commands`
: Sequence of system commands to execute one after the other.
`targets`
: Allowed targets for the preprocessor. If not specified (by default), the preprocessor applies to all targets.
### Supported environment variables
You may use the following environment variables in your commands:
* `${PROJECT_DIR}` — full path to the project directory, e.g. `/usr/src/app`;
* `${SRC_DIR}` — full path to the directory that contains Markdown sources, e.g. `/usr/src/app/src`;
* `${WORKING_DIR}` — full path to the temporary directory that is used by preprocessors, e.g. `/usr/src/app/__folianttmp__`;
* `${BACKEND}` — currently used backend, e.g. `pre`, `pandoc`, or `mkdocs`;
* `${TARGET}` — current target, e.g. `site`, or `pdf`.
RunCommands is a preprocessor that allows to execute a sequence of arbitrary external commands.
## Installation
```bash
$ pip install foliantcontrib.runcommands
```
## Usage
To enable the preprocessor, add `runcommands` to `preprocessors` section in the project config, and specify the commands to run:
```yaml
preprocessors:
- runcommands:
commands:
- ./build.sh
- echo "Hello World" > ${WORKING_DIR}/hello.txt
- targets:
- pre
- tex
- docx
```
`commands`
: Sequence of system commands to execute one after the other.
`targets`
: Allowed targets for the preprocessor. If not specified (by default), the preprocessor applies to all targets.
### Supported environment variables
You may use the following environment variables in your commands:
* `${PROJECT_DIR}` — full path to the project directory, e.g. `/usr/src/app`;
* `${SRC_DIR}` — full path to the directory that contains Markdown sources, e.g. `/usr/src/app/src`;
* `${WORKING_DIR}` — full path to the temporary directory that is used by preprocessors, e.g. `/usr/src/app/__folianttmp__`;
* `${BACKEND}` — currently used backend, e.g. `pre`, `pandoc`, or `mkdocs`;
* `${TARGET}` — current target, e.g. `site`, or `pdf`.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for foliantcontrib.runcommands-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8089268f0287c22a32150903810a1ab624ddc853ca23573780f0b9d1494fe237 |
|
MD5 | de71372d0dc6a59d61af612338ff5124 |
|
BLAKE2b-256 | ac8ec453b67d9498deed88609ef7ee7a54d6ae140a1813a75f43d12e8f24b476 |