I am designing an app using jinja2 based off an older app, but this
version, I want to allow developers to select with templates they will use
in their tabs
example:
#assuming there is a model that records all the templates selected from the
templates folder
for temp in models.temps:
navitab = env.get_template(temp.url)
with open(os.path.join(OUTPUT_DIR, temp.url''), 'w') as html:
html.write(navitab.render())
instead of:
# resume = env.get_template('resume.html')
# portfolio = env.get_template('portfolio.html')
# about = env.get_template('about.html')
# labs = env.get_template('labs.html')
# media = env.get_template('media.html')
# with open(os.path.join(OUTPUT_DIR, 'resume.html'), 'w') as html:
# html.write(resume.render())
# with open(os.path.join(OUTPUT_DIR, 'portfolio.html'), 'w') as html:
# html.write(portfolio.render())
# with open(os.path.join(OUTPUT_DIR, 'about.html'), 'w') as html:
# html.write(about.render())
# with open(os.path.join(OUTPUT_DIR, 'lab.html'), 'w') as html:
# html.write(labs.render())
# with open(os.path.join(OUTPUT_DIR, 'media.html'), 'w') as html:
# html.write(media.render())
The purpose is the allow the developer to create a slugs text
in the form:
template_to_use | name_of_tab
example of slugs:
resume.html|resume
portfolio.html|portfolio
about.html|about
labs.html|labs
media.html|media
this will create tabs in the navigation menu based off of the developers
needs,
which could be tabs that use same design
like a fansite blog with tabs of different products:
fansite.html | spongebobfansite
fansite.html | southparkfansite
fansite.html | githubfansite
fansite.html | disneychannelfansite
...
I dont know if jinja 2 already can do what I am trying to do, I just do not
understand the syntax enough.
--
You received this message because you are subscribed to the Google Groups
"pocoo-libs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pocoo-libs.
For more options, visit https://groups.google.com/groups/opt_out.