1 // Strip URLs from confluence and generate readable heading
2 // by removing path and replacing characters like "+"
14 if (s[s.length-1] == '/') {
15 s = s.slice(0, s.length - 1);
18 // Remove confluence parts
19 if (s.indexOf("infohub") != -1) {
20 print("Found infohub page");
21 if (s.indexOf("spaceKey") != -1) {
22 s = s.replace(/^.*spaceKey=/g, "");
23 s = s.replace(/(&title=)/g, ": ");
26 s = s.replace(/^.*display\//g, "");
27 s = s.replace(/\//g, ": ");
29 } else // no infohub page
32 s = s.replace(/^.*\//g, "");
37 // Replace "+" and "-"
38 s = s.replace(/\+/g, " ");
39 s = s.replace(/%3A/g, "");
40 print ("After replacing:");
44 m1.setHeadingPlainText(s);
47 statusMessage ("Heading not changed.");
49 statusMessage("Changed heading: " + org + " -> " + s);