terminal-labs / lektor-jinja-content

Render Lektor content fields with Jinja2.
Other
11 stars 5 forks source link

potential fix for issue #13 #14

Closed jvanasco closed 1 year ago

jvanasco commented 5 years ago

This is a potential fix for issue #13 along with a test case that does not raise an error on building the page (i'm not sure how to otherwise test)

The issue seemed to be an empty field being passed into process_field/render_as_jinja, which then triggered a jinja2.runtime.Undefined exception for the field. The package otherwise tests for a jinja2.exceptions.UndefinedError which is raised in other contexts.

I am not extremely familiar with jinja2/lektor so I am not sure if this approach will break more things than it fixes. It does not seem to though.

jvanasco commented 5 years ago

actually this doesn't work correctly yet. missing a field will not cause an error, but will disable the jinja2 rendering of the content. back to work!

nixjdm commented 1 year ago

If you get to fixing this before someone else does, please open a new PR. Thanks!