Sorry for resurrecting this thread…
Could Xwiki also provide a way to apply such a transformation while saving a page, such that the transformation does not have to be applied every time the page is rendered? The WikiWord transformation explicitly warns about possible performance impacts for larger pages.
Obvious drawbacks of the “transform on save” solution would be that
- the transformation has to be aware of the current page syntax and must know how to achieve it’s intended effect using appropriate syntax constructs
- the transformation’s results are “hard coded” in the page after saving, so updating the transformation (e.g. with a fix / new features) will not help for already saved pages
- the transformation has to be idempotent, i.e. make sure it doesn’t mess up the page in case an already transformed page is being edited again
Mh, maybe this approach wouldn’t be such a good idea after all, but I’d still be curious if it would be possible.
A similar but “distributed” approach to the WikiWord transformation way of transforming pages could be to employ JavaScript which post-processed each page in the browser after it’s rendered, similar to
https://www.xwiki.org/xwiki/bin/view/FAQ/How%20to%20open%20external%20links%20in%20a%20new%20tab%2Fwindow%20by%20default
The JavaScript could perform some regular expression search and replace on the final rendering results - however this might also be somewhat dangerous and I’m not sure about the performance implications if it’s ran from JavaScript in the browser. On the other hand, the post-processing could be postponed to take place after the page has already been loaded and rendered, so it might not delay page loading that much, and postprocessing is computed in a distributed fashion, so it does not place extra load on the server.
Opinions?