Suppose one has a wiki page for a project, named Smallwiki
. Sub-pages can be added and link back to the main page with the text *..*
. If the project changes name to Pier
, then a single page can have the title changed and all of the sub-pages have the correct name.
An example of a parent link for this page is *..*
which goes to Updates, and *../..*
goes to John Borden.
A problem occurs when reading in a wiki during an upgrade. Each page is read as an independent entity with no reference to the other pages. A link to a parent like *..*
is changed to *.*
. This is the expected behavior when editing the root page.
One option is to link to the parent/grandparents/etc to be fully qualified before exporting:
(PRKernel instanceNamed: 'pier') root enumerator all; do: [ :page | page outgoingReferences do: [ :link | (link isInternal and: [ link target ~~ page and: [ page parents includes: link target ] ]) ifTrue: [ link reference: link target absolutePath ] ] ].
If one is not importing into the latest Pier code, this can convert back to relative links with:
(PRKernel instanceNamed: 'pier') root enumerator all; do: [ :page | page outgoingReferences do: [ :link | (link isInternal and: [ (link reference first = $/) and: [ page parents includes: link target ]]) ifTrue: [ link reference: (page relativePathTo: link target) ] ] ].