subtheme-dev / monokai-pro

The unofficial Monokai Pro theme by Subtheme.
https://subtheme.dev/monokai-pro
MIT License
135 stars 28 forks source link

Jinja2 exception when building from source #28

Closed omkarkarande closed 2 years ago

omkarkarande commented 3 years ago

Describe the bug When building the theme from source (running sublate from the theme/jetbrains folder) results in an exception.

~/Workspaces/Personal/monokai-pro/theme/jetbrains master*
❯ sublate
Building: .
Building: ./screenshots
Building: ./resources
Building: ./resources/schemes
Traceback (most recent call last):
  File "/usr/local/bin/sublate", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/sublate.py", line 28, in main
    build(args.path, args.output, args.render, args.remove, data)
  File "/usr/local/lib/python3.9/site-packages/sublate.py", line 42, in build
    _build(path, output_path, data, render, remove, path)
  File "/usr/local/lib/python3.9/site-packages/sublate.py", line 116, in _build
    _build(full_path, full_output_path, data, local_render, remove, root_path)
  File "/usr/local/lib/python3.9/site-packages/sublate.py", line 116, in _build
    _build(full_path, full_output_path, data, local_render, remove, root_path)
  File "/usr/local/lib/python3.9/site-packages/sublate.py", line 131, in _build
    output = template.render(**data).strip()
  File "/usr/local/lib/python3.9/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.9/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/usr/local/lib/python3.9/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "./resources/schemes/default-no-italics.xml", line 4, in top-level template code
    {% include "templates/scheme.xml" %}
  File "./templates/scheme.xml", line 2, in top-level template code
    <scheme name="{{theme.name}}{% if not italics %} - No Italics{% endif %}" version="142" parent_scheme="Darcula">
  File "/usr/local/lib/python3.9/site-packages/jinja2/environment.py", line 471, in getattr
    return getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'default' is undefined

To Reproduce Steps to reproduce the behavior:

  1. Clone this repository
  2. cd into theme/jetbrains
  3. run sublate
omkarkarande commented 2 years ago

Running sublate from project root results in recursive calls where it tries to create an output folder multiple times within each of the created output folders.

E.g.

Building: ./output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output
Building: ./output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output
Building: ./output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output
omkarkarande commented 2 years ago

Created a PR to address this - #30

espositocode commented 2 years ago

Cherry picked your fix into master. Thanks.