Re: [Cppcms-users] razor like syntax for templates
Brought to you by:
artyom-beilis
|
From: Artyom B. <art...@ya...> - 2013-05-19 13:50:07
|
>________________________________
> From: Lee Elenbaas <lee...@gm...>
>To: Artyom Beilis <art...@ya...>; cpp...@li...
>Sent: Thursday, May 16, 2013 5:17 PM
>Subject: Re: [Cppcms-users] razor like syntax for templates
>
>
>
>I looked into enhancing the <%= %> syntax a bit - and it is a bit tricky since - especially if you think razor like:
>
>
>with razor you expect things like this to work:
>
>
>@for (int i;....){
>
>
><li>@i. some content...
>}
>
I don't think that converting all of it to razor would be simple and I'm not sure how really it is needed.
In general some improvements in template system are needed - like ws suppression and more
Artyom Beilis
--------------
CppCMS - C++ Web Framework: http://cppcms.com/
CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/
>
>the problem is that the current syntax only deals with data that comes from the model - (by prefixing it in the generated cpp) or variables declared using blocks like the <%foreach...%> block
>
>
>i toyed around with the idea of performing a 'pascal like' with that will allow the compiler to find the correct variable using the folowing search order: local to template, then model, then template - but that forces a few limitations: on template namings in order to support calling from one template to another - so this turned into an issue. - but moving to a razor like syntax can come with the restriction of only using one template in a file - and use the @Render (and its siblings) to handle calls between files
>
>
>if i can be of assistance - please let me know.
>
>
>PS: Artyom what happened to the changes i made to cppcms_tmpl_cc? that allowed for separate template compilation and use of header files? I noticed that it got dropped somewhere in the versions - and i hadn't had the time to resend it to you with updates.
>
>
>
>
>
>On Thu, May 16, 2013 at 4:29 PM, Artyom Beilis <art...@ya...> wrote:
>
>Actually it is interesting idea, so you can put @before variable that would be equivalent to <%= before %>
>>
>>
>>Several things:
>>
>>
>>1. Escaping - should be done with @@ I think
>>2. Do you want to extend it beyond variables? Like the full Razor does?
>>
>>
>>The best would be:
>>
>>
>>1. Add an option to cppcms_tmp_cc to handle such a syntax
>>2. Make sure that by default it is off such that existing code that has stuff like "@user" as text would not be broken.
>>
>>
>>Other than that such a patch for cppcms_tmpl_cc would be welcome.
>>
>>Artyom Beilis
>>--------------
>>CppCMS - C++ Web Framework: http://cppcms.com/
>>CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/
>>
>>
>>
>>>________________________________
>>> From: Marcel Hellwig <ke...@co...>
>>>To: cpp...@li...
>>>Sent: Tuesday, May 14, 2013 2:21 PM
>>>Subject: [Cppcms-users] razor like syntax for templates
>>>
>>>
>>>Hi *,
>>>
>>>the current template
"language" is inspired by asp.net.
>>>The syntax with <% ... %> is equal to the one asp.net uses.
>>>My Idea is to use a different syntax, namely the successor razor where
>>>you can replace all the <% with a simple @. For a simple review see [0]
>>>Now my question is, are you willing to use this, or do you like to have
>>>this feature.
>>>i would try to implement this. For now it's a simple python script that
>>>will convert the template to a cpp file, so it should not be that hard.
>>>
>>>Regards
>>>Marcel Hellwig
>>>
>>>
>>>[0] http://weblogs.asp.net/scottgu/archive/2010/07/02/introducing-razor.aspx
>>>
>>>
>>>------------------------------------------------------------------------------
>>>AlienVault Unified Security Management (USM) platform delivers complete
>>>security visibility with the essential security capabilities. Easily
and
>>>efficiently configure, manage, and operate all of your security controls
>>>from a single console and one unified framework. Download a free trial.
>>>http://p.sf.net/sfu/alienvault_d2d
>>>_______________________________________________
>>>Cppcms-users mailing list
>>>Cpp...@li...
>>>https://lists.sourceforge.net/lists/listinfo/cppcms-users
>>>
>>>
>>>
>>------------------------------------------------------------------------------
>>AlienVault Unified Security Management (USM) platform delivers complete
>>security visibility with the essential security capabilities. Easily and
>>efficiently configure, manage, and operate all of your security controls
>>from a single console and one unified framework. Download a free trial.
>>http://p.sf.net/sfu/alienvault_d2d
>>_______________________________________________
>>Cppcms-users mailing list
>>Cpp...@li...
>>https://lists.sourceforge.net/lists/listinfo/cppcms-users
>>
>>
>
>
>
>--
>--
>lee
>Lee Elenbaas
>lee...@gm...
>
>
>
|