sublimetext2plonezopetemplate-talzpt

Ignore XML Namespace (TAL) in SublimeLinter


I'm using SublimeText 2 and SublimeLinter, and I develop for Zope and Plone. In the page templates (.pt) I get lots of errors for namespace problems, which I would like to either fix or have SublimeLinter ignore.

For example:

<p tal:replace="structure some_content">Content</p>

...throws the following SublimeLinter error:

Namespace error: Namespace prefix tal for replace on p is not defined

I would like to ignore (or fix!) these, since there's a lot of TAL in page templates, and showing errors for each statement isn't helpful.

So the question essentially is, how do I tell SublimeLinter to ignore Namespace Errors, or am I missing something from my page template to include the namespace?


Solution

  • If you a) use the XML syntax highlighter (View -> Syntax -> XML), and b) declare the tal, metal and i18n namespaces properly, then xmllint (the command line tool used by SublimeLinter for this task) will be perfectly happy with TAL templates.

    For example, using an HTML body tag:

    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
          xmlns:tal="http://xml.zope.org/namespaces/tal"
          xmlns:metal="http://xml.zope.org/namespaces/metal"
          xmlns:i18n="http://xml.zope.org/namespaces/i18n"
          lang="en"
          metal:use-macro="context/main_template/macros/master"
          i18n:domain="someprojectid">
    

    and I can use tal, metal and i18n attributes and tags at will.