Highlighting everything between { and } for Smarty templates

Discuss syntax highlighting or submit new syntax files.
Post Reply
Eelke Spaak
Posts: 5
Joined: 14 Nov 2008 14:09

Highlighting everything between { and } for Smarty templates

Post by Eelke Spaak »

I have been trying to make a copy of the HTML syntax file which also enables the highlighting of everything between opening and closing braces { and }. This would allow a very convenient editing of Smarty templates: everything would be the same as plain HTML (which makes up the bulk of Smarty files), except for the special template codes, which are always in between { and }.

Some example Smarty code:

Code: Select all

{if isset($meta_keywords) AND $meta_keywords}
		<meta name="keywords" content="{$meta_keywords|escape:html:'UTF-8'}" />
{/if}
		<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
		<meta name="generator" content="PrestaShop" />
		<meta name="robots" content="{if isset($nobots)}no{/if}index,follow" />
		<link rel="icon" type="image/vnd.microsoft.icon" href="{$img_ps_dir}favicon.ico" />
		<link rel="shortcut icon" type="image/x-icon" href="{$img_ps_dir}favicon.ico" />
Anyone have an idea on how to achieve this? Many thanks!

Edit: I forgot to mention, I am not particularly interested in detailed Smarty highlighting, so I don't care about special colours for Smarty keywords, operators, etc. Just a single colour for an entire Smarty block would be ideal.
Eelke Spaak
Posts: 5
Joined: 14 Nov 2008 14:09

Post by Eelke Spaak »

OK, I seem to have forgotten about blocks. However, when I define a block as follows:

Code: Select all

[Block]
1_Name=Smarty tags
1_OnLine=1
1_AsString=1
1_Start={
1_End=}
only very few Smarty tags get highlighted, most seem to get ignored. Any help?
User avatar
Rickard Johansson
Site Admin
Posts: 6628
Joined: 19 Jul 2006 14:29

Post by Rickard Johansson »

Blocks may not work very well with tags. It's not been used in any syntax file before and therefor haven't been tested. I'll look into it.
Post Reply