Replace text by dictionary.
Project description
# Replace text for Foliant
Replace preprocessor reads the dictionary (yaml format) placed in foliant project folder and changes one word to another in created document.
## Installation
```shell
$ pip install foliantcontrib.replace
```
## Config
To enable the preprocessor, add `replace` to `preprocessors` section in the project config:
```yaml
preprocessors:
- replace
```
The preprocessor has only one option:
```yaml
preprocessors:
- multilinetables:
dictionary_filename: replace_dictionary.yml
```
`dictionary_filename`
: File in foliant project folder with dictionary in it (*replace_dictionary.yml* by default).
### Dictionary format
Dictionary stores data in yaml format. It has two sections — with words and with regular expressions. For example:
```yaml
words:
cod: CoD
epg: EPG
vod: VoD
regexs:
'!\w*!': ''
```
## Usage
Just add the preprocessor to the project config, set the dictionary and enjoy the result.
Replace preprocessor reads the dictionary (yaml format) placed in foliant project folder and changes one word to another in created document.
## Installation
```shell
$ pip install foliantcontrib.replace
```
## Config
To enable the preprocessor, add `replace` to `preprocessors` section in the project config:
```yaml
preprocessors:
- replace
```
The preprocessor has only one option:
```yaml
preprocessors:
- multilinetables:
dictionary_filename: replace_dictionary.yml
```
`dictionary_filename`
: File in foliant project folder with dictionary in it (*replace_dictionary.yml* by default).
### Dictionary format
Dictionary stores data in yaml format. It has two sections — with words and with regular expressions. For example:
```yaml
words:
cod: CoD
epg: EPG
vod: VoD
regexs:
'!\w*!': ''
```
## Usage
Just add the preprocessor to the project config, set the dictionary and enjoy the result.
Project details
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.replace-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13cd4b1651d13fa71220e289e32b7d4d9ab0a19e108910243ade6ef47c6ec548 |
|
MD5 | b8669b54124fb4b11dfa723d1f196135 |
|
BLAKE2b-256 | 8c227454cf6b04fb664cd30e049b5b18143afca52aabb1db9e4f72b2bb51369c |