... |
... |
@@ -12,6 +12,168 @@ |
12 |
12 |
|
13 |
13 |
== Getting Started with XWiki == |
14 |
14 |
|
|
15 |
+The `{{example}}` macro in XWiki is an underrated powerhouse—great for *teaching*, *showcasing macros*, *hiding complex markup*, and *letting users play with source-output pairs*. Here are some **highly effective and interesting uses**: |
|
16 |
+ |
|
17 |
+--- |
|
18 |
+ |
|
19 |
+## 🧪 1. **Macro Showcase: Source-to-Output Toggle** |
|
20 |
+ |
|
21 |
+Show how a macro works without cluttering the page with raw syntax. |
|
22 |
+ |
|
23 |
+```xwiki |
|
24 |
+== Gallery Macro == |
|
25 |
+{{example}} |
|
26 |
+{{gallery}} |
|
27 |
+[[image:photo1.jpg]] |
|
28 |
+[[image:photo2.jpg]] |
|
29 |
+{{/gallery}} |
|
30 |
+{{/example}} |
|
31 |
+``` |
|
32 |
+ |
|
33 |
+**Why it's good:** New users see both source and result without confusion. |
|
34 |
+ |
|
35 |
+--- |
|
36 |
+ |
|
37 |
+## 📝 2. **Editable Template Snippets** |
|
38 |
+ |
|
39 |
+Use `{{example}}` to store reusable content that users can copy, paste, and modify. |
|
40 |
+ |
|
41 |
+```xwiki |
|
42 |
+== Boilerplate Box == |
|
43 |
+{{example}} |
|
44 |
+{{box cssClass="highlight"}} |
|
45 |
+Insert your highlighted content here. |
|
46 |
+{{/box}} |
|
47 |
+{{/example}} |
|
48 |
+``` |
|
49 |
+ |
|
50 |
+--- |
|
51 |
+ |
|
52 |
+## 🎓 3. **Educational Tutorials (e.g., Velocity or Groovy)** |
|
53 |
+ |
|
54 |
+Teach scripting with real, live code examples. |
|
55 |
+ |
|
56 |
+```xwiki |
|
57 |
+== Velocity Greeting == |
|
58 |
+{{example}} |
|
59 |
+{{velocity}} |
|
60 |
+#set($name = "Visitor") |
|
61 |
+Hello, $name! |
|
62 |
+{{/velocity}} |
|
63 |
+{{/example}} |
|
64 |
+``` |
|
65 |
+ |
|
66 |
+--- |
|
67 |
+ |
|
68 |
+## 🎯 4. **Comparing Macro Parameters** |
|
69 |
+ |
|
70 |
+Demonstrate how different macro parameters change output—side-by-side. |
|
71 |
+ |
|
72 |
+```xwiki |
|
73 |
+== Info vs Warning == |
|
74 |
+{{example}} |
|
75 |
+{{info}}This is an info box.{{/info}} |
|
76 |
+ |
|
77 |
+{{warning}}This is a warning box.{{/warning}} |
|
78 |
+{{/example}} |
|
79 |
+``` |
|
80 |
+ |
|
81 |
+--- |
|
82 |
+ |
|
83 |
+## 🧩 5. **Interactive Data Blocks (TOC, Footnotes, etc.)** |
|
84 |
+ |
|
85 |
+Visually show what happens when you use certain macros together. |
|
86 |
+ |
|
87 |
+```xwiki |
|
88 |
+== Footnote Demo == |
|
89 |
+{{example}} |
|
90 |
+This claim needs a source{{footnote}}Here it is.{{/footnote}}. |
|
91 |
+{{putFootnotes/}} |
|
92 |
+{{/example}} |
|
93 |
+``` |
|
94 |
+ |
|
95 |
+--- |
|
96 |
+ |
|
97 |
+## 🧪 6. **Live Scripting Playgrounds** |
|
98 |
+ |
|
99 |
+Embed small self-contained scripting playgrounds where users can view or modify dynamic output. |
|
100 |
+ |
|
101 |
+```xwiki |
|
102 |
+== Groovy Lookup == |
|
103 |
+{{example}} |
|
104 |
+{{groovy}} |
|
105 |
+def now = new Date() |
|
106 |
+println("Current time: " + now) |
|
107 |
+{{/groovy}} |
|
108 |
+{{/example}} |
|
109 |
+``` |
|
110 |
+ |
|
111 |
+--- |
|
112 |
+ |
|
113 |
+## 📦 7. **Component/API Call Demos** |
|
114 |
+ |
|
115 |
+Useful for devs exploring the API. |
|
116 |
+ |
|
117 |
+```xwiki |
|
118 |
+== Access Current User == |
|
119 |
+{{example}} |
|
120 |
+{{velocity}} |
|
121 |
+Current user: **$xcontext.user** |
|
122 |
+{{/velocity}} |
|
123 |
+{{/example}} |
|
124 |
+``` |
|
125 |
+ |
|
126 |
+--- |
|
127 |
+ |
|
128 |
+## 📘 8. **Expandable Wiki Templates with Output** |
|
129 |
+ |
|
130 |
+Pair `{{example}}` with `{{expandable}}` for full disclosure without visual clutter. |
|
131 |
+ |
|
132 |
+```xwiki |
|
133 |
+== Expandable Summary == |
|
134 |
+{{example}} |
|
135 |
+{{expandable summary="🧠 Study Summary"}} |
|
136 |
+Key findings go here. |
|
137 |
+{{/expandable}} |
|
138 |
+{{/example}} |
|
139 |
+``` |
|
140 |
+ |
|
141 |
+--- |
|
142 |
+ |
|
143 |
+## 🔧 9. **Syntax Training: Bad vs Good** |
|
144 |
+ |
|
145 |
+Side-by-side "Do this, not that" with toggles. |
|
146 |
+ |
|
147 |
+```xwiki |
|
148 |
+== List Formatting == |
|
149 |
+{{example}} |
|
150 |
+*Bad formatting* |
|
151 |
+* use - inconsistently |
|
152 |
+** Good formatting: |
|
153 |
+ * Consistent bullet style |
|
154 |
+ * Indented items properly |
|
155 |
+{{/example}} |
|
156 |
+``` |
|
157 |
+ |
|
158 |
+--- |
|
159 |
+ |
|
160 |
+## 💡 Bonus Tip: Combine `{{example}}` + `{{code}}` for Highlighted Snippets |
|
161 |
+ |
|
162 |
+```xwiki |
|
163 |
+== Python Code == |
|
164 |
+{{example}} |
|
165 |
+{{code language="python"}} |
|
166 |
+def greet(): |
|
167 |
+ print("Hello World") |
|
168 |
+{{/code}} |
|
169 |
+{{/example}} |
|
170 |
+``` |
|
171 |
+ |
|
172 |
+--- |
|
173 |
+ |
|
174 |
+Want me to generate a panel with these uses or make a macro gallery page pre-filled with them? |
|
175 |
+ |
|
176 |
+ |
15 |
15 |
This page covers all the essential steps and tips you need to create great content in XWiki without any confusion. |
16 |
16 |
|
17 |
17 |
== == |
... |
... |
@@ -258,6 +258,10 @@ |
258 |
258 |
{{video url="https://www.youtube.com/watch?v=dQw4w9WgXcQ"/}} |
259 |
259 |
{{/example}} |
260 |
260 |
|
|
423 |
+ |
|
424 |
+== Example Macro == |
|
425 |
+ |
|
426 |
+The example macro displays the output of a macro or script or anything that you like |
261 |
261 |
== Expandable Macro == |
262 |
262 |
|
263 |
263 |
The following example demonstrates how to present complex information cleanly using ` |
... |
... |
@@ -332,3 +332,5 @@ |
332 |
332 |
{{/expandable}} |
333 |
333 |
{{/example}} |
334 |
334 |
|
|
501 |
+ |
|
502 |
+ |