IPublishPostProcessPlugin - IshRenameFilesToIshSyntax
This plugin will rename all the content files and their corresponding metadata files to a Title=ID=Version=Language=Resolution.Extension format. When the renamed file is an xml file, all files referenced (in links, imagelinks, conrefs, ...) in the XML content are renamed as well. Optionally the publication output metadata file can be renamed as well.
Plugin Input
| Parameter | Required | Default value | Allowed values | Description |
|---|---|---|---|---|
| IncludeTitle | No | Yes | Yes / No | Specifies whether the title should be included in the new file name |
| RenamePublicationOutput | No | Yes | Yes / No | Specifies whether the publication output metadata file should be renamed as well |
| MaximumFileNameLength | No | 160 | number | Specifies the maximum length for the new file name. You can decrease the value of this parameter if you plan to copy the files to a folder with a longer name in one of the following plugins. |
The files that need to be renamed have to be present in the ReportItems collection of the context. Out-of-the-box, the ReportItems collection is created during the file export phase of the publish. Every file referenced in the Filename property of a ReportItem will be renamed and the property will be updated accordingly.
- For
Maps,Libraries,TopicsorImages:- If the parameter
IncludeTitleisYes, the new file naming is: Title=ID=Version=Language=Resolution.Extension. - Otherwise the new file naming is: ID=Version=Language=Resolution.Extension.
- If the parameter
- For the
Publication output metadatafile (if the parameterRenamePublicationOutputisYes):
- If the parameter
IncludeTitleisYes, the new file naming is: Title=ID=Version=OutputFormat=LanguageCombination.Extension. - Otherwise the new file naming is: ID=Version=OutputFormat=LanguageCombination.Extension.
MaximumFileNameLength parameter, some characters the Title will be cut off. If the length of the remaining file name is still too long, an FileNameTooLong or FilePathTooLong is raised.
Plugin Outcome
plugin name="ISHRENAMEFILESTOISHSYNTAX" example
<plugin name="ISHRENAMEFILESTOISHSYNTAX" handler="IshRenameFilesToIshSyntax">
<description>Renames the files to a Title=ID=Version=Language=Resolution.Extension format</description>
<initialize/>
</plugin>
- Topic: "GUID-03AB2EA1-F81B-4A22-8149-710094BE1081.xml" => "connectors overview=GUID-03AB2EA1-F81B-4A22-8149-710094BE1081=1=en=.xml"
- Image: "GUID-043A7DFC-335B-43AE-9870-BF3EF8FA068A-Low.gif" => "select-left=GUID-043A7DFC-335B-43AE-9870-BF3EF8FA068A=1=en=Low.gif"
- Map: "GUID-C9CA7357-CBA3-43B3-A4B2-B977AD1B7D1E.ditamap" => "users guide=GUID-C9CA7357-CBA3-43B3-A4B2-B977AD1B7D1E=2=en=.ditamap"
- Publication output metadata file: "publicationoutput.met" => "MP330=GUID-789BBB3D-8A09-4916-8857-09A246CB6F59=3=DITA Delivery=en.met"
Example of a resulting Map XML file
<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<?ishdoctype PABpAHMAaABkAG8AYwB0AHkAcABlAD4ADQAKACAAIA+AA==?>
<?ish ishref="GUID-C9CA7357-CBA3-43B3-A4B2-B977AD1B7D1E" version="2" lang="en"?>
<map id="GUID-C9CA7357-CBA3-43B3-A4B2-B977AD1B7D1E" xml:lang="en" class="- map/map ">
<title id="GUID-651CA588-9722-42B2-8BDF-73FD8D197928" class="- topic/title ">User Guide</title>
<topicref href="for your safety=GUID-4BB40D57-5C0D-41E4-B437-0DB092523E8A=1=en=.xml"
type="topic" ishtype="ISHSection" class="- map/topicref ">
<topicmeta class="- map/topicmeta ">
<navtitle class="- topic/navtitle ">For your Safety</navtitle>
</topicmeta>
</topicref>
<topicref href="connectors overview=GUID-03AB2EA1-F81B-4A22-8149-710094BE1081=1=en=.xml"
type="topic" ishtype="ISHSection" class="- map/topicref ">
<topicmeta class="- map/topicmeta ">
<navtitle class="- topic/navtitle ">Connectors</navtitle>
</topicmeta>
</topicref>
<topicref href="installing sim card=GUID-6B658E0D-415E-4DF7-8697-6B3C899A807D=1=en=.xml#GUID-6B658E0D-415E-4DF7-8697-6B3C899A807D"
type="task" ishtype="ISHSection" class="- map/topicref ">
<topicmeta class="- map/topicmeta ">
<navtitle class="- topic/navtitle ">Installing SIM Card and battery</navtitle>
</topicmeta>
</topicref>
</map>
Plugin flow
IshRenameFilesToIshSyntax does the following: All files that are referenced in the FileName property of a ReportItem in the ReportItems are collected and:
- Renamed to the
ishformat (including the title or not based on the value of theIncludeTitleparameter. - All xml files that are renamed are kept in a list and:
- Opened
- Parsed to extract the referenced files
- Changed, so the referenced to the file gets the new file name
- Saved
If the parameter
RenamePublicationOutputisYes, the publication output metadata file in the language folder is renamed as well.