It's just a file, so read it in, do whatever you want with it, and then
call response.render() with the results. A simpler approach is to see if
you can use alternative delimiters with your JS library. If the library
doesn't allow that, you can use alternative delimiters in the original
code, render the view with response.render(), and then replace all the
alternative JS delimiters in that output before returning it to the browser.
Anthony
On Friday, February 8, 2019 at 8:10:09 AM UTC-5, Alfonso Serra wrote:
>
>
> Hi.
>
> The question would be if theres any way to run a function taking a
> composed unprocessed view as argument to return a modified one, before its
> executed and rendered.
>
> The problem im trying to solve is because handlebars, jquery or knockout
> js are using the same delimiters as web2py.
>
> Im aware of response.deilimiter = ("<?", "?>") but would like to preserve
> web2py defaults that im used to.
>
> Example:
> A jquery template looks like:
> <script id="jquery_tagsTempl" type="text/html">
> <ul>
> \{{each tags}}
> <li class="tag">
> <span></span>
> <div>
> <a class="tag-edit" href="#">Edit</a>
> <a class="tag-delete" href="#">Delete</a>
> </div>
> </li>
> \{{/each}}
> </ul>
> </script>
>
> by providing the view to a custom prepocessor i could replace
> automatically the js brackets starting by "\{{" for the python counterpart
> like:
> {{=XML("{{")}}each tags{{=XML("}}")}}
> <li class="tag">
> ...
> {{=XML("{{")}}each{{=XML("}}")}}
> Im my opinion, this would be a useful feature for the already wonderful
> web2py templating engine.
>
> So yes, is there currently a way to achieve this?
>
> Thank you very much.
> King Regards.
>
--
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.