Its not a big deal to convert one template file to another. If you have
MATLAB or octave. You can simply use this
clear all;clc;close all
%'my_jinja_file.html' is my jinja template
%'my_web2py_file.html' is my web2py template
%Then copy the jinja file template to create another copy of itself and
thats your web2py template
copyfile('my_jinja_file.html','my_web2py_file.html','f');
find_and_replace('my_web2py_file.html','{%','{{'); %replacing all the {%
with {{
find_and_replace('my_web2py_file.html','{{','{{='); %replacing all the {{
to {{=
disp('you just converted from jinja to web2py')
%going the other way around
copyfile('my_web2py_file.html','my_jinja_file.html','f');
find_and_replace('my_jinja_file.html','{{','{%'); %replacing web2py {{ to
{%
find_and_replace('my_jinja_file.html','{{=','{%'); %replacing web2py {{=
to {%. Note, if you have {{ = or spaces in between, you need to have
additional lines to cover that.
NOTE: This is not the recommended way. find_and_replace.m can be
downloaded from MATHWORKS file exchange. This is MATLAB routine. If you
don't have MATLAB installed, you can run this using OCTAVE.
Good luck!:-)
On Wednesday, June 3, 2015 at 9:52:47 AM UTC-4, Anthony wrote:
>
> In general, you're better off asking Flask questions in Flask forums, as
> there is no particular relationship between Flask and web2py (other than
> that they are both Python web frameworks).
>
> Flask uses Jinja2 for templates, so I suggest you have a look at the
> relevant section of the Jinja2 documention:
> http://jinja.pocoo.org/docs/dev/templates/.
>
> In short, {% ... %} is for statements (somewhat equivalent to web2py's {{
> ... }}), and {{ ... }} is for expressions to be written into the template
> (equivalent to web2py's {{= ... }}).
>
> Anthony
>
> On Wednesday, June 3, 2015 at 7:46:35 AM UTC-4, Samuel Sowah wrote:
>>
>> I know this isn't the flask community but it's got some relationship with
>> web2py so I thought I might as well ask it here.
>>
>> In web2py, I get the usage of the braces in a "view" for writing python
>> code, that explanation is plain, simple, straightforward. I can't seem to
>> find a straight forward answer to the same situation regarding flask.
>>
>> With flask, there's
>> 1. {% and %},
>> 2. {{ and }}.
>>
>> What's the difference? I'm having trouble getting the whole idea... and
>> if there's a possible relationship in web2py for the use of both notations
>> that can help me understand, I'd be glad.
>>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.