You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I cannot find a function to set the locals for processing jade. I'm attaching the workaround I'm using for now below (a little test included), but I'm surprised that this does not seem to be in the API out of the box, so I'm reporting this as a missing feature.
import pyjade
from pyjade.ext.html import HTMLCompiler
def process_jade(src, data={}):
parser = pyjade.parser.Parser(src)
block = parser.parse()
compiler = HTMLCompiler(block, pretty=True)
compiler.global_context.update(data)
return compiler.compile()
print(process_jade("""
!!! 5
html
body
ul
each val in my_list
li= val
""", dict(my_list=[1, 2, 3])))
Thanks!
The text was updated successfully, but these errors were encountered:
I cannot find a function to set the locals for processing jade. I'm attaching the workaround I'm using for now below (a little test included), but I'm surprised that this does not seem to be in the API out of the box, so I'm reporting this as a missing feature.
Thanks!
The text was updated successfully, but these errors were encountered: