0 Votes

Changes for page Incidents list

Last modified by Ryan C on 2025/07/14 15:42

From version 8.1
edited by Ryan C
on 2025/07/14 14:20
Change comment: There is no comment for this version
To version 9.1
edited by Ryan C
on 2025/07/14 14:22
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -21,21 +21,20 @@
21 21   def rawUrl = obj.getProperty('URL')?.value
22 22   def urlRaw = (rawUrl instanceof String) ? rawUrl.trim() : null
23 23  
24 - // Smart extraction: handles [[URL]], [[label>>URL]], raw text
24 + // Extract first https://... URL regardless of wiki wrapping
25 25   def urlMatch = (urlRaw =~ /(?i)(https?:\/\/[^\]\s>]+)/)
26 26   def extractedUrl = urlMatch ? urlMatch[0][1] : null
27 27  
28 - def isValidUrl = (extractedUrl != null)
29 29   def label = (headline && headline.length() > 0) ? headline : (fallbackTitle ?: docName)
30 30  
31 - if (isValidUrl) {
32 - println "* [[${label}>>${extractedUrl}]]"
30 + if (extractedUrl) {
31 + print("* [[${label}>>${extractedUrl}]]\n")
33 33   } else {
34 - println "* [[${label}>>doc:${docName}]]"
33 + print("* [[${label}>>doc:${docName}]]\n")
35 35   }
36 36   }
37 37   } catch (Exception e) {
38 - println "## Error with ${docName}: ${e.message}"
37 + print("## Error on ${docName}: ${e.message}\n")
39 39   }
40 40  }
41 41  {{/groovy}}

XWiki AI Chat