Page 1 of 1

syntax highlighting for django

Posted: 02 Feb 2013 23:22
by tkachenkosi
how to select syntax highlighting an element of the block {% ... %} In the HTML file

Re: syntax highlighting for django

Posted: 03 Feb 2013 12:23
by pjj
Assuming that your question really reads
How can you enable Python highlighter in HTML?
the answer is that, to my best knowledge, you can't... easily. But using a little trick you will be able to do this. Here's how:
1) Environment > Options.. > Source > Enable multiple highlighters in HTML must be "on" (of course)
There's "Set" button, unfortunately, there's no Python listed. Luckily, ASP uses same tags as Python, i.e. <% %> (not {% %}). Alas, you can't just switch ASP highlighter to Python.syx, since this isn't remembered. So you need to navigate to RJ TE "syntax" directory:
a) on Windows 7 it's C:\Users\{username}\AppData\Roaming\RJ TextEd\syntax
b) on Wndows XP it's C:\Documents and Settings\{username}\Application Data\RJ TextEd\syntax
2) in order to rename python.syx to ASP.syx and python.ini to ASP.ini
3) then you need to edit ASP.ini to make its header look like this:
[MultiHighlight]
Syntax=Html
File=Html.syx
ASPLanguage=
4) and finally restart RJ TE.

VoilĂ , you have now Python syntax highlighted :)

Rickard,
1) I assume that it is a bug that syntax file isn't remembered after restart (see above)
2) adding direct support for Python highlighter in HTML will be much welcomed :wink:

Re: syntax highlighting for django

Posted: 03 Feb 2013 19:16
by tkachenkosi
Thank you of course, but this is not what you need. At least be able to select only the tag {%%}

Re: syntax highlighting for django

Posted: 03 Feb 2013 19:26
by pjj
I don't get it; what do you want to achieve? Highlight just these two strings, {% and %}? Or anything that goes in between? A code sample would be much appreciated (I don't know Python.)