Ignore XML Namespace (TAL) in SublimeLinter - sublimetext2

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?

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.

Related

How to change the <!DOCTYPE> declaration from version HTML4.01 to HTML 5 in IntelliJ

When generating JavaDoc documentation in IntelliJ 2018.3.3 (Community Edition) I get this information
Constructing Javadoc information...
javadoc: warning - You have not specified the version of HTML to use.
The default is currently HTML 4.01, but this will change to HTML5
in a future release. To suppress this warning, please specify the
version of HTML used in your documentation comments and to be
generated by this doclet, using the -html4 or -html5 options.
At the moment the first statement of all generated HTML-files is:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Therefore I changed the default HTML language level from HTML 4 to HTML 5 at
Project Settings - Languages & Frameworks - Schemas and DTDs - Default XML Schemas
In addition I looked at the project settings at
Editor - File and Code Templates - Default Scheme
There are templates for HTML and HTML4, but not for HTML5.
I wonder about how to change to the right version of HTML as required.
Thanks for your help!
As the message you've quoted says, you can specify the version of the HTML generated by JavaDoc by specifying the -html5 option. In IntelliJ IDEA, this option can be specified under "Other command line arguments:" in the Tools | Generate JavaDoc... dialog.
None of the other options you've tried to change have any impact on JavaDoc generation.

PhpStorm does not recognize HTML tags correctly

I'm trying to write an HTML file in PhpStorm and I got a bunch of errors. I'm not sure how to explain it, so I will link a screenshot below.
Basically I got an error at each HTML tag and error message like
TS2365 Operator '>' cannot be applied to string and number
I have not enabled TSLint and my file mapping is correct.
Any help will be appreciated
WEB-36373 is fixed in 2018.3.3.
For now, I can suggest turning Angular language service off in Settings | Languages & Frameworks | TypeScript (all the angular functionality will still be available)

org-mode - no syntax highlighting in exported HTML page

I've been trying to get the syntax highlighting to work when exporting org-mode formatted file to HTML, but none of what I've done so far has worked. I followed the Babel configuration guide but the code block on the generated HTML page still looks plain. I have also set (setq org-src-fontify-natively t). What am I missing?
Code block syntax highlighting in Org-mode's HTML export depends on the htmlize library, which Org-mode's documentation says is included but may actually need to be installed separately:
If the example is source code from a programming language, or any other text that can be marked up by font-lock in Emacs, you can ask for the example to look like the fontified Emacs buffer¹¹⁹. This is done with the ‘src’ block, where you also need to specify the name of the major mode that should be used to fontify the example¹²⁰, see Easy Templates for shortcuts to easily insert code blocks.
#+BEGIN_SRC emacs-lisp
(defun org-xor (a b)
"Exclusive or."
(if a (not b) b))
#+END_SRC
...
¹¹⁹This works automatically for the HTML back-end (it requires version 1.34 of the htmlize.el package, which is distributed with Org). Fontified code chunks in LaTeX can be achieved using either the listings or the minted package. Refer to org-latex-listings documentation for details.
htmlize.el is available via MELPA.

in PhpStorm, is it possible to reformat injected code within a PHP file?

PhpStorm can apply code style rules for specific languages with the Reformat Code command. PhpStorm can also recognize a language embedded within a file of another language (known in PhpStorm as 'Language Injection'). So, I expect that a language would be subject to its code style rules wherever the language is used -- whether embedded or in its own file.
I've found that this works as expected for css/js within an html file, but not for language injections within PHP files. PhpStorm will recognize css within a heredoc, and html as a heredoc and in single- and double- quoted strings -- yet reformatting does not work in any of these cases.
Short of using an intermediary file to reformat the code, how can I get PhpStorm to reformat these sections of code? I am using PhpStorm 6.0.3 for Mac.
Their documentation states:
PhpStorm supports full coding assistance for:
CSS and JavaScript in an HTML or XML file.
CSS, JavaScript, and SQL outside PHP code blocks and inside PHP string literals.
The second bullet seems only half true, as css/js/sql are recognized but not subjected to code styles inside PHP string literals. And injected html is not specified; but between PhpStorm recognizing the language injections and its capability to apply code styles to an arbitrary selection, all the pieces for formatting embedded languages seem to be there. What am I missing?
To reformat injected code according to PhpStorm code styles Preferences, select the injected code and open the Intention Actions list (Alt+Enter), and select "Edit __ Fragment" to edit it in it's own dedicated window (documentation). In this window, code formatting will work as expected.

QT HTML Parser (+XQuery)

I'm looking for a QT HTML parser tool.
I have some html source code and I'd like to use XQuery on it.
I already tried using QWebPage + QWebElement, but I don't like this solution cause firstly it doesn't works on non-gui thread (because of QWebPage) and because we can't apply XPath but CSS Path.
The other solution I tried is QXmlQuery, it works great, but the only problem is that it doesn't works if there is an error on the page. For example, the first page I tried was missing systemId (in the DOCTYPE tag), so the parsing was aborted.
I heard we can use gecko for parsing but I have no idea how to use it with QT.
Have you some suggestions ?
Thanks
I recommend that you use tidy on your HTML page and then process it with XQuery.
Zorba is a C++ XQuery processor that provides a tidy module.
You can find a live example at http://www.zorba-xquery.com/html/demo#tQZu6aq1K4KoGJm9m0oIPwKRt04=
BaseX got a QT client and can use TagSoup for cleaning up HTML documents.
I'm sorry I cannot provide you with an QT example as I don't know QT at all.