... |
... |
@@ -12,7 +12,7 @@ |
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**: |
|
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 |
16 |
|
17 |
17 |
--- |
18 |
18 |
|
... |
... |
@@ -20,19 +20,25 @@ |
20 |
20 |
|
21 |
21 |
Show how a macro works without cluttering the page with raw syntax. |
22 |
22 |
|
23 |
|
- |
|
23 |
+```xwiki |
24 |
24 |
== Gallery Macro == |
25 |
|
- |
26 |
26 |
{{example}} |
27 |
|
- |
28 |
28 |
{{gallery}} |
29 |
29 |
[[image:photo1.jpg]] |
30 |
30 |
[[image:photo2.jpg]] |
31 |
31 |
{{/gallery}} |
32 |
|
- |
33 |
33 |
{{/example}} |
|
31 |
+``` |
34 |
34 |
|
|
33 |
+**Why it's good:** New users see both source and result without confusion. |
35 |
35 |
|
|
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 |
36 |
36 |
== Boilerplate Box == |
37 |
37 |
{{example}} |
38 |
38 |
{{box cssClass="highlight"}} |
... |
... |
@@ -39,7 +39,15 @@ |
39 |
39 |
Insert your highlighted content here. |
40 |
40 |
{{/box}} |
41 |
41 |
{{/example}} |
|
48 |
+``` |
42 |
42 |
|
|
50 |
+--- |
|
51 |
+ |
|
52 |
+## 🎓 3. **Educational Tutorials (e.g., Velocity or Groovy)** |
|
53 |
+ |
|
54 |
+Teach scripting with real, live code examples. |
|
55 |
+ |
|
56 |
+```xwiki |
43 |
43 |
== Velocity Greeting == |
44 |
44 |
{{example}} |
45 |
45 |
{{velocity}} |
... |
... |
@@ -47,8 +47,15 @@ |
47 |
47 |
Hello, $name! |
48 |
48 |
{{/velocity}} |
49 |
49 |
{{/example}} |
|
64 |
+``` |
50 |
50 |
|
|
66 |
+--- |
51 |
51 |
|
|
68 |
+## 🎯 4. **Comparing Macro Parameters** |
|
69 |
+ |
|
70 |
+Demonstrate how different macro parameters change output—side-by-side. |
|
71 |
+ |
|
72 |
+```xwiki |
52 |
52 |
== Info vs Warning == |
53 |
53 |
{{example}} |
54 |
54 |
{{info}}This is an info box.{{/info}} |
... |
... |
@@ -55,11 +55,29 @@ |
55 |
55 |
|
56 |
56 |
{{warning}}This is a warning box.{{/warning}} |
57 |
57 |
{{/example}} |
|
79 |
+``` |
58 |
58 |
|
|
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 |
59 |
59 |
== Footnote Demo == |
|
89 |
+{{example}} |
|
90 |
+This claim needs a source{{footnote}}Here it is.{{/footnote}}. |
|
91 |
+{{putFootnotes/}} |
|
92 |
+{{/example}} |
|
93 |
+``` |
60 |
60 |
|
61 |
|
-footnote |
|
95 |
+--- |
62 |
62 |
|
|
97 |
+## 🧪 6. **Live Scripting Playgrounds** |
|
98 |
+ |
|
99 |
+Embed small self-contained scripting playgrounds where users can view or modify dynamic output. |
|
100 |
+ |
|
101 |
+```xwiki |
63 |
63 |
== Groovy Lookup == |
64 |
64 |
{{example}} |
65 |
65 |
{{groovy}} |
... |
... |
@@ -67,8 +67,30 @@ |
67 |
67 |
println("Current time: " + now) |
68 |
68 |
{{/groovy}} |
69 |
69 |
{{/example}} |
|
109 |
+``` |
70 |
70 |
|
|
111 |
+--- |
71 |
71 |
|
|
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 |
72 |
72 |
== Expandable Summary == |
73 |
73 |
{{example}} |
74 |
74 |
{{expandable summary="🧠 Study Summary"}} |
... |
... |
@@ -75,7 +75,15 @@ |
75 |
75 |
Key findings go here. |
76 |
76 |
{{/expandable}} |
77 |
77 |
{{/example}} |
|
139 |
+``` |
78 |
78 |
|
|
141 |
+--- |
|
142 |
+ |
|
143 |
+## 🔧 9. **Syntax Training: Bad vs Good** |
|
144 |
+ |
|
145 |
+Side-by-side "Do this, not that" with toggles. |
|
146 |
+ |
|
147 |
+```xwiki |
79 |
79 |
== List Formatting == |
80 |
80 |
{{example}} |
81 |
81 |
*Bad formatting* |
... |
... |
@@ -84,7 +84,13 @@ |
84 |
84 |
* Consistent bullet style |
85 |
85 |
* Indented items properly |
86 |
86 |
{{/example}} |
|
156 |
+``` |
87 |
87 |
|
|
158 |
+--- |
|
159 |
+ |
|
160 |
+## 💡 Bonus Tip: Combine `{{example}}` + `{{code}}` for Highlighted Snippets |
|
161 |
+ |
|
162 |
+```xwiki |
88 |
88 |
== Python Code == |
89 |
89 |
{{example}} |
90 |
90 |
{{code language="python"}} |
... |
... |
@@ -92,18 +92,13 @@ |
92 |
92 |
print("Hello World") |
93 |
93 |
{{/code}} |
94 |
94 |
{{/example}} |
|
170 |
+``` |
95 |
95 |
|
96 |
|
-== Audio Embedding == |
97 |
|
-{{example}} |
|
172 |
+--- |
98 |
98 |
|
99 |
|
-{{html}} |
100 |
|
-<audio controls> |
101 |
|
- <source src="/bin/download/Sandbox/TestPage2/Anti-Black%20racial%20slur%20was%20found%20written%20on%20high%20school%20desk%20in%20Rockville.mp3" type="audio/mpeg"> |
102 |
|
- Your browser does not support the audio element. |
103 |
|
-</audio> |
104 |
|
-{{/html}} |
105 |
|
-{{/example}} |
|
174 |
+Want me to generate a panel with these uses or make a macro gallery page pre-filled with them? |
106 |
106 |
|
|
176 |
+ |
107 |
107 |
This page covers all the essential steps and tips you need to create great content in XWiki without any confusion. |
108 |
108 |
|
109 |
109 |
== == |