template-toolkit syntax checker

View: New views
6 Messages — Rating Filter:   Alert me  

template-toolkit syntax checker

by Éric Cholet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I don't understand how the TT file type works.
First of all, it seems to think that TT is used only for HTML files:

[% foo %]

=> Warning: missing <!DOCTYPE> declaration, etc.

Ok, let's do HTML then:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd 
">
[% FILTER collapse %]
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>foo</title>
</head>
<body>bar</body>
</html>

the [% FILTER collapse %] line has this:
=> Warning plain text isn't allowed in <head> elements
and then a bunch of other warnings which seem a consequence of this  
first one.

Removing this TT directive makes the syntax check pass.

I would expect the TT file type to ignore TT directives when syntax  
checking; and maybe some special coloring for TT directives.

--
Éric Cholet

_______________________________________________
Komodo-discuss mailing list
Komodo-discuss@...
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/Komodo-discuss

Re: template-toolkit syntax checker

by R. Hicks :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Éric Cholet wrote:

> I don't understand how the TT file type works.
> First of all, it seems to think that TT is used only for HTML files:
>
> [% foo %]
>
> => Warning: missing <!DOCTYPE> declaration, etc.
>
> Ok, let's do HTML then:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd 
> ">
> [% FILTER collapse %]
> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
> <head>
> <title>foo</title>
> </head>
> <body>bar</body>
> </html>
>
> the [% FILTER collapse %] line has this:
> => Warning plain text isn't allowed in <head> elements
> and then a bunch of other warnings which seem a consequence of this  
> first one.
>
> Removing this TT directive makes the syntax check pass.
>
> I would expect the TT file type to ignore TT directives when syntax  
> checking; and maybe some special coloring for TT directives.
>
> --
> Éric Cholet
>

Are you sure you are setting it to TT mode? It might be picking up HTML
mode because of the DOCTYPE declaration. I have my TT2 files open in
KE44 and I do not get those warnings. I have "Warnings and Errors" set
for HTML but I don't get any with TT2 files.

Robert

_______________________________________________
Komodo-discuss mailing list
Komodo-discuss@...
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/Komodo-discuss

Re: template-toolkit syntax checker

by Trent Mick :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Éric Cholet wrote:
> I don't understand how the TT file type works.
> First of all, it seems to think that TT is used only for HTML files:
>
> [% foo %]

Yes, granted. Our expectation was that the *primary* usage of templates
in the various template languages we support (TemplateToolkit, Django,
RHTML, Mason, etc.) was for HTML. Komodo needs to define a few different
language types for each template language, e.g.:
        TemplateToolkit HTML Template
        TemplateToolkit XML Template
        TemplateToolkit Text Template

You can see a start at exploring that in "langinfo_template.py" in your
Komodo installation. However, that code isn't be used for Komodo
document language type yet.

> Ok, let's do HTML then:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd 
> ">
> [% FILTER collapse %]
> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
> <head>
> <title>foo</title>
> </head>
> <body>bar</body>
> </html>
>
> the [% FILTER collapse %] line has this:
> => Warning plain text isn't allowed in <head> elements
> and then a bunch of other warnings which seem a consequence of this  
> first one.
>
> Removing this TT directive makes the syntax check pass.

This is because Komodo is using HTML Tidy to syntax check your
TemplateToolkit file. While an HTML template is *close* to HTML, it
isn't strictly valid HTML -- hence the warnings.

Cheers,
Trent

--
Trent Mick
trentm at activestate.com
_______________________________________________
Komodo-discuss mailing list
Komodo-discuss@...
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/Komodo-discuss

Re: template-toolkit syntax checker

by Éric Cholet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Le 11 juil. 08 à 15:04, Trent Mick a écrit :

>> Ok, let's do HTML then:
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd 
>>  ">
>> [% FILTER collapse %]
>> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
>> <head>
>> <title>foo</title>
>> </head>
>> <body>bar</body>
>> </html>
>> the [% FILTER collapse %] line has this:
>> => Warning plain text isn't allowed in <head> elements
>> and then a bunch of other warnings which seem a consequence of  
>> this  first one.
>> Removing this TT directive makes the syntax check pass.
>
> This is because Komodo is using HTML Tidy to syntax check your  
> TemplateToolkit file. While an HTML template is *close* to HTML, it  
> isn't strictly valid HTML -- hence the warnings.
>


Ok, so let me phrase my question differently: what is the difference  
between the HTML file type and the TT file type?

Thanks,
--
Éric Cholet




_______________________________________________
Komodo-discuss mailing list
Komodo-discuss@...
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/Komodo-discuss

Re: template-toolkit syntax checker

by Trent Mick :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Éric Cholet wrote:
> Ok, so let me phrase my question differently: what is the difference  
> between the HTML file type and the TT file type?

Basically: syntax coloring.
A file open as "TemplateToolkit" in Komodo supports syntax coloring of
Template Toolkit sections in the file.

There is also the foundation for providing Template Toolkit-specific
functionality in Komodo. For example, you could have Template
Toolkit-specific abbreviations
   http://docs.activestate.com/komodo/4.4/abbreviations.html#abbrev_top


Trent

--
Trent Mick
trentm at activestate.com
_______________________________________________
Komodo-discuss mailing list
Komodo-discuss@...
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/Komodo-discuss

Re: template-toolkit syntax checker

by Éric Cholet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Le 14 juil. 08 à 11:38, Trent Mick a écrit :

> Éric Cholet wrote:
>> Ok, so let me phrase my question differently: what is the  
>> difference  between the HTML file type and the TT file type?
>
> Basically: syntax coloring.
> A file open as "TemplateToolkit" in Komodo supports syntax coloring  
> of Template Toolkit sections in the file.

Thanks for your helpful replies, I solved my syntax checking problem  
by creating a custom html tidy configuration file:
show-errors: 0
show-warnings: no

so now I have the benefit of syntax coloring without the burden of  
syntax errors.

--
Éric Cholet




_______________________________________________
Komodo-discuss mailing list
Komodo-discuss@...
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/Komodo-discuss
LightInTheBox - Buy quality products at wholesale price