Wiki source code of [AUTOMATED] Insert Code macro with a different source [Since XWiki 14.10.2]
Last modified by Ilie Andriuta on 2024/06/27 16:29
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | 1. Create a page with a velocity script, having a name, like: | ||
| 2 | #set($myvar = "some content to highlight") | ||
| 3 | 1. Edit the page in CKEditor mode | ||
| 4 | 1. Click on 'Insert' Button (the "+" icon) | ||
| 5 | 1. Click on 'Other Macros' | ||
| 6 | 1. Search for 'Code' and click 'Select' | ||
| 7 | 1. On the 'Source' box, insert the name of the previously created velocity script, e.g. "script:myvar" | ||
| 8 | 1. Click 'Submit' | ||
| 9 | |||
| 10 | or just use in Wiki/Source mode: | ||
| 11 | |||
| 12 | {~{~velocity}~}~ | ||
| 13 | #set($myvar = "some content to highlight") | ||
| 14 | {~{~/velocity}~}~ | ||
| 15 | |||
| 16 | |||
| 17 | {~{~code source="script:myvar"}~}~{~{~/code}~}~ | ||
| 18 | |||
| 19 | 8. Click 'Save & View' |