I would like to setup a script job that scans a page for web inks and marks in red those that are not valid any more.
The reason why I do not want to use a macro for this is that I want watchers to be notified of this change.
I have installed Confluence script runner, I had a look at the confluence API especially regarding ContentEntityObject but I could not figure out a way to read the page content and update it.
Ok, clear now. What you need essentially is understand that each page is composed of a sort of meta language called storage format https://confluence.atlassian.com/doc/confluence-storage-format-790796544.html
In essence what you need to do is look for all pages, iterate over them, get the page content and update it, so something like:
ContentEntityObject contentEntityObject = page.getContentEntityObject() String body = contentEntityObject.getBodyAsString() //Do a regex to replace the "a" links and add a style="background-color:red" to it after the replace do contentEntityObject.setBodyAsString() with the updated body and then finally: this.pageManager.saveContentEntity(contentEntityObject, SILENT_SAVE_CONTEXT);
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs