SPFE Documentation | Collections > SPFE Development > Strings
Strings
Strings are a content reuse feature of the EPPO-simple plugin.
A string is an arbitrary sequence of text that has been given an id so that it can be included by reference at other points in the content. Strings can also contain inline markup such as annotation markup or text decoration. Essentially, anything that can occur inside a paragraph can occur inside a string. You cannot insert a string or string reference inside other inline markup, so if you want to place a piece of text in a string, and aslo inside a piece of inline markup, you should place the markup inside the string. Thus if you want to substitute different animal names inot a sentence, and mark them up as animals, you should define your string like this:
<string id="animal-name"><animal>fox</animal></string>
And insert the string reference like this:
<p>The quick brown <string-ref ref-id="animal-name"/>.</p>
This will resolve to:
<p>The quick brown <animal>fox</animal>.</p>
Strings can be defined inline in a topic file, or they can be defined in separate strings collections. If a string is defined inline, it is included where it occurs. Strings in string files are not included anywhere unless they are pulled in by a string reference. Strings can also be define in the configuration file as part of the content set configuration or the topic set configuration.
A string reference inserts a string by ID at the place it occurs in the text.
Strings are recursive. That is, strings can contain other strings and string references.
Because you often want to change some part of a text when it is being reused, fragments and fragment references can both define local strings. Any string references inside a fragment will be resolved by looking first at local-strings defined in the fragment reference, then at local strings defined in the fragment definition, and then at global strings. In effect, this means that you can define string substitutions whenever you insert a fragment into your content.