mdx_variables
=============
|variables-ci-badge|
.. |variables-ci-badge| image:: https://travis-ci.org/CTPUG/mdx_variables.png?branch=master
:alt: Travis CI build status
:scale: 100%
:target: https://travis-ci.org/CTPUG/mdx_variables
A Markdown extension to add support for variables.
Licensed under the `ISC License`_.
.. _ISC License: https://github.com/CTPUG/mdx_variables/blob/master/LICENSE
Requirements
============
The mdx_variables plugin requires only the base `markdown`_ library.
.. _markdown: http://pythonhosted.org/Markdown/
Installation
============
Install with ``pip install mdx_variables``.
Documentation
=============
Allows inserting variables into Markdown.
The following Markdown example:
.. code:: markdown
This paragraph contains ${chickens} chickens.
This paragraph contains no chickens but ${foxes} foxes.
Are there ninjas here? ${ninjas}.
Might result in:
.. code:: markdown
This paragraph contains 5 chickens.
This paragraph contains no chickens but 3 foxes.
Are there ninjas here? ninjas not found.
Python usage:
.. code:: python
md = markdown.Markdown(
extensions=[
'variables',
],
extension_configs={
'variables': {
'vars': {
'chickens': '5',
'foxes': (lambda: 3),
'__getattr__': (lambda name: "{} not found".format(name)),
},
}
})
Configuration options:
* ``vars``: A dictionary mapping variable names to variable values.
If a value is a function, that function will be called without arguments and
the result will be used as the variable value.
The special variable ``__getattr__`` may specify a function
``f(name) -> value`` to call when no matching variable is found.
=============
|variables-ci-badge|
.. |variables-ci-badge| image:: https://travis-ci.org/CTPUG/mdx_variables.png?branch=master
:alt: Travis CI build status
:scale: 100%
:target: https://travis-ci.org/CTPUG/mdx_variables
A Markdown extension to add support for variables.
Licensed under the `ISC License`_.
.. _ISC License: https://github.com/CTPUG/mdx_variables/blob/master/LICENSE
Requirements
============
The mdx_variables plugin requires only the base `markdown`_ library.
.. _markdown: http://pythonhosted.org/Markdown/
Installation
============
Install with ``pip install mdx_variables``.
Documentation
=============
Allows inserting variables into Markdown.
The following Markdown example:
.. code:: markdown
This paragraph contains ${chickens} chickens.
This paragraph contains no chickens but ${foxes} foxes.
Are there ninjas here? ${ninjas}.
Might result in:
.. code:: markdown
This paragraph contains 5 chickens.
This paragraph contains no chickens but 3 foxes.
Are there ninjas here? ninjas not found.
Python usage:
.. code:: python
md = markdown.Markdown(
extensions=[
'variables',
],
extension_configs={
'variables': {
'vars': {
'chickens': '5',
'foxes': (lambda: 3),
'__getattr__': (lambda name: "{} not found".format(name)),
},
}
})
Configuration options:
* ``vars``: A dictionary mapping variable names to variable values.
If a value is a function, that function will be called without arguments and
the result will be used as the variable value.
The special variable ``__getattr__`` may specify a function
``f(name) -> value`` to call when no matching variable is found.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mdx-variables-0.2.tar.gz
(4.7 kB
view details)
File details
Details for the file mdx-variables-0.2.tar.gz.
File metadata
- Download URL: mdx-variables-0.2.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/2.7.15rc1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cc60b3f4a25a37994e253f57f10d1323e32a28f3eebe0ae06da2c10d8f6c56c
|
|
| MD5 |
fb0d4bf2b503f37c42bac61eafa38ba2
|
|
| BLAKE2b-256 |
bcd8e87dfdd2b83694886566bf584d8859f87e4c8b108cf6d922979713ea55cd
|