Skip to main content

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.

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

foliantcontrib.replace-1.0.1.tar.gz (2.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page