| 28 | |
| 29 | == ASCII Kästen == |
| 30 | {{{ |
| 31 | |
| 32 | └ ┘ ┌ ┐ |
| 33 | |
| 34 | ─ │ |
| 35 | |
| 36 | ┬ ┴ ├ ┤ |
| 37 | |
| 38 | ┼ |
| 39 | |
| 40 | ± ≥ ≤ ÷ ≈ √ ~ |
| 41 | |
| 42 | ╭ ╮ ╯ ╰ |
| 43 | |
| 44 | ╭────────────────────────╮ |
| 45 | │ Das ist ein Testbutton │ |
| 46 | ╰────────────────────────╯ |
| 47 | |
| 48 | Stack |
| 49 | |
| 50 | │ 3 │ |
| 51 | │ + │ |
| 52 | │ C │ |
| 53 | │ x │ |
| 54 | └───┘ |
| 55 | }}} |
| 56 | |
| 57 | == SVG == |
| 58 | |
| 59 | {{{ |
| 60 | #!html |
| 61 | <style> |
| 62 | .txt { |
| 63 | stroke: black; |
| 64 | fill: black; |
| 65 | } |
| 66 | |
| 67 | .txtred { |
| 68 | stroke: red; |
| 69 | fill: red; |
| 70 | } |
| 71 | |
| 72 | .mark { |
| 73 | fill: orange; |
| 74 | stroke: none; |
| 75 | } |
| 76 | |
| 77 | .feld { |
| 78 | fill: none; |
| 79 | stroke: black; |
| 80 | stroke-width: 1px; |
| 81 | } |
| 82 | |
| 83 | .blockframe { |
| 84 | fill: none; |
| 85 | stroke: black; |
| 86 | stroke-width: 3px; |
| 87 | } |
| 88 | </style> |
| 89 | |
| 90 | <svg width="0px" viewbox="0 0 0 0"> |
| 91 | <defs> |
| 92 | <rect id="feld" x="0" y="0" width="20" height="20" class="feld" /> |
| 93 | <rect id="mark" x="0" y="0" width="20" height="20" class="mark" /> |
| 94 | |
| 95 | <g id="block"> |
| 96 | <use xlink:href="#feld" x="0" y="0" /> |
| 97 | <use xlink:href="#feld" x="20" y="0" /> |
| 98 | <use xlink:href="#feld" x="40" y="0" /> |
| 99 | <use xlink:href="#feld" x="0" y="20" /> |
| 100 | <use xlink:href="#feld" x="20" y="20" /> |
| 101 | <use xlink:href="#feld" x="40" y="20" /> |
| 102 | <use xlink:href="#feld" x="0" y="40" /> |
| 103 | <use xlink:href="#feld" x="20" y="40" /> |
| 104 | <use xlink:href="#feld" x="40" y="40" /> |
| 105 | <rect x="0" y="0" width="60" height="60" class="blockframe" /> |
| 106 | </g> |
| 107 | |
| 108 | <g id="sudoku"> |
| 109 | <use xlink:href="#block" x="0" y="0" /> |
| 110 | <use xlink:href="#block" x="60" y="0" /> |
| 111 | <use xlink:href="#block" x="120" y="0" /> |
| 112 | <use xlink:href="#block" x="0" y="60" /> |
| 113 | <use xlink:href="#block" x="60" y="60" /> |
| 114 | <use xlink:href="#block" x="120" y="60" /> |
| 115 | <use xlink:href="#block" x="0" y="120" /> |
| 116 | <use xlink:href="#block" x="60" y="120" /> |
| 117 | <use xlink:href="#block" x="120" y="120" /> |
| 118 | </g> |
| 119 | </defs> |
| 120 | </svg> |
| 121 | }}} |
| 122 | |
| 123 | {{{ |
| 124 | #!html |
| 125 | <svg width="184px" viewbox="0 0 184 184" preserveAspectRatio="xMinYMin"> |
| 126 | |
| 127 | <use xlink:href="#mark" x="2" y="2" /> |
| 128 | <use xlink:href="#mark" x="22" y="22" /> |
| 129 | <use xlink:href="#mark" x="162" y="142" /> |
| 130 | |
| 131 | <use xlink:href="#sudoku" x="2" y="2" /> |
| 132 | |
| 133 | <text x="8" y="17" class="txt">2</text> |
| 134 | <text x="8" y="57" class="txtred">7</text> |
| 135 | |
| 136 | Ihr Browser kann kein SVG. |
| 137 | </svg> |
| 138 | }}} |
| 139 | |
| 140 | == !JavaScript == |
| 141 | {{{ |
| 142 | #!html |
| 143 | <div id="testdiv" onclick="klickTest();">Das ist das Test-DIV. Wenn man draufklickt wird ein Script ausgeführt.</div> |
| 144 | <script> |
| 145 | function klickTest() { |
| 146 | alert("Test"); |
| 147 | } |
| 148 | </script> |
| 149 | }}} |
| 150 | |
| 151 | Quellcode: |
| 152 | {{{ |
| 153 | {{{ |
| 154 | #!html |
| 155 | <div id="testdiv" onclick="klickTest();">Das ist das Test-DIV. Wenn man draufklickt wird ein Script ausgeführt.</div> |
| 156 | <script> |
| 157 | function klickTest() { |
| 158 | alert("Test"); |
| 159 | } |
| 160 | </script> |
| 161 | }}} |
| 162 | }}} |
| 163 | |
| 164 | == Image URL == |
| 165 | |
| 166 | [[http://dataurl.net/#dataurlmaker|Data Image URL Maker]] |
| 167 | |
| 168 | [[Image("data:image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAwAAAC8IyPqcvt3wCcDkiLc7C0qwyGHhSWpjQu5yqmCYsapyuvUUlvONmOZtfzgFzByTB10QgxOR0TqBQejhRNzOfkVJ+5YiUqrXF5Y5lKh/DeuNcP5yLWGsEbtLiOSpa/TPg7JpJHxyendzWTBfX0cxOnKPjgBzi4diinWGdkF8kjdfnycQZXZeYGejmJlZeGl9i2icVqaNVailT6F5iJ90m6mvuTS4OK05M0vDk0Q4XUtwvKOzrcd3iq9uisF81M1OIcR7lEewwcLp7tuNNkM3uNna3F2JQFo97Vriy/Xl4/f1cf5VWzXyym7PHhhx4dbgYKAAA7")]] |
| 169 | |
| 170 | |
| 171 | = Einbindung von Quellcode per !CodeExampleMacro = |
| 172 | |
| 173 | == Nutzung == |
| 174 | Innerhalb einer Wiki-Seite kann das Makro nach folgendem Muster aufgerufen werden: |
| 175 | |
| 176 | {{{ |
| 177 | {{{ |
| 178 | #!CodeExample |
| 179 | ## parameter = value |
| 180 | ... |
| 181 | ## parameter = value |
| 182 | #!language |
| 183 | ...code... |
| 184 | }}} |
| 185 | }}} |
| 186 | |
| 187 | Die folgenden Parameter stehen zur Verfügung: |
| 188 | |
| 189 | type:: |
| 190 | Bestimmt den Typ des Beispiels: `simple` (Standardwert), `good` oder `bad` |
| 191 | |
| 192 | title:: |
| 193 | Ändert den Titel des Beispiels |
| 194 | |
| 195 | repo:: |
| 196 | Name des Repository-Aliases, in welchem gesucht werden soll |
| 197 | |
| 198 | path:: |
| 199 | Pfad zu einer Datei im Repository |
| 200 | |
| 201 | regex:: |
| 202 | Regulärer Ausdruck, der den Beginn des Codebeispiels angibt |
| 203 | |
| 204 | lines:: |
| 205 | Anzahl der Zeilen, die gezeigt werden sollen |
| 206 | |
| 207 | == Beispiele == |
| 208 | |
| 209 | === Simpler Kasten === |
| 210 | {{{ |
| 211 | {{{ |
| 212 | #!CodeExample |
| 213 | ## title = Beispiel |
| 214 | ## repo = Java_Quellcode_SOOP |
| 215 | ## path = /vl/arrays/SudokuSolver.java |
| 216 | ## regex = zeileOK |
| 217 | ## lines = 8 |
| 218 | #!java |
| 219 | }}} |
| 220 | }}} |
| 221 | |
| 222 | {{{ |
| 223 | #!CodeExample |
| 224 | ## title = Beispiel |
| 225 | ## repo = Java_Quellcode_SOOP |
| 226 | ## path = /vl/arrays/SudokuSolver.java |
| 227 | ## regex = zeileOK |
| 228 | ## lines = 8 |
| 229 | #!java |
| 230 | }}} |
| 231 | |
| 232 | === Roter Kasten === |
| 233 | {{{ |
| 234 | {{{ |
| 235 | #!CodeExample |
| 236 | ## type = bad |
| 237 | ## title = Negativbeispiel |
| 238 | ## repo = Java_Quellcode_SOOP |
| 239 | ## path = /vl/arrays/SudokuSolver.java |
| 240 | ## regex = sudokuLangsam |
| 241 | ## lines = 12 |
| 242 | #!java |
| 243 | }}} |
| 244 | }}} |
| 245 | |
| 246 | {{{ |
| 247 | #!CodeExample |
| 248 | ## type = bad |
| 249 | ## title = Negativbeispiel |
| 250 | ## repo = Java_Quellcode_SOOP |
| 251 | ## path = /vl/arrays/SudokuSolver.java |
| 252 | ## regex = sudokuLangsam |
| 253 | ## lines = 12 |
| 254 | #!java |
| 255 | }}} |
| 256 | |
| 257 | === Grüner Kasten === |
| 258 | {{{ |
| 259 | {{{ |
| 260 | #!CodeExample |
| 261 | ## type = good |
| 262 | ## repo = Java_Quellcode_SOOP |
| 263 | ## path = /vl/arrays/SudokuSolver.java |
| 264 | ## regex = sudokuSchnell |
| 265 | ## lines = 12 |
| 266 | #!java |
| 267 | }}} |
| 268 | }}} |
| 269 | |
| 270 | {{{ |
| 271 | #!CodeExample |
| 272 | ## type = good |
| 273 | ## repo = Java_Quellcode_SOOP |
| 274 | ## path = /vl/arrays/SudokuSolver.java |
| 275 | ## regex = sudokuSchnell |
| 276 | ## lines = 12 |
| 277 | #!java |
| 278 | }}} |
| 279 | |
| 280 | === Verweis auf Revisionsnummer mit @ === |
| 281 | {{{ |
| 282 | {{{ |
| 283 | #!CodeExample |
| 284 | ## title = Beispiel |
| 285 | ## repo = Web_Quellcode_FP |
| 286 | ## path = index.html@285 |
| 287 | ## regex = <body> |
| 288 | ## lines = 3 |
| 289 | #!html |
| 290 | }}} |
| 291 | }}} |
| 292 | |
| 293 | {{{ |
| 294 | #!CodeExample |
| 295 | ## title = Beispiel |
| 296 | ## repo = Web_Quellcode_FP |
| 297 | ## path = index.html@285 |
| 298 | ## regex = <body> |
| 299 | ## lines = 3 |
| 300 | #!html |
| 301 | }}} |