Customizing Templates

The default templates that BibDesk uses for Export and Services can be found in the folder ~/Library/Application Support/BibDesk/Templates. You can modify these templates to suit your preferences. If you remove any of the default templates, BibDesk will automatically replace it with the latest version on the next startup.

For setting the templates used for export and services, or for adding completely new templates, see the Template Preferences help topic.

A template file is basically a file written in the format to which you want to export. However it contains so-called template tags, which look a bit like standard HTML tags, apart from an extra $ before its name. When exporting, these tags are replaced by corresponding properties. For example, the template tag <$fields.Title/> will be replaced by the title field of the publications.

The syntax for the template files is described in more detail in the Template Tags Appendix.

A single template can consist of several template files, distinguished by their role, as set in the preferences. Any template must always have a Main Page template file, which is used to create the data for the document. A template can have a Default Item template file, which can be used for creating the data for individual publications. If you want to use different templates for particular publication types (like article or book) you can add separate template files for those types.

Furthermore, a template can have any number of Accessory Files, which are copied directly when exported. For example for HTML export, this could be an external CSS style file.

Finally, a template can have a post processing script that furthermanipulates the export. Such a script has to be a shell script which expects the export on standard input, changes it and writes the result to standard output. For instance the following shell script would replace any occurrence of the placeholder <!-- CURRENT-DATE --> in the template with the actual current date:

#!/bin/sh
sed -e "s/<!-- CURRENT-DATE -->/`date`/g"

If you want to use separate item template files, your Main Page template should contain the <$publicationsUsingTemplate/> tag. Otherwise, the Main Page template should contain the <$publications>...</$publications> collection tags.

You can use the Template Editor to create some basic templates without the need to know the template syntax.