Änderungen von Dokument Excerpt Macro
Zuletzt geändert von xwikiadmin am 2025/01/07 11:39
Von Version 2.1
bearbeitet von xwikiadmin
am 2022/08/11 16:36
am 2022/08/11 16:36
Änderungskommentar:
Migrated property [defaultCategories] from class [XWiki.WikiMacroClass]
Auf Version 5.1
bearbeitet von xwikiadmin
am 2024/06/24 14:35
am 2024/06/24 14:35
Änderungskommentar:
Install extension [com.xwiki.pro:xwiki-pro-macros-ui/1.19.4]
Zusammenfassung
-
Seiteneigenschaften (1 geändert, 0 hinzugefügt, 0 gelöscht)
-
Objekte (3 geändert, 2 hinzugefügt, 0 gelöscht)
Details
- Seiteneigenschaften
-
- Inhalt
-
... ... @@ -1,6 +1,6 @@ 1 1 = Description = 2 2 3 -The Excerpt macro is a bridge between Confluence and XWiki. It allows the user to mark part of the page's content for use by other macros. 3 +The Excerpt macro is a bridge between Confluence and XWiki. It allows the user to mark part of the page's content for use by other macros, for exemple {excerpt-include}}. 4 4 5 5 = Parameters = 6 6 ... ... @@ -7,10 +7,12 @@ 7 7 |=Parameter|=Description|=Default 8 8 |**atlassian-macro-output-type**|The ouput type. It can be either BLOCK or INLINE.|INLINE 9 9 |**hidden**|If true, the content of the macro will be hidden.|false 10 +|**name**|The name of the excerpt, for named includes.|false 11 +|**allowUnprivilegedInclude**|Allow this excerpt to be seen even for people who don't have view rights on this page when included|false 10 10 11 11 = Example of usage = 12 12 13 -Example of excerpt with HTML:15 +Example of excerpt with a table in it: 14 14 15 15 {{code}} 16 16 {{excerpt}} ... ... @@ -19,7 +19,7 @@ 19 19 {{/excerpt}} 20 20 {{/code}} 21 21 22 -The result is the following 24 +The result is the following: 23 23 24 24 {{excerpt}} 25 25 |=Title1|=Title2|=Title3 ... ... @@ -26,16 +26,38 @@ 26 26 |Text1|Text2|Text3 27 27 {{/excerpt}} 28 28 29 -Example of hidden excerpt 31 +Example of named hidden excerpt: 30 30 31 31 {{code}} 32 -{{excerpt hidden="true"}} 34 +{{excerpt hidden="true" name="myexcerpt"}} 33 33 My hidden content. 34 34 {{/excerpt}} 35 35 {{/code}} 36 36 37 -The result is the following 39 +The result is the following: 38 38 39 -{{excerpt hidden="true"}} 41 +{{excerpt hidden="true" name="myexcerpt"}} 40 40 My hidden content. 41 41 {{/excerpt}} 44 + 45 +(yes, nothing, this is intended!) 46 + 47 +Let's include this hidden excerpt: 48 + 49 +{{code}} 50 +{{excerpt-include 0="Excerpt" name="myexcerpt"/}} 51 +{{/code}} 52 + 53 +Result: 54 + 55 +{{excerpt-include 0="Excerpt" name="myexcerpt"/}} 56 + 57 +Without the panel: 58 + 59 +{{code}} 60 +{{excerpt-include 0="Excerpt" name="myexcerpt" nopanel="true"/}} 61 +{{/code}} 62 + 63 +Result: 64 + 65 +{{excerpt-include 0="Excerpt" name="myexcerpt" nopanel="true"/}}
- XWiki.WikiMacroClass[0]
-
- Makro-Code
-
... ... @@ -1,16 +1,25 @@ 1 +{{velocity output="false"}} 2 +#macro (executeMacro) 3 + #set($hidden = $wikimacro.parameters.get('hidden')) 4 + #if("$!hidden" != 'true') 5 + #set($outputType = $wikimacro.parameters.get('atlassian-macro-output-type')) 6 + #set($displayAsBlock = "$!outputType" != '' && $outputType.toLowerCase() == 'block') 7 + #if ($displayAsBlock) 8 + 9 + {{wikimacrocontent /}} 10 + 11 + #else{{wikimacrocontent /}}#end## 12 + #end## 13 +#end 14 +{{/velocity}} 15 + 1 1 {{velocity}} 2 -## BLOCK / INLINE 3 -#set($outputType = $wikimacro.parameters.get('atlassian-macro-output-type')) 4 -#set($hidden = $wikimacro.parameters.get('hidden')) 5 -#set($displayAsBlock = "$!outoutType" == '' && $outputType.toLowerCase() == 'block') 6 -#if("$!hidden" == 'true') 7 - (% class="hidden" %) 17 +## We need to check if there is a valid license because the macro is registered even if the user doesn't have view right 18 +## on the macro definition page. See XWIKI-14828: Rendering macros defined in wiki pages are available to users that 19 +## don't have view right on those pages. 20 +#if ($services.promacrolicensing.hasLicensureForEntity($xcontext.macro.doc.documentReference)) 21 + #executeMacro## 22 +#else 23 + {{missingLicenseMessage extensionName="proMacros.extension.name"/}} 8 8 #end 9 -#if($displayAsBlock) 10 - ((( 11 -#end 12 - $xcontext.macro.content 13 -#if($displayAsBlock) 14 - ))) 15 -#end 16 16 {{/velocity}} - Makroinhaltstyp
-
... ... @@ -1,0 +1,1 @@ 1 +Wiki - Standardkategorie
-
... ... @@ -1,1 +1,0 @@ 1 -content
- XWiki.WikiMacroParameterClass[0]
-
- Parameter verpflichtend
-
... ... @@ -1,0 +1,1 @@ 1 +Nein
- XWiki.WikiMacroParameterClass[1]
-
- Parameter-Beschreibung
-
... ... @@ -1,0 +1,1 @@ 1 +Whether the excerpt should be hidden from the page - Parameter verpflichtend
-
... ... @@ -1,0 +1,1 @@ 1 +Nein
- XWiki.WikiMacroParameterClass[2]
-
- Parameter-Beschreibung
-
... ... @@ -1,0 +1,1 @@ 1 +The name of the excerpt, for named includes. - Parameter verpflichtend
-
... ... @@ -1,0 +1,1 @@ 1 +Nein - Parameter-Name
-
... ... @@ -1,0 +1,1 @@ 1 +name
- XWiki.WikiMacroParameterClass[3]
-
- Parameter-Vorgabe
-
... ... @@ -1,0 +1,1 @@ 1 +false - Parameter-Beschreibung
-
... ... @@ -1,0 +1,1 @@ 1 +Allow this excerpt to be seen even for people who don't have view rights on this page when included - Parameter verpflichtend
-
... ... @@ -1,0 +1,1 @@ 1 +Nein - Parameter-Name
-
... ... @@ -1,0 +1,1 @@ 1 +allowUnprivilegedInclude - Parameter-Typ
-
... ... @@ -1,0 +1,1 @@ 1 +java.lang.Boolean