0 Votes

Changes for page Incidents list

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

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

Summary

Details

Page properties
Content
... ... @@ -15,27 +15,31 @@
15 15   def doc = xwiki.getDocument(docName)
16 16   def obj = doc.getObject('Main Categories.Anti White Incidents.Code.MoviesClass')
17 17   if (obj) {
18 - def rawHeadline = obj.getProperty('headline')?.value
19 - def headline = (rawHeadline instanceof String) ? rawHeadline.trim() : null
18 + def rawHeadline = obj.getProperty('shortText1')?.value
19 + def headline = (rawHeadline instanceof String) ? rawHeadline.trim() : docName
20 20  
21 - def rawUrl = obj.getProperty('URL')?.value
22 - def urlRaw = (rawUrl instanceof String) ? rawUrl.trim() : null
21 + def rawUrl = obj.getProperty('longText2')?.value
22 + def finalUrl = null
23 +
24 + if (rawUrl) {
25 + def urlString = rawUrl.toString().trim()
26 + if (urlString.startsWith('http://') || urlString.startsWith('https://')) {
27 + finalUrl = urlString
28 + }
29 + }
23 23  
24 - // Extract first https://... URL regardless of wiki wrapping
25 - def urlMatch = (urlRaw =~ /(?i)(https?:\/\/[^\]\s>]+)/)
26 - def extractedUrl = urlMatch ? urlMatch[0][1] : null
27 -
28 - def label = (headline && headline.length() > 0) ? headline : (fallbackTitle ?: docName)
29 -
30 - if (extractedUrl) {
31 - print("* [[${label}>>${extractedUrl}]]\n")
31 + def labelEscaped = headline.replace('[', '').replace(']', '')
32 +
33 + if (finalUrl) {
34 + // Try different XWiki external link syntaxes
35 + println "* [[$labelEscaped>>$finalUrl]]"
36 + // Alternative: try without the url: prefix but with full URL
32 32   } else {
33 - print("* [[${label}>>doc:${docName}]]\n")
38 + println "* [[${labelEscaped}>>doc:${docName}]]"
34 34   }
35 35   }
36 36   } catch (Exception e) {
37 - print("## Error on ${docName}: ${e.message}\n")
42 + println "## Error with ${docName}: ${e.message}"
38 38   }
39 39  }
40 40  {{/groovy}}
41 -

XWiki AI Chat