PyProcessor: Python 3 preprocessor
Introduction
PyProcessor is a Python 3 preprocessor. It accepts text as its input, executes code regions found inside that text, substitutes variables and returns an output text.
Syntax
PyProcessor runs code by default delimited by <% and %>. For example:
Hello, <% print('world!', end='') %>
Will result in Hello, world!
. You may also define variables on the command line or within code regions. These variables can be directly substituted, like in this example:
I have a variable named 'GOOFY'. GOOFY's value is @@GOOFY@@.
No error will result if you don't define GOOFY
.
Empty and space variable names will be silently ignored.
Delimiters
Default code delimiters are <% %>
and default variable delimiters are @@ @@
. You may overrirde these by command line.
Usage as a command line tool
PyProcessor can also be run from command line to directly work on files or piped data. Type python -m pyprocessor --help
for further information.
License
PyProcessor is free software and is distributed under the GNU General Public License version 3 (GPL v3).
Bugs
If you find any bugs please submit a report through the issue tracker at https://github.com/alkafir/pyprocessor/issues