Contents | Start | End | Previous: Chapter 12: Working With Style Sheets | Next: Chapter 14: Working With Tables
The string table feature gives you extra flexibility in customising your book, by defining how keywords will be replaced by text at compile-time, for all versions of your book or per-configuration.
Sometimes you may wish to change text that Jutoh generates, for example the heading ‘Table of Contents’ if generating a table of contents. You may also wish to define strings that can be used as keywords in cover designs, or change the way metadata is presented. This is where string tables come in. You can define several global string tables, independent of any project; and you can also define one or more project-specific string tables. Then in your configuration, you can select the global string table and/or project string table that should be used, and if there is a value corresponding to the string name, that value will be used instead of the original name.
For example, in Preferences, you could add a global table ‘English’, then add a string with name ‘Table of Contents’ with value ‘Contents’. Then select the ‘English’ string table for the Global string table property in all your configurations. The word ‘Contents’ will now be used instead of ‘Table of Contents’ in your generated book.
Jutoh knows to check the string tables for certain keywords when generating documents or parts of an ebook, so the ‘Table of Contents’ substitution will be done when generating a table of contents title as well as in your own content. Other examples include ‘Cover Page’, ‘Guide’, ‘Contributions by’, and ‘Published by’.
Continuing with the example, you can also use the keyword %Table of Contents% in your cover designs, and the word ‘Contents’ will be substituted.
You can also include keywords in your metadata and, if the Replace strings in content configuration property is checked, in your book content, and they will be expanded before inclusion in your generated ebook. Note that string replacement in content only works for strings within the same paragraph formatted in the same character style.
Here’s another example: say you wanted the Smashwords edition of your book to contain different information from the other versions of your book. In the picture below, a string table called ‘Smashwords Strings’ has been added to the project properties, to be used to tailor the content of the book according to the Smashwords publishing platform:
The Strings page of the Project Properties dialog
The Project string table property of the Smashwords configuration will be set to ‘Smashwords Strings’ and the keywords %Copyright%, %Edition% and %Title% can be used in the book text, so that the Smashwords edition of the book contains the appropriate strings. A string table would be defined for each configuration, or perhaps one fallback table ‘General Strings’ would be used for non-Smashwords editions.
The predefined metadata keywords are: %TITLE%, %ID%, %LANGUAGE%, %AUTHOR%, %CONTRIBUTORS%, %PUBLISHER%, %URL%, %SUBJECT%, %DESCRIPTION%, %DATE%, %RIGHTS%, %COVERAGE%, %TYPE%, %FORMAT%, %SOURCE%, %RELATION%
String table values may themselves contain keywords; Jutoh will make substitutions until there are no changes in the string.
Project string table values take precedence over global string table values if the same string name occurs in each.
If keywords are not being substituted, check that these requirements are met:
Each keyword name in the content must be formatted with either no style, or a single style.
Keyword names are case-sensitive.
Each keyword must be enclosed in % symbols.
You must set the project and/or global table names in your configuration.
You must check the configuration property Replace strings in content.
You may never use string tables, but now you know the feature is there and what it’s for, you have an extra tool in case you need to do global or per-configuration customisation of the text within your ebook. Next, we look at how you can use tables in your book.
Contents | Start | End | Previous: Chapter 12: Working With Style Sheets | Next: Chapter 14: Working With Tables