syntax highlighting for django

Discuss syntax highlighting or submit new syntax files.
Post Reply
tkachenkosi
Posts: 3
Joined: 14 Oct 2012 11:19

syntax highlighting for django

Post by tkachenkosi »

how to select syntax highlighting an element of the block {% ... %} In the HTML file

User avatar
pjj
Posts: 1784
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

Re: syntax highlighting for django

Post 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:
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus

tkachenkosi
Posts: 3
Joined: 14 Oct 2012 11:19

Re: syntax highlighting for django

Post by tkachenkosi »

Thank you of course, but this is not what you need. At least be able to select only the tag {%%}

User avatar
pjj
Posts: 1784
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

Re: syntax highlighting for django

Post 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.)
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus

Post Reply