Hello sir,

On Saturday, March 17, 2018 at 2:07:03 PM UTC+5:30, Dmitriy Sintsov wrote:
>
> Hi!
>
> Template languages are my favorite topic in programming.
>
> If you implement html library yourself, it is much better to define tags 
> not as functions but as classes with base Tag class which has properties 
> for tag name, attributes and the nested list of tags. Such way you will 
> re-implement DOM, although it is already available in lxml library.
>
> So maybe it's a better idea to figure out whether lxml can be used as 
> template engine for Django, because it can load source html into nested 
> structures via binary optimized code. It should be cleaner and faster than 
> manual composition of html in Python code.
>
> In such case bindings could be performed via data-bind attribute like in 
> Knockout,js or via Vue-like v-bind attribute:
>
> http://knockoutjs.com/documentation/observables.html
> https://vuejs.org/v2/guide/syntax.html#Attributes
>
> Binding server-side data via html5 data attributes is the most 
> non-obtrusive approach, and it does not create syntax clashes with 
> server-side templates like DTL or Jinja which use double braces, 
> semantically alien to XML / HTML (however Jinja is much more than html 
> templating, it's an arbitrary text templating engine and an almost complete 
> language itself).
>
> But the most interesting thing in such approach are custom tags, including 
> nested custom tags - so-called "components".
>
> It was implemented ages ago in XSLT, where one may define small template 
> with xml tags which then are transformed into larger, more verbose html:
> https://www.w3schools.com/xml/xsl_transformation.asp
>
> It is also supported in lxml:
> http://lxml.de/xpathxslt.html
>
> But XSL / XSLT did not gain wide adaption because the language syntax is 
> made via XML tags and attributes thus became very verbose and difficult to 
> read.
>
> Maybe you could create template language like XSLT but with Python syntax? 
> How's about such idea?
>
> For example, Python XSLT-like well-readable transformation code could be 
> dynamically converted to XSL style sheet then the XSL style sheet applied 
> to source template to produce the final html.
> https://www.w3schools.com/xml/xsl_transformation.asp
>
>     <xsl:for-each select="catalog/cd">
>     <tr>
>       <td><xsl:value-of select="title"/></td>
>       <td><xsl:value-of select="artist"/></td>
>     </tr>
>
> Instead xsl:for-each there will be Python's for, shorter and cleaner 
> version, translated to xsl:for-each via AST parser.
>
> Dmitriy
>


I can't tell you how happy I'm to read your mail. This was the type of 
feedback I was craving for.
The prototype I have created uses functions, for now, that's because I just 
thought of giving a basic idea of what my library will contain.
Yes, I'll use concepts of class to write tags and not functions as a whole.
And that's why I feel an obvious need of a good mentor who can provide his 
or her insight on things I'll do during my GSoC project.

I intend to create a templating language with python syntax. Can you 
suggest me how should I move forward with my application and increase my 
chances of getting selected?

Best regards,
Manasvi Saxena 

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/4e742fb4-84ab-4ae1-9aca-f6c2c79b4f24%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to