May 22, 2007
Formatting in the Text Template Editor for Web.
In the Web Module there is a wonderful HTML template called EXIF Metadata, which displays beautifully crafted EXIF information in Bold under the image. Each new piece of information is situated on a new line and looks well formatted and neat. It includes things that people may not want visible however, e.g. the camera serial number. So wouldn’t it be nice to create our own version of this, but with the information we want in it?

Fig 1. The EXIF Metadata template look
The information we see under the image in Fig 1. is using the Caption section of the Image Settings section of the Web Module. To change it we need to click on the drop down menu and click Edit. This will open the the Text Template Editor. So we start to click our tokens and add text to get the look we want. This is where we run into problems. How do we create a new line? And then, how do we make our text bold?
Adding <b> or <br> tokens doesn’t work. Neither does Ctrl M or any other normal code version of new line. Using Option Enter on the Mac will create a new line in the actual template box, but this does not work in the actual Web template (it does work in the Print Module though). So how do we do it? We can see it can be done, but can’t see how to do it.
There is an answer. It is an undocumented and Absolutely Unsupported formatting method. When I say unsupported, I mean used incorrectly that it has the potential to crash your computer, your car and your quad bike. Well, not the latter two, and maybe not the first, but it can break Web. To get the ability to use formatting we need to call on some XML code. The tag we need to use is:
<ag:formatted></ag:formatted>
In between these tags we place our formatting code. The code has to be valid XML or it will not work. This is key. All XML tags must be closed. The normal line break code <br> will not suffice. It must be <br/> or <br></br>. Initially when I started to use this, I wrapped everything inside individual <ag:formatted></ag:formatted> tags eg. <ag:formatted> <br/></ag:formatted>, but this is not necessary. An opening tag at the beginning and a closing tag at the end will work and allow you to format inside using normal HTML (XML to be precise). See Fig.2 for example

Fig 2. Formatted code in the Text Template Editor
In Fig 2 you can see both the actual text and tokens and the result above it. I’ve put my format tag at the beginning and a closeing tag at the end. In between I’ve entered text (e.g. Filename:) and then I’ve put my token inside <b></b> to make it appear in bold. Finally I’ve called a line break to allow my next section appear on a new line. I’ve then repeated with each line to the end. Once I’d completed my Preset, I saved it. This will help in creating new Text Template presets quicker as I can edit this one and save it as a new preset.
That’s it folks. Hopefully this information will be helpful to some of you in creating a custom Caption field with multiple items in your Web Galleries. Please, as a final warning, remember that you must use valid XML for it to work. If you have issues with this then I recommend you do not try it yourself. Here is a copy of the template from this tutoral: test-formatlrtemplate.zip. This needs to be unzipped and placed in the User/Library/Application Support/Adobe/Lightroom/Text Templates folder on Mac (where User is your account name). The PC location should be C:\Documents and Settings\username\Application Data\Adobe\Lightroom\Text Templates\ (again where username is your account name). Once you place it, restart Lightroom. You can then edit the file to what you require. Finally, I’ll just note that all this has been in the context of HTML galleries, so if it doesn’t work on your Flash gallery don’t be surprised, it’s really only meant for HTML galleries.








Can I just point out that to be even stricter about it you shouldn’t really be using tags for bold, but (and for italics)?
It sounds pedantic, but it is a semantic thing! :)
Once it works Richard. I suspect you could actually write a html page inside the formatting.
sorry the tags got munged, I meant:
Can I just point out that to be even stricter about it you shouldn’t really be using <b> tags for bold, but <strong> (and <em> for italics)?
Okay, that makes more sense.