Changes for page AutoGallery
Summary
Details
- XWiki.WikiMacroClass[0]
-
- Cached
-
... ... @@ -1,0 +1,1 @@ 1 +No - Context elements
-
... ... @@ -1,0 +1,1 @@ 1 +Document - Asynchronous rendering
-
... ... @@ -1,0 +1,1 @@ 1 +No - Macro code
-
... ... @@ -1,0 +1,24 @@ 1 +{{groovy}} 2 +def attachments = doc.getAttachmentList().findAll { 3 + it.filename.toLowerCase() ==~ /.*\.(jpg|jpeg|png|gif)$/ 4 +} 5 + 6 +def html = new StringBuilder() 7 + 8 +if (attachments.isEmpty()) { 9 + html << "No images available." 10 +} else { 11 + html << "<div style='display: flex; flex-wrap: wrap; gap: 10px;'>" 12 + attachments.each { att -> 13 + def safeFilename = $escapetool.url(att.filename) 14 + def url = "${doc.getExternalURL('download')}/${safeFilename}" 15 + html << "<div style='margin: 5px; display: inline-block;'>" 16 + html << "<img src='${url}' style='max-width: 200px;' />" 17 + html << "</div>" 18 + } 19 + html << "</div>" 20 +} 21 + 22 +wikimacro.result = $services.rendering.parse(html.toString(), "xhtml/1.0").getChildren() 23 +{{/groovy}} 24 + - Macro content type
-
... ... @@ -1,0 +1,1 @@ 1 +Unknown - Macro content availability
-
... ... @@ -1,0 +1,1 @@ 1 +No content - Default categories
-
... ... @@ -1,0 +1,1 @@ 1 +Formatting - Macro description
-
... ... @@ -1,0 +1,1 @@ 1 +Generates a gallery of all image attachments on this page. - Execution is isolated
-
... ... @@ -1,0 +1,1 @@ 1 +Yes - Macro id
-
... ... @@ -1,0 +1,1 @@ 1 +autogallery - Macro name
-
... ... @@ -1,0 +1,1 @@ 1 +AutoGallery - Supports inline mode
-
... ... @@ -1,0 +1,1 @@ 1 +No