Wiki source code of Syntax Experiments Proposal 2
Last modified by Vincent Massol on 2024/11/19 16:13
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | {{velocity output="false"}} | ||
| 2 | #set($syntaxFilterMap = { | ||
| 3 | '1.0': ['syntaxFilter10', 'syntaxActive10', 'syntax10', 'Show syntax 1.0'], | ||
| 4 | '2.0': ['syntaxFilter20', 'syntaxActive20', 'syntax20', 'Show syntax 2.0'], | ||
| 5 | '2.1': ['syntaxFilter21', 'syntaxActive21', 'syntax21', 'Show syntax 2.1'] | ||
| 6 | }) | ||
| 7 | |||
| 8 | #macro(syntaxHeader $syntaxes $default) | ||
| 9 | (% class="syntaxExample #if('$!syntaxFilterMap.get($default).get(1)' != '')$syntaxFilterMap.get($default).get(1)#end" summary="Table displaying Definition Lists feature syntax"%) | ||
| 10 | |=Feature|=(% class="syntaxHeader" width="50%"%)XWiki Syntax<span class="hidden separator">:</span> | ||
| 11 | #foreach ($syntax in $syntaxes.split(",")) | ||
| 12 | #if("$!syntaxFilterMap.get($syntax)" != '') | ||
| 13 | <span class="$syntaxFilterMap.get($syntax).get(0)" title="$syntaxFilterMap.get($syntax).get(3)"> v$syntax#if("$!default" == "$syntax")<span class="hidden"> (default)</span>#end<span class="hidden separator">, </span></span> | ||
| 14 | #end | ||
| 15 | #end |=Result | ||
| 16 | #end | ||
| 17 | |||
| 18 | #macro(syntaxCode $code) | ||
| 19 | #foreach ($syntax in $code.keySet()) | ||
| 20 | <small class="hidden">XWiki Syntax: v$syntax</small> | ||
| 21 | #foreach ($line in $code.get($syntax)) | ||
| 22 | #if("$!syntaxFilterMap.get($syntax)" != '') | ||
| 23 | <div class="$syntaxFilterMap.get($syntax).get(2)">{{{$line}}}</div> | ||
| 24 | #end | ||
| 25 | #end | ||
| 26 | <br class="hidden"/> | ||
| 27 | #end | ||
| 28 | #end | ||
| 29 | |||
| 30 | #macro(syntaxResult $result) | ||
| 31 | #foreach ($syntax in $result.keySet()) | ||
| 32 | #foreach ($line in $result.get($syntax)) | ||
| 33 | $line | ||
| 34 | #end | ||
| 35 | #end | ||
| 36 | #end | ||
| 37 | |||
| 38 | #macro(syntaxEntry $feature $code $result) | ||
| 39 | |$feature|((( | ||
| 40 | #syntaxCode($code) | ||
| 41 | )))|((( | ||
| 42 | #syntaxResult($result) | ||
| 43 | ))) | ||
| 44 | #end | ||
| 45 | |||
| 46 | {{/velocity}} | ||
| 47 | |||
| 48 | {{velocity}} | ||
| 49 | {{html wiki="true"}} | ||
| 50 | = Definition Lists = | ||
| 51 | |||
| 52 | #syntaxHeader('2.0,1.0' '2.0') | ||
| 53 | #syntaxEntry( | ||
| 54 | 'Standard definition' | ||
| 55 | { '1.0': ['<dl>', | ||
| 56 | ' <dt>term</dt>', | ||
| 57 | ' <dd>definition</dd>', | ||
| 58 | '</dl>'], | ||
| 59 | '2.0': ['; term', | ||
| 60 | ': definition'] | ||
| 61 | }{ | ||
| 62 | 'all': ['; term', | ||
| 63 | ': definition'] | ||
| 64 | } | ||
| 65 | ) | ||
| 66 | #syntaxEntry( | ||
| 67 | 'Nested definitions' | ||
| 68 | { '1.0': ['<dl>', | ||
| 69 | ' <dt>term1</dt>', | ||
| 70 | ' <dd>definition1', | ||
| 71 | ' <dl>', | ||
| 72 | ' <dt>term2</dt>', | ||
| 73 | ' <dd>definition2</dd>', | ||
| 74 | ' </dl>', | ||
| 75 | ' </dd>', | ||
| 76 | '</dl>'], | ||
| 77 | '2.0': ['; term1', | ||
| 78 | ': definition1', | ||
| 79 | ' :; term2', | ||
| 80 | ' :: definition2' | ||
| 81 | ] | ||
| 82 | }{ | ||
| 83 | 'all': ['; term1', | ||
| 84 | ': definition1', | ||
| 85 | ':; term2', | ||
| 86 | ':: definition2'] | ||
| 87 | } | ||
| 88 | ) | ||
| 89 | #syntaxEntry( | ||
| 90 | 'Parametrized definition' | ||
| 91 | { '1.0': ['<dl style="color:blue">', | ||
| 92 | ' <dt>term</dt>', | ||
| 93 | ' <dd>definition</dd>', | ||
| 94 | '</dl>'], | ||
| 95 | '2.0': ['(% style="color:blue" %)', | ||
| 96 | '; term', | ||
| 97 | ': definition'] | ||
| 98 | }{ | ||
| 99 | 'all': ['(% style="color:blue" %)', | ||
| 100 | '; term', | ||
| 101 | ': definition'] | ||
| 102 | } | ||
| 103 | ) | ||
| 104 | {{/html}} | ||
| 105 | |||
| 106 | {{html wiki="true"}} | ||
| 107 | = Definition Lists (old form) = | ||
| 108 | |||
| 109 | (% style="width:99%" summary="Table displaying Definition Lists feature syntax" %) | ||
| 110 | |=Feature|=XWiki Syntax 1.0|=XWiki Syntax 2.0|=Result | ||
| 111 | |Standard definition|((({{{ | ||
| 112 | <dl> | ||
| 113 | <dt>term</dt> | ||
| 114 | <dd>definition</dd> | ||
| 115 | </dl> | ||
| 116 | }}})))|((({{{ | ||
| 117 | ; term | ||
| 118 | : definition | ||
| 119 | }}})))|((( | ||
| 120 | ; term | ||
| 121 | : definition | ||
| 122 | ))) | ||
| 123 | |Nested definitions|((({{{ | ||
| 124 | <dl> | ||
| 125 | <dt>term1</dt> | ||
| 126 | <dd>definition1 | ||
| 127 | <dl> | ||
| 128 | <dt>term2</dt> | ||
| 129 | <dd>definition2</dd> | ||
| 130 | </dl> | ||
| 131 | </dd> | ||
| 132 | </dl> | ||
| 133 | }}})))|((({{{ | ||
| 134 | ; term1 | ||
| 135 | : definition1 | ||
| 136 | :; term2 | ||
| 137 | :: definition2 | ||
| 138 | }}})))|((( | ||
| 139 | ; term1 | ||
| 140 | : definition1 | ||
| 141 | :; term2 | ||
| 142 | :: definition2 | ||
| 143 | ))) | ||
| 144 | |Parametrized definition|((({{{ | ||
| 145 | <dl style="color:blue"> | ||
| 146 | <dt>term</dt> | ||
| 147 | <dd>definition</dd> | ||
| 148 | </dl> | ||
| 149 | }}})))|((({{{ | ||
| 150 | (% style="color:blue" %) | ||
| 151 | ; term | ||
| 152 | : definition | ||
| 153 | }}})))|((( | ||
| 154 | (% style="color:blue" %) | ||
| 155 | ; term | ||
| 156 | : definition | ||
| 157 | ))) | ||
| 158 | |||
| 159 | {{/html}} | ||
| 160 | {{/velocity}} |