michaelstepner / pandoc-mustache

Pandoc filter for variable substitution using Mustache syntax
Creative Commons Zero v1.0 Universal
55 stars 14 forks source link

Crash - pystache #13

Open savchenko opened 1 year ago

savchenko commented 1 year ago

Running with --filter pandoc-mustache:

Traceback (most recent call last):
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pystache\context.py", line 283, in get
    result = self._get_simple(parts[0])
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pystache\context.py", line 316, in _get_simple
    raise KeyNotFoundError(name, 'part missing')
pystache.context.KeyNotFoundError: Key 'var' not found: part missing

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\user\AppData\Roaming\Python\Python39\Scripts\pandoc-mustache.exe\__main__.py", line 7, in <module>
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pandoc_mustache\pandoc_mustache.py", line 36, in main
    return run_filter(action, prepare=prepare, doc=doc)
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\panflute\io.py", line 227, in run_filter
    return run_filters([action], *args, **kwargs)
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\panflute\io.py", line 208, in run_filters
    doc = doc.walk(action, doc=doc, stop_if=stop_if)
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\panflute\base.py", line 274, in walk
    child = child.walk(action, doc, stop_if)
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\panflute\containers.py", line 85, in walk
    ans = list(chain.from_iterable(ans))
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\panflute\containers.py", line 83, in <genexpr>
    ans = ((item,) if type(item) is not list else item for item in ans)
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\panflute\containers.py", line 81, in <genexpr>
    ans = (item.walk(action, doc, stop_if) for item in self)
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\panflute\base.py", line 274, in walk
    child = child.walk(action, doc, stop_if)
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\panflute\containers.py", line 85, in walk
    ans = list(chain.from_iterable(ans))
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\panflute\containers.py", line 83, in <genexpr>
    ans = ((item,) if type(item) is not list else item for item in ans)
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\panflute\containers.py", line 81, in <genexpr>
    ans = (item.walk(action, doc, stop_if) for item in self)
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\panflute\base.py", line 282, in walk
    altered = action(self, doc)
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pandoc_mustache\pandoc_mustache.py", line 32, in action
    elem.text = doc.mrenderer.render(elem.text, doc.mhash)
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pystache\renderer.py", line 468, in render
    return self._render_string(template, *context, **kwargs)
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pystache\renderer.py", line 416, in _render_string
    return self._render_final(render_func, *context, **kwargs)
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pystache\renderer.py", line 433, in _render_final
    return render_func(engine, stack)
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pystache\renderer.py", line 414, in <lambda>
    render_func = lambda engine, stack: engine.render(template, stack)  # noqa
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pystache\renderengine.py", line 185, in render
    return parsed_template.render(self, context_stack)
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pystache\parsed.py", line 48, in render
    parts = list(map(get_unicode, self._parse_tree))
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pystache\parsed.py", line 46, in get_unicode
    return node.render(engine, context)
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pystache\parser.py", line 123, in render
    s = engine.fetch_string(context, self.key)
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pystache\renderengine.py", line 109, in fetch_string
    val = self.resolve_context(context, name)
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pystache\renderengine.py", line 17, in context_get
    return stack.get(name)
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\pystache\context.py", line 285, in get
    raise KeyNotFoundError(name, 'first part')
pystache.context.KeyNotFoundError: Key 'var' not found: first part
Error running filter pandoc-mustache:
Filter returned error status 1