saltstack/salt — pull request #2562 by kjkuan (2012-11-15 15:04:15+00:00)
Title: Doc updates and renderer fixes

For a template renderer to be used in the middle of a pipeline(eg, jinja | mako | yaml) , there are several ways to solve this problem:

- make a template renderer accept an option(-s) that would cause the renderer to treat its input as the template string rather than as a file path. This is the current solution.

- add another renderer(eg, call it something like 'read') that takes input as file path and return output the string content of the file read from the file path. Eg, jinja | read | mako | yaml

- make the output of a template renderer a file-like object rather than just a string.
This will work because currently all renderers that take string as inputs will assume the input to be a file-like object and read from it if it's not a string. The only concern I have with this approach is then the receiving renderer needs to close the file object or the compile_template() function that calls each renderer needs to check if the output of a renderer has a callable close attribute and then call it if it has. Though, with this approach, we can just write jinja | mako | yaml without needing to specify an option.