Red Hat Bugzilla – Bug 860033
Add ID values to topics when not present in topic source.
Last modified: 2012-11-23 09:09:00 EST
Description of problem:
When building hybrid books combining any of traditional DocBook / topicrepo content / skynet content the only way to get CSP style relationships in your book is manually. To do this the content being referred to has to have an ID.
When you assemble a book using the CSP it automatically generates the ID attribute of the root node based on the topic title - the topic tool should do the same. Note that for topic tool it will be key to look for the root node, not just a section, as on some legacy content that pre-dates the decision to use sections as the topic container we may have other root node types.
I have some initial code which does this but need to be mindful of the scenario where the same topic is included twice in a guide. Need to ensure we keep track of the IDs and make them unique, both among topics and the existing "normal" content.
Committed revision 85415.
Topic Tool has been updated to ensure that all exported topics include an ID attribute for the root node. This logic functions such that:
1) If the root node of the topic already has an ID no further action is taken (this will be the case for most SVN topicrepo topics).
2) If the root node of the topic does not have an ID an ID is generated based on the contents of the first title element within the root node.
A) Where no title element is found, no ID will be generated.
B) Where a title element is found, an ID will be generated:
- Spaces are replaced with underscores (_).
- Characters other than A-Z, a-z, 0-9, '-', '_', and '.' are removed.
- Where the same ID has already been allocated (indicating that the topic has most likely been included twice) then an underscore an a number will be appended to ensure that the ID is unique. This number will also be appended to the filename of the topic on disk.