Pure python html templating using with statements
11–20 of 24 posts
Re: Pure python html templating using with statements
#12My view is probably warped because I helped design the PTL "language" for Python. However, it's been my experience if you write well factored code (i.e. Don't-Repeat-Yourself, helper functions/macros), then templates that use the HTML by default mode end up looking extremely ugly. Essentially you end up with mostly Python logic with a little HTML markup mixed in. It's not friendly to UI designers who like to load it…
this way using a html mockup from a designer is like using an 3D from a 3D model artist, because you only load the data in, selecting what you want and putting a animatinon mesh / functionality into it.
tldr-part: look at my wip code → https://github.com/dodo/node-dynamictemplate/blob/a46fb6ed18...
Re: Pure python html templating using with statements
#13Re: Pure python html templating using with statements
#14Here is a simple idea: html( head( title('This is the title')), body( div(id='header', body=...))) We could also create a shortcut for div ID and classes.. for instance a keyword capitalized is an ID, or something starting with _ could be a class. It could then be possible to make "custom" fields: html( headers(), left_side(), content(), footer())
Re: Pure python html templating using with statements
#15Re: Pure python html templating using with statements
#16Re: Pure python html templating using with statements
#17Here is a simple idea: html( head( title('This is the title')), body( div(id='header', body=...))) We could also create a shortcut for div ID and classes.. for instance a keyword capitalized is an ID, or something starting with _ could be a class. It could then be possible to make "custom" fields: html( headers(), left_side(), content(), footer())
Re: Pure python html templating using with statements
#18Re: Pure python html templating using with statements
#19Here is a simple idea: html( head( title('This is the title')), body( div(id='header', body=...))) We could also create a shortcut for div ID and classes.. for instance a keyword capitalized is an ID, or something starting with _ could be a class. It could then be possible to make "custom" fields: html( headers(), left_side(), content(), footer())
I'm pretty sure this has been done. I remember seeing something extremely similar while going through several of the umpteen python web frameworks and thinking "well, it's just html with parentheses rather than angled bracket and an additional leaky abstraction on top".
E.html(
E.head(...),
E.body(...))Re: Pure python html templating using with statements
#20My view is probably warped because I helped design the PTL "language" for Python. However, it's been my experience if you write well factored code (i.e. Don't-Repeat-Yourself, helper functions/macros), then templates that use the HTML by default mode end up looking extremely ugly. Essentially you end up with mostly Python logic with a little HTML markup mixed in. It's not friendly to UI designers who like to load it…