Automate custom tagging in published DITA files through the DITA-FMx book-build process.
These steps describe the process for using StructureSnippets as an “addon” plugin in the DITA-FMx the book-build process.
Working on the generated FM files, create the snippet files to insert.
Note that if your snippets require additional objects on reference pages or modified paragraph or character styles (or EDD modifications), you’ll need to make those revisions to the Book structure application template or to the component template that’s applied to the components you’re processing.
Create the snippetscript.ini file in the book-build folder.
The snippet script contains one or more snippet descriptors which define snippets to be applied to the elements in the generated book components.
Test this on the generated FM files.
You can test a snippet script on the “current” file, using the
command. Typically, this would be a representative FM file that has been created from the DITA-FMx book-build process.Once you’re sure it’s all good, enable the Run Custom Script option in the DITA-FMx Book Build Settings dialog (or in your book-build INI file).
Set the Client Name as “Pubs-Tools:StructureSnippets” and the Args value as “RUNSNIPPETSCRIPT”.
If you’re using a book-build INI file, you'll need these entries in the BookBuildOverrides section:
RunScript=1 ScriptName=Pubs-Tools:StructureSnippets ScriptArgs=RUNSNIPPETSCRIPT
If you’re not using a book-build INI file, the script name and args values will need to be entered into the corresponding fields in the DITA-FMx Book Build Settings dialog.
When you run the Generate Book from Map command, you’ll see this in the console window (return value will vary):
-- Successful call to client [Pubs-Tools:StructureSnippets] with args [RUNSNIPPETSCRIPT] - returned value [4]
If you see a negative value in the return value, something went wrong. A value of “0” indicates that nothing was done, but it’s set up correctly (test your script).