Using a source template

From RootsMagic Wiki
Jump to navigation Jump to search

Navigation: RootsMagic 8 > Working With Sources > Source Templates >

---

There are three template fields, Footnote Template, Short Footnote Template and Bibliography Template. They are all created in the same way. The only differences are the fields used, the order of the fields, the field options used for the lead (first) field, where a shortened (abbreviated) form is used, and the punctuation.

To build a source template, you would drag the fields from the field list on the left to a template on the right. You can also type in the field name, but you have to remember to add the square brackets and spell the name as shown at the left. You would also add the punctuation, text, field options, and switches to complete the template. For a full discussion of the template language, see the topic Source Template Language.

The following examples illustrate a number of techniques that you can use when building a template.

The field options, switches and formatting codes used above include


Ø

Caps – capitalize the first letter of the first word, to ensure the entry starts with a capital letter



Ø

Year – display the year from the date field



Ø

Abbrev – use alternate text (text following || in the field) if found, otherwise use the text entered



Ø

Reverse – reverse the elements entered, in this case the name of the compiler, but can also apply to a place



about_16

Prefixes that denote rank are not moved to the end of the name after the given name as required by some style guides – they remain before the given name, i.e. Major Thomas Grong, when reversed would become Grong, Major Thomas rather than Grong, Thomas, Major.



Ø

<[field] ,> – the < > brackets indicate a simple conditional switch. If the [field] has data entered into it (one or more characters), the content of the field is displayed plus the space and comma. This technique makes the punctuation optional so it won't appear if the associated field contains no data.



Ø

<. [field:Caps]> – similar to the above, but inserted the punctuation before the field data, adding a period to end the previous sentence and starting a new sentence in this case. The :Caps option was included to force the first letter in the field to be capitalized.



Ø

<sc> ... </sc> – convert the lower case textual characters to small caps



Ø

<![StreetAddress|<sc>address for private use</sc>> – this uses the privacy switch (syntax is "<! private | public/non-private >"). This switch tells RootsMagic to display the first part only if the user chooses to display private data, otherwise the second part would be displayed. In this case, the street address would be only shown if the user chose to see the private data. In all other cases, the phrase "address for private use" in small caps would be shown.



about_16

Punctuation – you'll notice that punctuation between groups of fields tends to be commas or semi-colons in the footnotes and periods in the bibliography. Study your style guide to determine the punctuation that is required.


Additional field options, switches and formatting codes used here that were not mentioned above


Ø

[Title]<: [SubTitle]> – This example uses two things: for italics formatting, and <: [SubTitle]> in a conditional switch to include the colon and space if the user enters a subtitle



Ø

[field:Lower:Abbrev] – This illustrates using multiple options, forcing the text to lower case, and use the alternate text (entered after ||) if available. Whether the alternate text is used or note, text will be in lower case.



Ø

Surname – use the surname only of the author.



Ø

<[PubPlace]|N.p.> – this tells RootsMagic to display the first part (before the "|" bar) if there is data entered into the field, or use the second part (after the "|") if there is no data entered into the field. This technique lets you set up default text to be inserted if the user doesn't enter anything. In other cases, it can be used to enter standard wording, which the user can overwrite by entering a value. This is used in online templates to insert the word "accessed", <[AccessType]|accessed>, but the user can still enter another word of phrase, such as printed or downloaded or whatever.



about_16

When using the above technique, you must remember to format the case of the text following the | bar. For instance, if you use :Caps to capitalize the first letter in the field, you must capitalize the first letter of the text you enter, as in <[ItemType:Caps]|Card file>.



about_16

You cannot use the above technique when you want to make the field optional, because the text following the "|" bar always results in text being present, either from the field or from the default text.


Additional field options, switches and formatting codes used here that were not mentioned above


Ø

< [<[TranslatedName]>]> – This example illustrates a technique you can use to add square brackets around a field name. By entering the field name within conditional angle brackets, the outer pair of square brackets are treated as square brackets, and not as part of the field name.


Additional coding used here that was not mentioned above:


Ø

<[NewspaperPlace|Newspaper]> – This example uses two newspaper name fields, one for the regular name, the second for the newspaper name with a place inserted. Note the placement of these two elements in the Footnote template. A simple switch is used to display the name with the place if it is entered, or the newspaper name if the place version is not entered.



Ø

<; [CreditLine]> – This field allows users to enter the original source of the source for online images.



Ø

"[Article]<?[SpecificContent]|," [SpecificContent].|."> – This code solves the problem of punctuation that is dependent on whether a field has content or not. You cannot simply use a period at the end of the template. If there is no content, the period has to appear inside the closing quote, otherwise a comma is required inside the closing quote and the period would appear at the end. Thus, if the field [SpecificContent] has data, a comma and a closing quote is inserted before the content is displayed, otherwise if the field is empty, the period and closing quote are displayed.