Updating links on New and Save As
Posted: Tue Dec 29, 2015 1:37 am
Does anyone know the best way to update links in a DITA topic to make sure they are valid relative to where a file is? Is there anything built into oXygen that does this already such as the map manager re-factoring?
Many of our template files have conref's and links in them. They are valid relative to our template folder. But as soon as the files are used to create a new file (or untitled, unsaved file), the links will most likely be broken and need to be updated. It seems like having conref links and text in template files would be a common thing.
I tried using the isNewDocument() field but that was kind of useless because when you do an "insert > new..." in map manager, the file is saved first, therefore isNewDocument() returns false. Also a user may choose Save As on a file to create a new file in a different relative folder resulting in broken links.
The best solution I have come up with so far is to have a root attribute otherprops="newFile" on all our template files. If a file has that attribute/value on editorOpened(), update references relative to template directory and then remove the attribute/value.
Many of our template files have conref's and links in them. They are valid relative to our template folder. But as soon as the files are used to create a new file (or untitled, unsaved file), the links will most likely be broken and need to be updated. It seems like having conref links and text in template files would be a common thing.
I tried using the isNewDocument() field but that was kind of useless because when you do an "insert > new..." in map manager, the file is saved first, therefore isNewDocument() returns false. Also a user may choose Save As on a file to create a new file in a different relative folder resulting in broken links.
The best solution I have come up with so far is to have a root attribute otherprops="newFile" on all our template files. If a file has that attribute/value on editorOpened(), update references relative to template directory and then remove the attribute/value.