
Syntax
highlighting
This feature was the very first I made to integrate Homesite with Tridion. It started with R4 and there are now new parsers available for R5 (for both templates and Template Building Blocks). At that time, I used Homesite only to edit templates, though copy/paste from/to Tridion, and vice versa. It today comes as a perfect complement of the rest of the integration.
- Clever syntax highlighting
- How to install the parsers ?
- How to customize the parsers ?
- Swapping between R4 and R5 highlighting
- Why 2 parsers for R5 ?
Homesite allows to customize the colors of such parsers from its option panels. Adding keywords cannot be done at user level (and its source code is the only code of the integration that I don't share so far).
The integration comes with 3 parsers (TridionR5.scc for Page Templates and
Component Templates and TridionTBB.scc for Template Building Blocks, and
Tridion.scc for R4). Simply copy them into the
/Parsers/ folder of your Homesite installation and click
in
the toolbar. That's all (edit a valid template to make sure).
for your information : Homesite comes with a full set of parsers (for html, asp, jsp, xml, jscript, etc...). All these parsers are registered in the registry during Homesite installation. To add a new parser, there is no need (as before) to hack the registry as the Homesite API comes with a simply code to update the registry automatically (this code is provided in the toolbar button). Should you be willing to install the parsers by hand, this is pretty easy though :
Add the following keys to the registry :
HKEY_CURRENT_USER\Software\Macromedia\HomeSite\Parsers\tridionR5\TridionR5 >> Extensions = tpt;tct;tpts;tcts; HKEY_CURRENT_USER\Software\Macromedia\HomeSite\Parsers\tridionR5\TridionTBB >> Extensions = tbb;
You might find Homesite+ or other if you're using another release, but it is the same. The script which is available from the toolbar does that for you, but also allows you to swap from a parser to another (this is for those who would still be editing and migrating R4 templates). Indeed, I've left the old R4 parser in the new integration (Tridion.scc).
HKEY_CURRENT_USER\Software\Macromedia\HomeSite\Parsers\tridionR5\Tridion>> Extensions = tpt;tct;tpts;tcts;
Clicking R4 will reassign the extensions we use to R4 parser. And clicking R5 will reassign the extensions to the R5 parser. Actually, the registry entries are updated automatically.
These parsers are designed to highlight cleverly VBScript around Tridion. Below is the list of the families which are separately customisable. If you don't like my default color, feel free to change them.
- Tridion Content Manager
- TCM classes (these 6 subdivisions can have different colors !)
- General classes
- Items classes
- Organizational Items classes
- Security classes
- System classes
- Workflow classes
- TCM methods and properties
- TCM Script delimiters ([%...%])
- TCM output ([%=...%])
- TCM Pre-parsing keywords (such as #include)
- TCM TCMScriptAssistant class
- TCM Default functions
- R4 Deprecated classes and methods
- R4 Changed methods
- WriteOut keyword (treated separately so that you can highlight it as you like)
- Strings within TCM script delimiters
- Numbers within TCM script delimiters
- VBScript within TCM delimiters
- VBScript comments
- VBScript Functions
- VBScript Keywords
- VBScript Instructions
- VBScript constants
- HTML
- HTML Tags
- HTML Attributes
- HTML Comments
- HTML Strings
- HTML Numbers
- HTML Special characters (such as &)
- HTML Anchor tags
- HTML Table tags
- HTML Image tags
- HTML Script tags
- HTML Style tafs
- Punctuation
- Javascript
- Keywords
- Methods
- Symbols
- Strings
- Identifiers
- Numbers
- CSS
- Selectors
- Properties
- Values
- MISC
- ASP/JSP tags
I've tried to have as many families as possible in order to allow as many differenciations as possible, in order to facilitate, if necessary, the reading of the template, especially to make differences between the different categories of classes available in the Tridion Object Model (in case you want Items classes to be highlighted differently from the rest, for instance).
Swapping between R4 and R5 highlighting
A R4 syntax parser is also available (supports up to R4.4 SP2, download it separately here). As I made the R5 parser during my own migration period, I found it useful to have the ability to swap highlight one template with both parsers. This is the reason why the R5 parsers is designed to highlight not only the R5 TOM, but also the deprecated stuff from R4 (classes such as DTD for instance are in bold red by default) and some stuff that had changed and that needed to be taken care off (such as properties which used to return integers and now return string like URIs).
To swap between the 2 parsers, alternately click
and
in
the toolbar.
how it works :
in Homesite, the available parsers are mapped with file extensions. For instance, you can map the parser named HTML with html;htm extensions. To do that you simply need to edit the Homesite Options (F8) then Color Coding. The parser installation procedure added 2 parsers to this list and automatically added tct;tpt extensions to TridionR5 and tbb to TridionTBB. If you want to remap the extensions/parsers to R4, type tct;tpt in front of Tridion. To come back to R5, you'll have to undo that. The swap feature does that for you automatically (it installs the parsers in the registry then swaps the extensions when asked by the toolbar)
The small animation below shows some basic highlighting of differences between R4 and R5.

As there are 2 kinds of templates in R5, the Component/Page Templates, and the Template Building Blocks, I had to make 2 different parsers. Indeed, the parser systems I made relies on delimiters, which are the Tridion brackets to the former. But there is no delimiters in Template Building Blocks. The color mapping of both parser is similar. But if you customise the colors, you'll have to make it in both parsers.
All information provided by these pages are provided "as is".Use this information at your own risk. The author cannot be held responsible for any inaccuracies and their consequences. Feel free to pick what you need.