foliantcontrib.replace-2.0.0
توضیحات
Replace text by dictionary.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | foliantcontrib.replace-2.0.0 |
| نام | foliantcontrib.replace |
| نسخه کتابخانه | 2.0.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Anton Bukhtiyarov |
| ایمیل نویسنده | apkraft@gmail.com |
| آدرس صفحه اصلی | https://github.com/foliant-docs/foliantcontrib.replace |
| آدرس اینترنتی | https://pypi.org/project/foliantcontrib.replace/ |
| مجوز | MIT |
# Replace text for Foliant
Preprocessor for simple search and replace in Markdown sources with support of regular expressions.
## 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 two options:
```yaml
preprocessors:
- replace:
dictionary:
Mike: Michael
Sam: Samuel
Tim: Timoel
re_dictionary:
'!\[\]\((.+?)\)': ''
```
`dictionary`
: YAML mapping where key is string to replace, value is the replacement string.
`re_dictionary`
: YAML mapping where key is [Python regular expression](https://docs.python.org/3/howto/regex.html) pattern, value is the replacement string.
## Usage
Fill up the `dictionary` or/and `re_dictionary` in preprocessor options and the keys will be replaced with values.
For example, if you wish that all images without title in your Markdown sources were titled "Figure", use the following config:
```yaml
preprocessors:
- replace:
re_dictionary:
'!\[\]\((.+?)\)': ''
```
نیازمندی
| مقدار | نام |
|---|---|
| >=1.0.8 | foliant |
| >=1.0.3 | foliantcontrib.utils |
نحوه نصب
نصب پکیج whl foliantcontrib.replace-2.0.0:
pip install foliantcontrib.replace-2.0.0.whl
نصب پکیج tar.gz foliantcontrib.replace-2.0.0:
pip install foliantcontrib.replace-2.0.0.tar.gz