Giter Site home page Giter Site logo

jinja-atoms's People

Contributors

qur2 avatar semirook avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

storecast

jinja-atoms's Issues

Atom functions are undefined when used with jinja include tag

I have a template using {% include %} and the included template has some atoms.
On first page load, the atoms are undefined:

loaded_atom_055b68d1c94337b4abfa8c6ef6e9730a    Undefined
loaded_atom_597e00885ae82a76607f002e8a862c05    Undefined
loaded_atom_a6eb20402166d69767bdc9816f3df9fe    <function atom_args at 0x4c9fb18>

And that makes jinja2 raise an UndefinedError.

Any ideas about that?

ATOMS_NS_RE regex is slightly broken

>>> import re
>>> regex = re.compile(
...         r'\{\%\s*use\s+atoms\s*\'?(?P<tmpl>[^\s]+)\'?\s*as\s*\'?(?P<context>\w+)\'?\s*\%\}',
...     )
>>> 
>>> m = re.findall(regex, '{%use atomsblargbazasfoobar%}')
>>> m
[('blargbaz', 'foobar')]

Parsing fails when passing object attributes

Hi,

I'm integrating your awesome extension but am facing a difficulty when using something with a dot:

{% atom documents:search_result_item(result.document) %}

Doesn't work, I get a parse error:

Exception Type: TemplateSyntaxError
Exception Value: expected token ',', got '.'

So far, the only solution I get is this:

{% set doc = result.document %}
{% atom documents:search_result_item(doc) %}

Which is far from ideal.

I guess it's parse method in the extension which is not flexible enough.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.