jinja2: rendered -> output, template -> url/inline
... | @@ -165,8 +165,17 @@ class Recipe(Recipe): | ... | @@ -165,8 +165,17 @@ class Recipe(Recipe): |
delimiter=import_delimiter) | delimiter=import_delimiter) | ||
else: | else: | ||
loader = None | loader = None | ||
self.output = options['rendered'] | try: | ||
self.template = options['template'] | self.output = options['output'] | ||
except KeyError: # BBB | |||
|
|||
self.output = options['rendered'] | |||
template = options['template'] | |||
if template.startswith('inline:'): | |||
self.template = True, template[7:].lstrip('\r\n') | |||
else: | |||
self.template = False, template | |||
else: | |||
self.template = self._template(options) | |||
extension_list = [x for x in (y.strip() | extension_list = [x for x in (y.strip() | ||
for y in options.get('extensions', '').split()) if x] | for y in options.get('extensions', '').split()) if x] | ||
self.context = context = DEFAULT_CONTEXT.copy() | self.context = context = DEFAULT_CONTEXT.copy() | ||
... | @@ -187,11 +196,10 @@ class Recipe(Recipe): | ... | @@ -187,11 +196,10 @@ class Recipe(Recipe): |
loader=loader) | loader=loader) | ||
def _render(self): | def _render(self): | ||
template = self.template | |||
env = self.env | env = self.env | ||
if template.startswith('inline:'): | inline, template = self.template | ||
source = template[7:].lstrip('\r\n') | if inline: | ||
compiled_source = env.compile(source, filename='<inline>') | compiled_source = env.compile(template, filename='<inline>') | ||
else: | else: | ||
try: | try: | ||
compiled_source = compiled_source_cache[template] | compiled_source = compiled_source_cache[template] | ||
... | ... |