| 1 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | =encoding utf8 | ||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | Quiq::MediaWiki::Markup - MediaWiki Code Generator | ||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | =head1 BASE CLASS | ||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | L<Quiq::Hash> | ||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | Ein Objekt der Klasse repräsentiert einen Generator für das | ||||||||||||||||||||||||||||||||||||||||||
| 16 | MediaWiki-Markup. Die Methoden der Klasse erzeugen den | ||||||||||||||||||||||||||||||||||||||||||
| 17 | Markup-Code, ohne dass man sich um die Details der Syntax kümmern | ||||||||||||||||||||||||||||||||||||||||||
| 18 | muss. Die Implementierung ist nicht vollständig, sondern wird | ||||||||||||||||||||||||||||||||||||||||||
| 19 | nach Bedarf erweitert. | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | =head2 Links | ||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | Das lokale MediaWiki ist erreichbar unter: | ||||||||||||||||||||||||||||||||||||||||||
| 28 | L<http://localhost/mediawiki/> (anmelden als | ||||||||||||||||||||||||||||||||||||||||||
| 29 | Benutzer fs, ggf. apache2ctl start) | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | Homepage: L<https://www.mediawiki.org/> | ||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | Handbuch: L<https://www.mediawiki.org/wiki/Help:Contents> | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | Markup: L<https://www.mediawiki.org/wiki/Help:Formatting> | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | CSS-Regeln: L<https://www.mediawiki.org/wiki/Manual:CSS> | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | Globale Community Site für Wikimedia-Projekte: | ||||||||||||||||||||||||||||||||||||||||||
| 50 | L<https://meta.wikimedia.org/> | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | package Quiq::MediaWiki::Markup; | ||||||||||||||||||||||||||||||||||||||||||
| 59 | 1 | ▶ | use base qw/Quiq::Hash/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | 1 | ▶ | use v5.10; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 64 | 1 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 1 | our $VERSION = '1.240'; | |||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | 1 | ▶ | use Quiq::Unindent; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | 1 | ▶ | use Quiq::Parameters; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | =head2 Konstruktor | ||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | =head3 new() - Instantiiere Markup-Generator | ||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | $gen = $class->new; | ||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | Instantiiere einen MediaWiki Markup Generator und liefere | ||||||||||||||||||||||||||||||||||||||||||
| 86 | eine Referenz auf dieses Objekt zurück. | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | 13 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | 13 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 94 | # @_: @keyVal | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | 13 | my $self = $class->SUPER::new( | |||||||||||||||||||||||||||||||||||||||||
| 97 | # z.Zt. keine Attribute | ||||||||||||||||||||||||||||||||||||||||||
| 98 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 99 | 13 | $self->set(@_); | |||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | 13 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | =head2 Blöcke | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | Der Code von Blöcken wird mit einer Leerzeile am Ende erzeugt, so | ||||||||||||||||||||||||||||||||||||||||||
| 109 | dass alle Blöcke einfach konkateniert werden können. | ||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | =head3 code() - Erzeuge Code-Abschnitt | ||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | $code = $gen->code($text,$withFormatting); | ||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||
| 117 | =head4 Arguments | ||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | =item $text | ||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | Der Text des Code-Blocks | ||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | =item $withFormatting | ||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | Wenn wahr, erlaube Formatierung im Code-Abschnitt. | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | =head4 Returns | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | Markup-Code (String) | ||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | Erzeuge den MediaWiki Markup-Code für einen Code-Block mit dem | ||||||||||||||||||||||||||||||||||||||||||
| 138 | Text $text und liefere diesen zurück. Ist $text undef oder ein | ||||||||||||||||||||||||||||||||||||||||||
| 139 | Leerstring, wird ein Leerstring geliefert. Andernfalls wird $text | ||||||||||||||||||||||||||||||||||||||||||
| 140 | per trim() von einer etwaigen Einrückung befreit, bevor er um | ||||||||||||||||||||||||||||||||||||||||||
| 141 | zwei Leerzeichen eingerückt wird. | ||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | =head4 See Also | ||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | Syntax: L<https://www.mediawiki.org/wiki/Help:Formatting> | ||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | =head4 Examples | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | Text: | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | $gen->code("Dies ist\nein Test."); | ||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | erzeugt | ||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | | Dies ist | ||||||||||||||||||||||||||||||||||||||||||
| 166 | | ein Test. | ||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | Eine Einrückung der Quelle wird automatisch entfernt: | ||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | $gen->code(q~ | ||||||||||||||||||||||||||||||||||||||||||
| 173 | Dies ist | ||||||||||||||||||||||||||||||||||||||||||
| 174 | ein Test. | ||||||||||||||||||||||||||||||||||||||||||
| 175 | ~); | ||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | erzeugt | ||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | | Dies ist | ||||||||||||||||||||||||||||||||||||||||||
| 180 | | ein Test. | ||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 4 | ▶ | sub code { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
code: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | 4 | my ($self,$text,$withFormatting) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | 4 | $text = Quiq::Unindent->trim($text); | |||||||||||||||||||||||||||||||||||||||||
| 192 | 4 | ▶ | if ($text ne '') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | 2 | ▶ | if ($withFormatting) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | $text =~ s/^/ /mg; | |||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||
| 196 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 197 | 2 | $text = "<pre>$text</pre>"; | |||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||
| 199 | 2 | $text .= "\n\n"; | |||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||
| 202 | 4 | return $text; | |||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | =head3 comment() - Erzeuge Kommentar | ||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | $code = $gen->comment($text); | ||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | =head4 Arguments | ||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | =item $text | ||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||
| 219 | Der Text des Kommentars | ||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||
| 221 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | =head4 Returns | ||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | Markup-Code (String) | ||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | Erzeuge den MediaWiki Markup-Code für einen Kommentar mit dem | ||||||||||||||||||||||||||||||||||||||||||
| 230 | Text $text und liefere diesen zurück. Ist $text undef oder ein | ||||||||||||||||||||||||||||||||||||||||||
| 231 | Leerstring, wird ein Leerstring geliefert. Andernfalls wird $text | ||||||||||||||||||||||||||||||||||||||||||
| 232 | per trim() von einer etwaigen Einrückung befreit. | ||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | Ist der Kommentar einzeilig, wird die Kommentar-Klammer auf die | ||||||||||||||||||||||||||||||||||||||||||
| 235 | gleiche Zeile gesetzt: | ||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | <!-- TEXT --> | ||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | Ist der Kommentar mehrzeilig, wird die Kommentar-Klammer auf | ||||||||||||||||||||||||||||||||||||||||||
| 240 | separate Zeilen gesetzt und der Text um zwei Leerzeichen | ||||||||||||||||||||||||||||||||||||||||||
| 241 | eingerückt: | ||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||
| 243 | <!-- | ||||||||||||||||||||||||||||||||||||||||||
| 244 | TEXT | ||||||||||||||||||||||||||||||||||||||||||
| 245 | --> | ||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | =head4 See Also | ||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||
| 251 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||
| 253 | Syntax: L<https://www.mediawiki.org/wiki/Help:Formatting> | ||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | =head4 Examples | ||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||
| 259 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||
| 263 | Einzeiliger Kommentar: | ||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||
| 265 | $gen->comment('Dies ist ein Kommentar'); | ||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||
| 267 | erzeugt | ||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | <!-- Dies ist ein Kommentar --> | ||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||
| 273 | Mehrzeiliger Kommentar: | ||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||
| 275 | $gen->comment(q~ | ||||||||||||||||||||||||||||||||||||||||||
| 276 | Dies ist | ||||||||||||||||||||||||||||||||||||||||||
| 277 | ein Kommentar | ||||||||||||||||||||||||||||||||||||||||||
| 278 | ~); | ||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | erzeugt | ||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||
| 282 | <!-- | ||||||||||||||||||||||||||||||||||||||||||
| 283 | Dies ist | ||||||||||||||||||||||||||||||||||||||||||
| 284 | ein Kommentar | ||||||||||||||||||||||||||||||||||||||||||
| 285 | --> | ||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||
| 289 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||
| 293 | 4 | ▶ | sub comment { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
comment: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 294 | 4 | my ($self,$text) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||
| 296 | 4 | my $code = Quiq::Unindent->trim($text); | |||||||||||||||||||||||||||||||||||||||||
| 297 | 4 | ▶ | if ($code ne '') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | 2 | ▶ | if ($code =~ tr/\n//) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | # Mehrzeiliger Kommentar | ||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | 1 | $code =~ s/^/ /mg; | |||||||||||||||||||||||||||||||||||||||||
| 302 | 1 | $code = "<!--\n$code\n-->\n"; | |||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||
| 304 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 305 | # Einzeilige Kommentar | ||||||||||||||||||||||||||||||||||||||||||
| 306 | 1 | $code = "<!-- $code -->\n"; | |||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||
| 308 | # $code .= "\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||
| 311 | 4 | return $code; | |||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||
| 314 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||
| 316 | =head3 horizontalRule() - Erzeuge horizontale Trennline | ||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||
| 318 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||
| 320 | $code = $gen->horizontalRule; | ||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||
| 322 | =head4 Returns | ||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||
| 324 | Markup-Code (String) | ||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||
| 326 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||
| 328 | Erzeuge den MediaWiki Markup-Code für eine horizontale Trennline | ||||||||||||||||||||||||||||||||||||||||||
| 329 | und liefere diesen zurück. | ||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||
| 331 | =head4 See Also | ||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||
| 333 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||
| 335 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||
| 337 | Syntax: L<https://www.mediawiki.org/wiki/Help:Formatting> | ||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | =head4 Example | ||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||
| 343 | $gen->horizontalRule; | ||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||
| 345 | erzeugt | ||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | ---- | ||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||
| 349 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||
| 351 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||
| 353 | 1 | ▶ | sub horizontalRule { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
horizontalRule: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 354 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 355 | 1 | return "----\n\n"; | |||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||
| 358 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | =head3 image() - Erzeuge Bild | ||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||
| 364 | $code = $gen->image(@keyVal); | ||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||
| 366 | =head4 Options | ||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||
| 368 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||
| 370 | =item align => $align | ||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||
| 372 | Mögliche Werte: left, right, center, none. | ||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||
| 374 | =item alt => $str | ||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||
| 376 | Alternativer Text. | ||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||
| 378 | =item border => $bool | ||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||
| 380 | Umrandung. | ||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||
| 382 | =item caption => $str | ||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | Bildbeschriftung. | ||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||
| 386 | =item file => $file | ||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||
| 388 | (Pflichtangabe) Name der Datei. Hier wird nur der Dateiname, bestehend | ||||||||||||||||||||||||||||||||||||||||||
| 389 | aus NAME.EXT benötigt. Ein etwaiger Pfad, sofern vorhanden, wird entfernt. | ||||||||||||||||||||||||||||||||||||||||||
| 390 | Die Datei muss zuvor ins MediaWiki hochgeladen worden sein. | ||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||
| 392 | =item format => $format | ||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||
| 394 | Mögliche Werte: frameless, frame, thumb. | ||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||
| 396 | =item height => $height | ||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||
| 398 | Höhe des Bildes. | ||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||
| 400 | =item link => $url | ||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||
| 402 | Link, mit das Bild hinterlegt wird. | ||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||
| 404 | =item page => $n | ||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||
| 406 | Seitennumer im Falle eines PDF. | ||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||
| 408 | =item valign => $valign | ||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||
| 410 | Mögliche Werte: baseline, sub, super, top, text-top, middle, bottom, | ||||||||||||||||||||||||||||||||||||||||||
| 411 | text-bottom. | ||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||
| 413 | =item width => $width | ||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||
| 415 | Breite des Bildes. | ||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||
| 417 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||
| 419 | =head4 Returns | ||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||
| 421 | Markup-Code (String) | ||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||
| 423 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||
| 425 | Erzeuge den MediaWiki Markup-Code für ein Bild und liefere diesen zurück. | ||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||
| 427 | =head4 See Also | ||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||
| 429 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||
| 431 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||
| 433 | Syntax: L<https://www.mediawiki.org/wiki/Help:Images> | ||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||
| 435 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||
| 437 | =head4 Example | ||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||
| 439 | $gen->image( | ||||||||||||||||||||||||||||||||||||||||||
| 440 | file => 'Ein_testbild.png', | ||||||||||||||||||||||||||||||||||||||||||
| 441 | width => 1200, | ||||||||||||||||||||||||||||||||||||||||||
| 442 | height => 900, | ||||||||||||||||||||||||||||||||||||||||||
| 443 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||
| 445 | erzeugt | ||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||
| 447 | [[File:Ein_testbild.png|1200x900px]] | ||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||
| 449 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||
| 451 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||
| 453 | 2 | ▶ | sub image { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
image: called CC=11 SCAR=24.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 454 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||
| 456 | 2 | my $opt = Quiq::Parameters->extractPropertiesToObject(\@_, | |||||||||||||||||||||||||||||||||||||||||
| 457 | align => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 458 | alt => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 459 | border => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 460 | caption => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 461 | file => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 462 | format => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 463 | height => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 464 | link => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 465 | page => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 466 | valign => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 467 | width => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 468 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||
| 470 | 2 | push my @arr,sprintf 'File:%s',$opt->file; | |||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||
| 472 | 2 | my $width = $opt->width; | |||||||||||||||||||||||||||||||||||||||||
| 473 | 2 | my $height = $opt->height; | |||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||
| 475 | 2 | ▶ | if ($width && $height) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition66%2/3
$width and $height
MC/DC50%1/2
$width and $height
$width
$height
Truth table66%2/3
A and B
A= $widthB= $height
| |||||||||||||||||||||||||||||||||||||||||||
| 476 | 1 | push @arr,"${width}x${height}px"; | |||||||||||||||||||||||||||||||||||||||||
| 477 | } | ||||||||||||||||||||||||||||||||||||||||||
| 478 | elsif ($width) { | ||||||||||||||||||||||||||||||||||||||||||
| 479 | 1 | push @arr,"${width}px"; | |||||||||||||||||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||||||||||||||||
| 481 | elsif ($height) { | ||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | push @arr,"x${height}px"; | |||||||||||||||||||||||||||||||||||||||||
| 483 | } | ||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||
| 485 | # Attribute, deren Schlüssel und Wert eingetragen wird | ||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||
| 487 | 2 | for my $key (qw/alt link page/) { | |||||||||||||||||||||||||||||||||||||||||
| 488 | 6 | ▶ | if (my $val = $opt->$key) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 489 | 3 | push @arr,sprintf '%s=%s',$key,$val; | |||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||
| 493 | # Boolsche Attribute, deren Name eingetragen wird | ||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||
| 495 | 2 | for my $key (qw/border/) { | |||||||||||||||||||||||||||||||||||||||||
| 496 | 2 | ▶ | if (my $val = $opt->$key) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 497 | 1 | push @arr,$key; | |||||||||||||||||||||||||||||||||||||||||
| 498 | } | ||||||||||||||||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||
| 501 | # Attribute, deren Wert eingetragen wird (caption muss am Ende stehen) | ||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||
| 503 | 2 | for my $key (qw/align format valign caption/) { | |||||||||||||||||||||||||||||||||||||||||
| 504 | 8 | ▶ | if (my $val = $opt->$key) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 505 | 4 | push @arr,$val; | |||||||||||||||||||||||||||||||||||||||||
| 506 | } | ||||||||||||||||||||||||||||||||||||||||||
| 507 | } | ||||||||||||||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||||||||||||||
| 509 | 2 | return sprintf "[[%s]]\n\n",join('|',@arr); | |||||||||||||||||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||
| 512 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||
| 514 | =head3 item() - Erzeuge Listenelement | ||||||||||||||||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||||||||||||||||
| 516 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||
| 518 | $code = $gen->item($type,$val); | ||||||||||||||||||||||||||||||||||||||||||
| 519 | $code = $gen->item($type,$key,$val); | ||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||
| 521 | =head4 Arguments | ||||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||||
| 523 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||
| 525 | =item $type | ||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||
| 527 | Typ der Liste. Mögliche Typen einer Liste: | ||||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||
| 529 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||||||||||
| 531 | =item Zeichen: * | ||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||
| 533 | Punktliste. | ||||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||
| 535 | =item Zeichen: # | ||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||
| 537 | Nummerierungsliste. | ||||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||
| 539 | =item Zeichen: ; | ||||||||||||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||||||||||||
| 541 | Definitionsliste. | ||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||
| 543 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||
| 545 | Die Typangabe kann auch aus mehreren Typangaben zusammengesetzt | ||||||||||||||||||||||||||||||||||||||||||
| 546 | sein, wie es bei geschachtelten Listen benötigt wird, z.B. "*#*". | ||||||||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||||||||
| 548 | =item $key | ||||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||
| 550 | Definitionsterm (nur Definitionsliste). | ||||||||||||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||||||||||||
| 552 | =item $val | ||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||
| 554 | Wert des Elements (alle Listen). | ||||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||
| 556 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||
| 558 | =head4 Returns | ||||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||
| 560 | Markup-Code (String) | ||||||||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||||||||
| 562 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||||||
| 564 | Erzeuge den MediaWiki Markup-Code für ein Listenelement des Typs | ||||||||||||||||||||||||||||||||||||||||||
| 565 | $type und mit Wert $val. Im Falle einer Definitonsliste verwende | ||||||||||||||||||||||||||||||||||||||||||
| 566 | den Definitionsterm $key. | ||||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||
| 568 | =head4 See Also | ||||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||
| 570 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||||||||||||||||
| 572 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||||||||||||
| 574 | L<https://www.mediawiki.org/wiki/Help:Lists> | ||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||
| 576 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||
| 578 | =head4 Examples | ||||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||
| 580 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||||||||||||
| 582 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||
| 584 | Punktliste | ||||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||
| 586 | $gen->item('*','Apfel'); | ||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||
| 588 | produziert | ||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||
| 590 | * Apfel | ||||||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||||||
| 592 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||
| 594 | Nummerierungsliste | ||||||||||||||||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||||||||||||||||
| 596 | $gen->item('#','Apfel'); | ||||||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||||||
| 598 | produziert | ||||||||||||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||||||||||||
| 600 | # Apfel | ||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||
| 602 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||
| 604 | Definitionsliste | ||||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||
| 606 | $gen->item(';',A=>'Apfel); | ||||||||||||||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||||||||||||
| 608 | produziert | ||||||||||||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||||||||||||
| 610 | ; A : Apfel | ||||||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||||||
| 612 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||||||||||||||||
| 614 | Item einer untergeordneten Liste | ||||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||
| 616 | $gen->item('#*','Apfel'); | ||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||
| 618 | produziert | ||||||||||||||||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||||||||||||||||
| 620 | *#* Apfel | ||||||||||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||||||||||
| 622 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||||||||||||||||
| 624 | Item mit einer untergeordneten Liste als Wert | ||||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||
| 626 | $gen->item('#',"* Apfel\n* Birne\n*Pflaume"); | ||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||
| 628 | produziert | ||||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||
| 630 | #* Apfel | ||||||||||||||||||||||||||||||||||||||||||
| 631 | #* Birne | ||||||||||||||||||||||||||||||||||||||||||
| 632 | #* Pflaume | ||||||||||||||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||||||||||||
| 634 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||
| 636 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||
| 638 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||||||
| 640 | 5 | ▶ | sub item { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
item: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 641 | 5 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 642 | 5 | my $type = shift; | |||||||||||||||||||||||||||||||||||||||||
| 643 | # @_: $val -or- $key,$val | ||||||||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||||||||
| 645 | # Der übergebene Typ kann aus mehreren Typ-Zeichen bestehen. | ||||||||||||||||||||||||||||||||||||||||||
| 646 | # Das letzte Zeichen ist das entscheidende. | ||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||
| 648 | # Term im Falle einer Definitonsliste | ||||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||
| 650 | 5 | my $key; | |||||||||||||||||||||||||||||||||||||||||
| 651 | 5 | ▶ | if (substr($type,-1,1) eq ';') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 652 | 1 | $key = shift; | |||||||||||||||||||||||||||||||||||||||||
| 653 | } | ||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||
| 655 | # Wert | ||||||||||||||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||||||||||||
| 657 | 5 | my $val = Quiq::Unindent->trim(shift); | |||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||
| 659 | # Sonderbehandlung für Sublisten | ||||||||||||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||||||||||||
| 661 | # Enthält der Wert eine Subliste, stellen wir dessen Elementen den | ||||||||||||||||||||||||||||||||||||||||||
| 662 | # eigenen Typ voran. Im Falle einer Definitionsliste (;) fügen wir | ||||||||||||||||||||||||||||||||||||||||||
| 663 | # außerdem einen Doppelpunkt (:) ein, damit die Definitionsliste | ||||||||||||||||||||||||||||||||||||||||||
| 664 | # tief genug eingerückt ist. | ||||||||||||||||||||||||||||||||||||||||||
| 665 | |||||||||||||||||||||||||||||||||||||||||||
| 666 | 5 | $val =~ s/^([*#])/$type$1/mg; | |||||||||||||||||||||||||||||||||||||||||
| 667 | 5 | $val =~ s/^(;)/$type:$1/mg; | |||||||||||||||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||||||||||||||||
| 669 | # Besteht der Wert allein aus der Subliste, liefern wir diese zurück. | ||||||||||||||||||||||||||||||||||||||||||
| 670 | # Andernfalls erzeugen wir ein Listenelement (das in $val eine | ||||||||||||||||||||||||||||||||||||||||||
| 671 | # Subliste enthalten kann). | ||||||||||||||||||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||||||||||||||||
| 673 | 5 | my $code; | |||||||||||||||||||||||||||||||||||||||||
| 674 | 5 | ▶ | if ($val !~ /^[*#;]/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 675 | # Listenelement generieren | ||||||||||||||||||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||||||||||||||||
| 677 | 4 | $code = "$type "; | |||||||||||||||||||||||||||||||||||||||||
| 678 | 4 | ▶ | if ($key) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 679 | 1 | $code .= "$key : "; | |||||||||||||||||||||||||||||||||||||||||
| 680 | } | ||||||||||||||||||||||||||||||||||||||||||
| 681 | } | ||||||||||||||||||||||||||||||||||||||||||
| 682 | 5 | $code .= $val; | |||||||||||||||||||||||||||||||||||||||||
| 683 | |||||||||||||||||||||||||||||||||||||||||||
| 684 | 5 | return "$code\n"; | |||||||||||||||||||||||||||||||||||||||||
| 685 | } | ||||||||||||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||||||||||||
| 687 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||||||||||||||||
| 689 | =head3 list() - Erzeuge Liste | ||||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||
| 691 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||||||||||||||||
| 693 | $code = $gen->list($type,\@items); | ||||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||
| 695 | =head4 Arguments | ||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||
| 697 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||||||
| 699 | =item $type | ||||||||||||||||||||||||||||||||||||||||||
| 700 | |||||||||||||||||||||||||||||||||||||||||||
| 701 | Typ der Liste. Mögliche Werte: | ||||||||||||||||||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||||||||||||||||
| 703 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||||||||||||||||
| 705 | =item Zeichen: * | ||||||||||||||||||||||||||||||||||||||||||
| 706 | |||||||||||||||||||||||||||||||||||||||||||
| 707 | Punktliste. | ||||||||||||||||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||||||||||||||||
| 709 | =item Zeichen: # | ||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||
| 711 | Numerierungsliste. | ||||||||||||||||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||||||||||||||
| 713 | =item Zeichen: ; | ||||||||||||||||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||||||||||||||||
| 715 | Definitionsliste. | ||||||||||||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||||||||||||
| 717 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||||||||||
| 719 | =item @items | ||||||||||||||||||||||||||||||||||||||||||
| 720 | |||||||||||||||||||||||||||||||||||||||||||
| 721 | Liste der List-Items. Im Falle einer Definitionsliste ist dies | ||||||||||||||||||||||||||||||||||||||||||
| 722 | eine Liste von Schlüssel/Wert-Paaren. In allen anderen Fällen ist | ||||||||||||||||||||||||||||||||||||||||||
| 723 | es eine Liste von skalaren Werten. | ||||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||
| 725 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 726 | |||||||||||||||||||||||||||||||||||||||||||
| 727 | =head4 Returns | ||||||||||||||||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||||||||||||||||
| 729 | Markup-Code (String) | ||||||||||||||||||||||||||||||||||||||||||
| 730 | |||||||||||||||||||||||||||||||||||||||||||
| 731 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||||||||||||||||
| 733 | Erzeuge den MediaWiki Markup-Code für eine Liste des Typs $type | ||||||||||||||||||||||||||||||||||||||||||
| 734 | mit den Elementen @items und liefere diesen zurück. Listen | ||||||||||||||||||||||||||||||||||||||||||
| 735 | können auch geschachtelt werden. Siehe Examples. | ||||||||||||||||||||||||||||||||||||||||||
| 736 | |||||||||||||||||||||||||||||||||||||||||||
| 737 | =head4 See Also | ||||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||
| 739 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||||||||||||||||
| 741 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||||||||||||||||
| 743 | L<https://www.mediawiki.org/wiki/Help:Lists> | ||||||||||||||||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||||||||||||||||
| 745 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||
| 747 | =head4 Examples | ||||||||||||||||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||||||||||||||||
| 749 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||||||||||||||||
| 751 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 752 | |||||||||||||||||||||||||||||||||||||||||||
| 753 | Punktliste | ||||||||||||||||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||||||||||||||||
| 755 | $gen->list('*',['Apfel','Birne','Pflaume']); | ||||||||||||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||||||||||||
| 757 | produziert | ||||||||||||||||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||||||||||||||||
| 759 | * Apfel | ||||||||||||||||||||||||||||||||||||||||||
| 760 | * Birne | ||||||||||||||||||||||||||||||||||||||||||
| 761 | * Pflaume | ||||||||||||||||||||||||||||||||||||||||||
| 762 | |||||||||||||||||||||||||||||||||||||||||||
| 763 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||||||||||||
| 765 | Nummerierungsliste | ||||||||||||||||||||||||||||||||||||||||||
| 766 | |||||||||||||||||||||||||||||||||||||||||||
| 767 | $gen->list('#',['Apfel','Birne','Pflaume']); | ||||||||||||||||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||||||||||||||||
| 769 | produziert | ||||||||||||||||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||||||||||||||||
| 771 | # Apfel | ||||||||||||||||||||||||||||||||||||||||||
| 772 | # Birne | ||||||||||||||||||||||||||||||||||||||||||
| 773 | # Pflaume | ||||||||||||||||||||||||||||||||||||||||||
| 774 | |||||||||||||||||||||||||||||||||||||||||||
| 775 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 776 | |||||||||||||||||||||||||||||||||||||||||||
| 777 | Definitionsliste | ||||||||||||||||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||||||||||||||||
| 779 | $gen->list(';',[A=>'Apfel',B=>'Birne',C=>'Pflaume']); | ||||||||||||||||||||||||||||||||||||||||||
| 780 | |||||||||||||||||||||||||||||||||||||||||||
| 781 | produziert | ||||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||
| 783 | ; A : Apfel | ||||||||||||||||||||||||||||||||||||||||||
| 784 | ; B : Birne | ||||||||||||||||||||||||||||||||||||||||||
| 785 | ; C : Pflaume | ||||||||||||||||||||||||||||||||||||||||||
| 786 | |||||||||||||||||||||||||||||||||||||||||||
| 787 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||
| 789 | * Geschachtelte Liste: | ||||||||||||||||||||||||||||||||||||||||||
| 790 | |||||||||||||||||||||||||||||||||||||||||||
| 791 | $code .= $gen->list('#',[ | ||||||||||||||||||||||||||||||||||||||||||
| 792 | 'Obst', | ||||||||||||||||||||||||||||||||||||||||||
| 793 | $gen->list('*',[ | ||||||||||||||||||||||||||||||||||||||||||
| 794 | 'Apfel', | ||||||||||||||||||||||||||||||||||||||||||
| 795 | 'Birne', | ||||||||||||||||||||||||||||||||||||||||||
| 796 | 'Pflaume', | ||||||||||||||||||||||||||||||||||||||||||
| 797 | ]), | ||||||||||||||||||||||||||||||||||||||||||
| 798 | 'Gemüse', | ||||||||||||||||||||||||||||||||||||||||||
| 799 | $gen->list('*',[ | ||||||||||||||||||||||||||||||||||||||||||
| 800 | 'Gurke', | ||||||||||||||||||||||||||||||||||||||||||
| 801 | 'Spinat', | ||||||||||||||||||||||||||||||||||||||||||
| 802 | 'Tomate', | ||||||||||||||||||||||||||||||||||||||||||
| 803 | ]), | ||||||||||||||||||||||||||||||||||||||||||
| 804 | ]); | ||||||||||||||||||||||||||||||||||||||||||
| 805 | |||||||||||||||||||||||||||||||||||||||||||
| 806 | produziert | ||||||||||||||||||||||||||||||||||||||||||
| 807 | |||||||||||||||||||||||||||||||||||||||||||
| 808 | # Obst | ||||||||||||||||||||||||||||||||||||||||||
| 809 | #* Apfel | ||||||||||||||||||||||||||||||||||||||||||
| 810 | #* Birne | ||||||||||||||||||||||||||||||||||||||||||
| 811 | #* Pflaume | ||||||||||||||||||||||||||||||||||||||||||
| 812 | # Gemüse | ||||||||||||||||||||||||||||||||||||||||||
| 813 | #* Gurke | ||||||||||||||||||||||||||||||||||||||||||
| 814 | #* Spinat | ||||||||||||||||||||||||||||||||||||||||||
| 815 | #* Tomate | ||||||||||||||||||||||||||||||||||||||||||
| 816 | |||||||||||||||||||||||||||||||||||||||||||
| 817 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 818 | |||||||||||||||||||||||||||||||||||||||||||
| 819 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 820 | |||||||||||||||||||||||||||||||||||||||||||
| 821 | 0 | ▶ | sub list { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 822 | 0 | my ($self,$type,$itemA) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||||||||||||||||
| 824 | 0 | my $code = ''; | |||||||||||||||||||||||||||||||||||||||||
| 825 | 0 | ▶ | for (my $i = 0; $i < @$itemA; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 826 | 0 | my @args; | |||||||||||||||||||||||||||||||||||||||||
| 827 | 0 | ▶ | if ($type eq ';') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 828 | 0 | push @args,$itemA->[$i++]; | |||||||||||||||||||||||||||||||||||||||||
| 829 | } | ||||||||||||||||||||||||||||||||||||||||||
| 830 | 0 | push @args,$itemA->[$i]; | |||||||||||||||||||||||||||||||||||||||||
| 831 | |||||||||||||||||||||||||||||||||||||||||||
| 832 | 0 | $code .= $self->item($type,@args); | |||||||||||||||||||||||||||||||||||||||||
| 833 | } | ||||||||||||||||||||||||||||||||||||||||||
| 834 | |||||||||||||||||||||||||||||||||||||||||||
| 835 | 0 | return $code."\n"; | |||||||||||||||||||||||||||||||||||||||||
| 836 | } | ||||||||||||||||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||||||||||||||||
| 838 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 839 | |||||||||||||||||||||||||||||||||||||||||||
| 840 | =head3 paragraph() - Erzeuge Paragraph | ||||||||||||||||||||||||||||||||||||||||||
| 841 | |||||||||||||||||||||||||||||||||||||||||||
| 842 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 843 | |||||||||||||||||||||||||||||||||||||||||||
| 844 | $code = $gen->paragraph($text); | ||||||||||||||||||||||||||||||||||||||||||
| 845 | |||||||||||||||||||||||||||||||||||||||||||
| 846 | =head4 Arguments | ||||||||||||||||||||||||||||||||||||||||||
| 847 | |||||||||||||||||||||||||||||||||||||||||||
| 848 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 849 | |||||||||||||||||||||||||||||||||||||||||||
| 850 | =item $text | ||||||||||||||||||||||||||||||||||||||||||
| 851 | |||||||||||||||||||||||||||||||||||||||||||
| 852 | Der Text des Paragraphen | ||||||||||||||||||||||||||||||||||||||||||
| 853 | |||||||||||||||||||||||||||||||||||||||||||
| 854 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||||||||||||||||
| 856 | =head4 Returns | ||||||||||||||||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||||||||||||||||
| 858 | Markup-Code (String) | ||||||||||||||||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||||||||||||||||
| 860 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||
| 861 | |||||||||||||||||||||||||||||||||||||||||||
| 862 | Erzeuge den MediaWiki Markup-Code für einen Paragraphen mit dem | ||||||||||||||||||||||||||||||||||||||||||
| 863 | Text $text und liefere diesen zurück. Ist $text undef oder ein | ||||||||||||||||||||||||||||||||||||||||||
| 864 | Leerstring, wird ein Leerstring geliefert. Andernfalls wird $text | ||||||||||||||||||||||||||||||||||||||||||
| 865 | per trim() von einer etwaigen Einrückung befreit. | ||||||||||||||||||||||||||||||||||||||||||
| 866 | |||||||||||||||||||||||||||||||||||||||||||
| 867 | =head4 See Also | ||||||||||||||||||||||||||||||||||||||||||
| 868 | |||||||||||||||||||||||||||||||||||||||||||
| 869 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||
| 870 | |||||||||||||||||||||||||||||||||||||||||||
| 871 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 872 | |||||||||||||||||||||||||||||||||||||||||||
| 873 | Syntax: L<https://www.mediawiki.org/wiki/Help:Formatting> | ||||||||||||||||||||||||||||||||||||||||||
| 874 | |||||||||||||||||||||||||||||||||||||||||||
| 875 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 876 | |||||||||||||||||||||||||||||||||||||||||||
| 877 | =head4 Examples | ||||||||||||||||||||||||||||||||||||||||||
| 878 | |||||||||||||||||||||||||||||||||||||||||||
| 879 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||
| 880 | |||||||||||||||||||||||||||||||||||||||||||
| 881 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 882 | |||||||||||||||||||||||||||||||||||||||||||
| 883 | Text: | ||||||||||||||||||||||||||||||||||||||||||
| 884 | |||||||||||||||||||||||||||||||||||||||||||
| 885 | $gen->paragraph("Dies ist\nein Test."); | ||||||||||||||||||||||||||||||||||||||||||
| 886 | |||||||||||||||||||||||||||||||||||||||||||
| 887 | erzeugt | ||||||||||||||||||||||||||||||||||||||||||
| 888 | |||||||||||||||||||||||||||||||||||||||||||
| 889 | Dies ist | ||||||||||||||||||||||||||||||||||||||||||
| 890 | ein Test. | ||||||||||||||||||||||||||||||||||||||||||
| 891 | |||||||||||||||||||||||||||||||||||||||||||
| 892 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 893 | |||||||||||||||||||||||||||||||||||||||||||
| 894 | Eine Einrückung wird automatisch entfernt: | ||||||||||||||||||||||||||||||||||||||||||
| 895 | |||||||||||||||||||||||||||||||||||||||||||
| 896 | $gen->paragraph(q~ | ||||||||||||||||||||||||||||||||||||||||||
| 897 | Dies ist | ||||||||||||||||||||||||||||||||||||||||||
| 898 | ein Test. | ||||||||||||||||||||||||||||||||||||||||||
| 899 | ~); | ||||||||||||||||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||||||||||||||||
| 901 | erzeugt | ||||||||||||||||||||||||||||||||||||||||||
| 902 | |||||||||||||||||||||||||||||||||||||||||||
| 903 | Dies ist | ||||||||||||||||||||||||||||||||||||||||||
| 904 | ein Test. | ||||||||||||||||||||||||||||||||||||||||||
| 905 | |||||||||||||||||||||||||||||||||||||||||||
| 906 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 907 | |||||||||||||||||||||||||||||||||||||||||||
| 908 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 909 | |||||||||||||||||||||||||||||||||||||||||||
| 910 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 911 | |||||||||||||||||||||||||||||||||||||||||||
| 912 | 4 | ▶ | sub paragraph { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
paragraph: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 913 | 4 | my ($self,$text) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 914 | |||||||||||||||||||||||||||||||||||||||||||
| 915 | 4 | $text = Quiq::Unindent->trim($text); | |||||||||||||||||||||||||||||||||||||||||
| 916 | 4 | ▶ | if ($text ne '') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 917 | 2 | $text .= "\n\n"; | |||||||||||||||||||||||||||||||||||||||||
| 918 | } | ||||||||||||||||||||||||||||||||||||||||||
| 919 | |||||||||||||||||||||||||||||||||||||||||||
| 920 | 4 | return $text; | |||||||||||||||||||||||||||||||||||||||||
| 921 | } | ||||||||||||||||||||||||||||||||||||||||||
| 922 | |||||||||||||||||||||||||||||||||||||||||||
| 923 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 924 | |||||||||||||||||||||||||||||||||||||||||||
| 925 | =head3 section() - Erzeuge Abschnittsüberschrift | ||||||||||||||||||||||||||||||||||||||||||
| 926 | |||||||||||||||||||||||||||||||||||||||||||
| 927 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 928 | |||||||||||||||||||||||||||||||||||||||||||
| 929 | $code = $gen->section($level,$title); | ||||||||||||||||||||||||||||||||||||||||||
| 930 | |||||||||||||||||||||||||||||||||||||||||||
| 931 | =head4 Arguments | ||||||||||||||||||||||||||||||||||||||||||
| 932 | |||||||||||||||||||||||||||||||||||||||||||
| 933 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 934 | |||||||||||||||||||||||||||||||||||||||||||
| 935 | =item $level | ||||||||||||||||||||||||||||||||||||||||||
| 936 | |||||||||||||||||||||||||||||||||||||||||||
| 937 | Die Nummer der Abschnittsebene. Wertebereich: 1-6. | ||||||||||||||||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||||||||||||||||
| 939 | =item $title | ||||||||||||||||||||||||||||||||||||||||||
| 940 | |||||||||||||||||||||||||||||||||||||||||||
| 941 | Der Abschnitts-Titel. | ||||||||||||||||||||||||||||||||||||||||||
| 942 | |||||||||||||||||||||||||||||||||||||||||||
| 943 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 944 | |||||||||||||||||||||||||||||||||||||||||||
| 945 | =head4 Returns | ||||||||||||||||||||||||||||||||||||||||||
| 946 | |||||||||||||||||||||||||||||||||||||||||||
| 947 | Markup-Code (String) | ||||||||||||||||||||||||||||||||||||||||||
| 948 | |||||||||||||||||||||||||||||||||||||||||||
| 949 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||
| 950 | |||||||||||||||||||||||||||||||||||||||||||
| 951 | Erzeuge den MediaWiki Markup-Code für einen Abschnitt der Tiefe | ||||||||||||||||||||||||||||||||||||||||||
| 952 | $level und der Abschnittsüberschrift $title und liefere diesen | ||||||||||||||||||||||||||||||||||||||||||
| 953 | zurück. | ||||||||||||||||||||||||||||||||||||||||||
| 954 | |||||||||||||||||||||||||||||||||||||||||||
| 955 | =head4 See Also | ||||||||||||||||||||||||||||||||||||||||||
| 956 | |||||||||||||||||||||||||||||||||||||||||||
| 957 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||
| 958 | |||||||||||||||||||||||||||||||||||||||||||
| 959 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 960 | |||||||||||||||||||||||||||||||||||||||||||
| 961 | Syntax: L<https://www.mediawiki.org/wiki/Help:Formatting> | ||||||||||||||||||||||||||||||||||||||||||
| 962 | |||||||||||||||||||||||||||||||||||||||||||
| 963 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 964 | |||||||||||||||||||||||||||||||||||||||||||
| 965 | =head4 Example | ||||||||||||||||||||||||||||||||||||||||||
| 966 | |||||||||||||||||||||||||||||||||||||||||||
| 967 | $gen->section(3,'Eine Überschrift'); | ||||||||||||||||||||||||||||||||||||||||||
| 968 | |||||||||||||||||||||||||||||||||||||||||||
| 969 | produziert | ||||||||||||||||||||||||||||||||||||||||||
| 970 | |||||||||||||||||||||||||||||||||||||||||||
| 971 | === Eine Überschrift === | ||||||||||||||||||||||||||||||||||||||||||
| 972 | |||||||||||||||||||||||||||||||||||||||||||
| 973 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 974 | |||||||||||||||||||||||||||||||||||||||||||
| 975 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 976 | |||||||||||||||||||||||||||||||||||||||||||
| 977 | 2 | ▶ | sub section { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
section: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 978 | 2 | my ($self,$level,$title,$body) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 979 | |||||||||||||||||||||||||||||||||||||||||||
| 980 | 2 | my $eqSigns = '=' x $level; | |||||||||||||||||||||||||||||||||||||||||
| 981 | 2 | return sprintf "%s %s %s\n\n",$eqSigns,$title,$eqSigns; | |||||||||||||||||||||||||||||||||||||||||
| 982 | } | ||||||||||||||||||||||||||||||||||||||||||
| 983 | |||||||||||||||||||||||||||||||||||||||||||
| 984 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 985 | |||||||||||||||||||||||||||||||||||||||||||
| 986 | =head3 table() - Erzeuge Tabelle | ||||||||||||||||||||||||||||||||||||||||||
| 987 | |||||||||||||||||||||||||||||||||||||||||||
| 988 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 989 | |||||||||||||||||||||||||||||||||||||||||||
| 990 | $code = $gen->table(@keyVal); | ||||||||||||||||||||||||||||||||||||||||||
| 991 | |||||||||||||||||||||||||||||||||||||||||||
| 992 | =head4 Arguments | ||||||||||||||||||||||||||||||||||||||||||
| 993 | |||||||||||||||||||||||||||||||||||||||||||
| 994 | Die Argumentliste @keyVal wird gebildet über folgenden | ||||||||||||||||||||||||||||||||||||||||||
| 995 | Schlüssel/Wert-Paaren: | ||||||||||||||||||||||||||||||||||||||||||
| 996 | |||||||||||||||||||||||||||||||||||||||||||
| 997 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 998 | |||||||||||||||||||||||||||||||||||||||||||
| 999 | =item alignments => \@alignments (Default: []) | ||||||||||||||||||||||||||||||||||||||||||
| 1000 | |||||||||||||||||||||||||||||||||||||||||||
| 1001 | Liste der Kolumnen-Ausrichtungen. Mögliche Werte je Kolumne: 'left', | ||||||||||||||||||||||||||||||||||||||||||
| 1002 | 'right', 'center'. | ||||||||||||||||||||||||||||||||||||||||||
| 1003 | |||||||||||||||||||||||||||||||||||||||||||
| 1004 | =item bodyBackground => $color (Default: '#ffffff') | ||||||||||||||||||||||||||||||||||||||||||
| 1005 | |||||||||||||||||||||||||||||||||||||||||||
| 1006 | Hintergrundfarbe der Rumpfzeilen. | ||||||||||||||||||||||||||||||||||||||||||
| 1007 | |||||||||||||||||||||||||||||||||||||||||||
| 1008 | =item caption => $str | ||||||||||||||||||||||||||||||||||||||||||
| 1009 | |||||||||||||||||||||||||||||||||||||||||||
| 1010 | Unterschrift der Tabelle. | ||||||||||||||||||||||||||||||||||||||||||
| 1011 | |||||||||||||||||||||||||||||||||||||||||||
| 1012 | =item rows => \@rows (Default: []) | ||||||||||||||||||||||||||||||||||||||||||
| 1013 | |||||||||||||||||||||||||||||||||||||||||||
| 1014 | Liste der Tabellenzeilen. | ||||||||||||||||||||||||||||||||||||||||||
| 1015 | |||||||||||||||||||||||||||||||||||||||||||
| 1016 | =item titleBackground => $color (Default: '#e8e8e8') | ||||||||||||||||||||||||||||||||||||||||||
| 1017 | |||||||||||||||||||||||||||||||||||||||||||
| 1018 | Hintergrundfarbe der Titelzeile. | ||||||||||||||||||||||||||||||||||||||||||
| 1019 | |||||||||||||||||||||||||||||||||||||||||||
| 1020 | =item titles => \@titles (Default: []) | ||||||||||||||||||||||||||||||||||||||||||
| 1021 | |||||||||||||||||||||||||||||||||||||||||||
| 1022 | Liste der Kolumnentitel. | ||||||||||||||||||||||||||||||||||||||||||
| 1023 | |||||||||||||||||||||||||||||||||||||||||||
| 1024 | =item valueCallback => sub {...} (Default: keiner) | ||||||||||||||||||||||||||||||||||||||||||
| 1025 | |||||||||||||||||||||||||||||||||||||||||||
| 1026 | Subroutine, die für I<jeden> Wert (caption, title, row value) aufgerufen | ||||||||||||||||||||||||||||||||||||||||||
| 1027 | wird: | ||||||||||||||||||||||||||||||||||||||||||
| 1028 | |||||||||||||||||||||||||||||||||||||||||||
| 1029 | valueCallback => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 1030 | my $val = shift; | ||||||||||||||||||||||||||||||||||||||||||
| 1031 | ... | ||||||||||||||||||||||||||||||||||||||||||
| 1032 | return $val; | ||||||||||||||||||||||||||||||||||||||||||
| 1033 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1034 | |||||||||||||||||||||||||||||||||||||||||||
| 1035 | Die Subroutine wird z.B. von Sdoc verwendet, um Segmente zu expandieren: | ||||||||||||||||||||||||||||||||||||||||||
| 1036 | |||||||||||||||||||||||||||||||||||||||||||
| 1037 | valueCallback => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 1038 | return $self->expandText($m,\shift); | ||||||||||||||||||||||||||||||||||||||||||
| 1039 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1040 | |||||||||||||||||||||||||||||||||||||||||||
| 1041 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1042 | |||||||||||||||||||||||||||||||||||||||||||
| 1043 | =head4 Returns | ||||||||||||||||||||||||||||||||||||||||||
| 1044 | |||||||||||||||||||||||||||||||||||||||||||
| 1045 | Markup-Code (String) | ||||||||||||||||||||||||||||||||||||||||||
| 1046 | |||||||||||||||||||||||||||||||||||||||||||
| 1047 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||
| 1048 | |||||||||||||||||||||||||||||||||||||||||||
| 1049 | Erzeuge den MediaWiki Markup-Code für eine Tabelle und liefere diesen | ||||||||||||||||||||||||||||||||||||||||||
| 1050 | zurück. | ||||||||||||||||||||||||||||||||||||||||||
| 1051 | |||||||||||||||||||||||||||||||||||||||||||
| 1052 | Das Aussehen der MediaWiki-Tabelle wird durch CSS-Angaben bestimmt, | ||||||||||||||||||||||||||||||||||||||||||
| 1053 | die in den Wiki-Code eingestreut werden. Die Grundlage hierfür bietet | ||||||||||||||||||||||||||||||||||||||||||
| 1054 | die Standard-CSS-Klasse "wikitable" (siehe Link unten). | ||||||||||||||||||||||||||||||||||||||||||
| 1055 | |||||||||||||||||||||||||||||||||||||||||||
| 1056 | =head4 See Also | ||||||||||||||||||||||||||||||||||||||||||
| 1057 | |||||||||||||||||||||||||||||||||||||||||||
| 1058 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||
| 1059 | |||||||||||||||||||||||||||||||||||||||||||
| 1060 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 1061 | |||||||||||||||||||||||||||||||||||||||||||
| 1062 | Syntax: L<https://www.mediawiki.org/wiki/Help:Tables> | ||||||||||||||||||||||||||||||||||||||||||
| 1063 | |||||||||||||||||||||||||||||||||||||||||||
| 1064 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 1065 | |||||||||||||||||||||||||||||||||||||||||||
| 1066 | CSS der Klasse "wikitable": L<https://www.mediawiki.org/wiki/Manual:CSS> | ||||||||||||||||||||||||||||||||||||||||||
| 1067 | |||||||||||||||||||||||||||||||||||||||||||
| 1068 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1069 | |||||||||||||||||||||||||||||||||||||||||||
| 1070 | =head4 Example | ||||||||||||||||||||||||||||||||||||||||||
| 1071 | |||||||||||||||||||||||||||||||||||||||||||
| 1072 | Der Code | ||||||||||||||||||||||||||||||||||||||||||
| 1073 | |||||||||||||||||||||||||||||||||||||||||||
| 1074 | $gen->table( | ||||||||||||||||||||||||||||||||||||||||||
| 1075 | alignments => ['left','right','center'], | ||||||||||||||||||||||||||||||||||||||||||
| 1076 | caption => 'Eine Tabelle', | ||||||||||||||||||||||||||||||||||||||||||
| 1077 | titles => ['L','R','Z'], | ||||||||||||||||||||||||||||||||||||||||||
| 1078 | rows => [ | ||||||||||||||||||||||||||||||||||||||||||
| 1079 | ['A',1,'ABCDEFG'], | ||||||||||||||||||||||||||||||||||||||||||
| 1080 | ['AB',12,'HIJKL'], | ||||||||||||||||||||||||||||||||||||||||||
| 1081 | ['ABC',123,'MNO'], | ||||||||||||||||||||||||||||||||||||||||||
| 1082 | ['ABCD',1234,'P'], | ||||||||||||||||||||||||||||||||||||||||||
| 1083 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 1084 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1085 | |||||||||||||||||||||||||||||||||||||||||||
| 1086 | produziert | ||||||||||||||||||||||||||||||||||||||||||
| 1087 | |||||||||||||||||||||||||||||||||||||||||||
| 1088 | {| class="wikitable" | ||||||||||||||||||||||||||||||||||||||||||
| 1089 | |+ style="caption-side: bottom; font-weight: normal"|Eine Tabelle | ||||||||||||||||||||||||||||||||||||||||||
| 1090 | |- | ||||||||||||||||||||||||||||||||||||||||||
| 1091 | ! style="background-color: #e8e8e8; text-align: left" |L | ||||||||||||||||||||||||||||||||||||||||||
| 1092 | ! style="background-color: #e8e8e8; text-align: right" |R | ||||||||||||||||||||||||||||||||||||||||||
| 1093 | ! style="background-color: #e8e8e8" |Z | ||||||||||||||||||||||||||||||||||||||||||
| 1094 | |- | ||||||||||||||||||||||||||||||||||||||||||
| 1095 | | style="background-color: #ffffff" |A | ||||||||||||||||||||||||||||||||||||||||||
| 1096 | | style="background-color: #ffffff; text-align: right" |1 | ||||||||||||||||||||||||||||||||||||||||||
| 1097 | | style="background-color: #ffffff; text-align: center" |ABCDEFG | ||||||||||||||||||||||||||||||||||||||||||
| 1098 | |- | ||||||||||||||||||||||||||||||||||||||||||
| 1099 | | style="background-color: #ffffff" |AB | ||||||||||||||||||||||||||||||||||||||||||
| 1100 | | style="background-color: #ffffff; text-align: right" |12 | ||||||||||||||||||||||||||||||||||||||||||
| 1101 | | style="background-color: #ffffff; text-align: center" |HIJKL | ||||||||||||||||||||||||||||||||||||||||||
| 1102 | |- | ||||||||||||||||||||||||||||||||||||||||||
| 1103 | | style="background-color: #ffffff" |ABC | ||||||||||||||||||||||||||||||||||||||||||
| 1104 | | style="background-color: #ffffff; text-align: right" |123 | ||||||||||||||||||||||||||||||||||||||||||
| 1105 | | style="background-color: #ffffff; text-align: center" |MNO | ||||||||||||||||||||||||||||||||||||||||||
| 1106 | |- | ||||||||||||||||||||||||||||||||||||||||||
| 1107 | | style="background-color: #ffffff" |ABCD | ||||||||||||||||||||||||||||||||||||||||||
| 1108 | | style="background-color: #ffffff; text-align: right" |1234 | ||||||||||||||||||||||||||||||||||||||||||
| 1109 | | style="background-color: #ffffff; text-align: center" |P | ||||||||||||||||||||||||||||||||||||||||||
| 1110 | |} | ||||||||||||||||||||||||||||||||||||||||||
| 1111 | |||||||||||||||||||||||||||||||||||||||||||
| 1112 | was in der Darstellung so aussieht | ||||||||||||||||||||||||||||||||||||||||||
| 1113 | |||||||||||||||||||||||||||||||||||||||||||
| 1114 | +-------+--------------------+ | ||||||||||||||||||||||||||||||||||||||||||
| 1115 | | L | R | Z | | ||||||||||||||||||||||||||||||||||||||||||
| 1116 | +----------------------------+ | ||||||||||||||||||||||||||||||||||||||||||
| 1117 | | A | 1 | ABCDEFG | | ||||||||||||||||||||||||||||||||||||||||||
| 1118 | +----------------------------+ | ||||||||||||||||||||||||||||||||||||||||||
| 1119 | | AB | 12 | HIJKL | | ||||||||||||||||||||||||||||||||||||||||||
| 1120 | +----------------------------+ | ||||||||||||||||||||||||||||||||||||||||||
| 1121 | | ABC | 123 | MNO | | ||||||||||||||||||||||||||||||||||||||||||
| 1122 | +----------------------------+ | ||||||||||||||||||||||||||||||||||||||||||
| 1123 | | ABCD | 1234 | P | | ||||||||||||||||||||||||||||||||||||||||||
| 1124 | +----------------------------+ | ||||||||||||||||||||||||||||||||||||||||||
| 1125 | Eine Tabelle | ||||||||||||||||||||||||||||||||||||||||||
| 1126 | |||||||||||||||||||||||||||||||||||||||||||
| 1127 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1128 | |||||||||||||||||||||||||||||||||||||||||||
| 1129 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1130 | |||||||||||||||||||||||||||||||||||||||||||
| 1131 | 2 | ▶ | sub table { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
table: called CC=16 SCAR=28.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1132 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1133 | # @_: @keyVal | ||||||||||||||||||||||||||||||||||||||||||
| 1134 | |||||||||||||||||||||||||||||||||||||||||||
| 1135 | 2 | my $alignA = []; | |||||||||||||||||||||||||||||||||||||||||
| 1136 | 2 | my $bodyBackground = '#ffffff'; | |||||||||||||||||||||||||||||||||||||||||
| 1137 | 2 | my $caption = undef; | |||||||||||||||||||||||||||||||||||||||||
| 1138 | 2 | my $rowA = []; | |||||||||||||||||||||||||||||||||||||||||
| 1139 | 2 | my $titleBackground = '#e8e8e8'; | |||||||||||||||||||||||||||||||||||||||||
| 1140 | 2 | my $titleA = []; | |||||||||||||||||||||||||||||||||||||||||
| 1141 | 2 | my $valueCb = undef; | |||||||||||||||||||||||||||||||||||||||||
| 1142 | |||||||||||||||||||||||||||||||||||||||||||
| 1143 | 2 | $self->parameters(\@_, | |||||||||||||||||||||||||||||||||||||||||
| 1144 | alignments => \$alignA, | ||||||||||||||||||||||||||||||||||||||||||
| 1145 | bodyBackground => \$bodyBackground, | ||||||||||||||||||||||||||||||||||||||||||
| 1146 | caption => \$caption, | ||||||||||||||||||||||||||||||||||||||||||
| 1147 | rows => \$rowA, | ||||||||||||||||||||||||||||||||||||||||||
| 1148 | titleBackground => \$titleBackground, | ||||||||||||||||||||||||||||||||||||||||||
| 1149 | titles => \$titleA, | ||||||||||||||||||||||||||||||||||||||||||
| 1150 | valueCallback => \$valueCb, | ||||||||||||||||||||||||||||||||||||||||||
| 1151 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1152 | |||||||||||||||||||||||||||||||||||||||||||
| 1153 | 2 | ▶ | if (!@$titleA && !@$rowA) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@$titleA or @$rowA
MC/DC50%1/2
@$titleA or @$rowA
@$titleA
@$rowA
Truth table66%2/3
A or B
A= @$titleAB= @$rowA
| |||||||||||||||||||||||||||||||||||||||||||
| 1154 | 1 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 1155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1156 | |||||||||||||||||||||||||||||||||||||||||||
| 1157 | # Tabellenanfang | ||||||||||||||||||||||||||||||||||||||||||
| 1158 | 1 | my $code = qq~{| class="wikitable"\n~; | |||||||||||||||||||||||||||||||||||||||||
| 1159 | |||||||||||||||||||||||||||||||||||||||||||
| 1160 | # Tabellen-Unterschrift | ||||||||||||||||||||||||||||||||||||||||||
| 1161 | |||||||||||||||||||||||||||||||||||||||||||
| 1162 | 1 | ▶ | if ($caption) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1163 | 1 | ▶ | if ($valueCb) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1164 | 0 | $caption = $valueCb->($caption); | |||||||||||||||||||||||||||||||||||||||||
| 1165 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1166 | 1 | $code .= qq{|+ style="caption-side: bottom; font-weight: normal"}. | |||||||||||||||||||||||||||||||||||||||||
| 1167 | qq{|$caption\n}; | ||||||||||||||||||||||||||||||||||||||||||
| 1168 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1169 | |||||||||||||||||||||||||||||||||||||||||||
| 1170 | # Titelzeile | ||||||||||||||||||||||||||||||||||||||||||
| 1171 | |||||||||||||||||||||||||||||||||||||||||||
| 1172 | 1 | my $titleLine = ''; | |||||||||||||||||||||||||||||||||||||||||
| 1173 | 1 | ▶ | if (@$titleA) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1174 | 1 | $code .= "|-\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1175 | 1 | ▶ | for (my $i = 0; $i < @$titleA; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1176 | # Style | ||||||||||||||||||||||||||||||||||||||||||
| 1177 | |||||||||||||||||||||||||||||||||||||||||||
| 1178 | 3 | my $style = "background-color: $titleBackground"; | |||||||||||||||||||||||||||||||||||||||||
| 1179 | 3 | ▶ | if (my $align = $alignA->[$i] || 'left') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$alignA->[$i] || 'left'
MC/DC0%0/1
$alignA->[$i] || 'left'
$alignA->[$i]
Truth table50%1/2
A
A= $alignA->[$i]
| |||||||||||||||||||||||||||||||||||||||||||
| 1180 | 3 | ▶ | if ($align ne 'center') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1181 | 2 | $style .= "; text-align: $align"; | |||||||||||||||||||||||||||||||||||||||||
| 1182 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1183 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1184 | |||||||||||||||||||||||||||||||||||||||||||
| 1185 | # Wert | ||||||||||||||||||||||||||||||||||||||||||
| 1186 | |||||||||||||||||||||||||||||||||||||||||||
| 1187 | 3 | my $val = $titleA->[$i]; | |||||||||||||||||||||||||||||||||||||||||
| 1188 | 3 | ▶ | if ($valueCb) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1189 | 0 | $val = $valueCb->($val); | |||||||||||||||||||||||||||||||||||||||||
| 1190 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1191 | |||||||||||||||||||||||||||||||||||||||||||
| 1192 | # Code | ||||||||||||||||||||||||||||||||||||||||||
| 1193 | 3 | $code .= qq{! style="$style" |$val\n}; | |||||||||||||||||||||||||||||||||||||||||
| 1194 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1195 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1196 | |||||||||||||||||||||||||||||||||||||||||||
| 1197 | # Datenzeilen | ||||||||||||||||||||||||||||||||||||||||||
| 1198 | |||||||||||||||||||||||||||||||||||||||||||
| 1199 | 1 | for my $valA (@$rowA) { | |||||||||||||||||||||||||||||||||||||||||
| 1200 | 4 | $code .= "|-\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1201 | 4 | ▶ | for (my $i = 0; $i < @$valA; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1202 | # Style | ||||||||||||||||||||||||||||||||||||||||||
| 1203 | |||||||||||||||||||||||||||||||||||||||||||
| 1204 | 12 | my $style = "background-color: $bodyBackground"; | |||||||||||||||||||||||||||||||||||||||||
| 1205 | 12 | ▶ | if (my $align = $alignA->[$i]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1206 | 12 | ▶ | if ($align ne 'left') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1207 | 8 | $style .= "; text-align: $align"; | |||||||||||||||||||||||||||||||||||||||||
| 1208 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1209 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1210 | |||||||||||||||||||||||||||||||||||||||||||
| 1211 | # Wert | ||||||||||||||||||||||||||||||||||||||||||
| 1212 | |||||||||||||||||||||||||||||||||||||||||||
| 1213 | 12 | my $val = $valA->[$i]; | |||||||||||||||||||||||||||||||||||||||||
| 1214 | 12 | ▶ | if ($valueCb) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1215 | 0 | $val = $valueCb->($val); | |||||||||||||||||||||||||||||||||||||||||
| 1216 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1217 | |||||||||||||||||||||||||||||||||||||||||||
| 1218 | # Code | ||||||||||||||||||||||||||||||||||||||||||
| 1219 | 12 | $code .= qq{| style="$style" |$val\n}; | |||||||||||||||||||||||||||||||||||||||||
| 1220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1221 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1222 | |||||||||||||||||||||||||||||||||||||||||||
| 1223 | # Tabellenende | ||||||||||||||||||||||||||||||||||||||||||
| 1224 | 1 | $code .= '|}'; | |||||||||||||||||||||||||||||||||||||||||
| 1225 | |||||||||||||||||||||||||||||||||||||||||||
| 1226 | 1 | return "$code\n\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1227 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1228 | |||||||||||||||||||||||||||||||||||||||||||
| 1229 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1230 | |||||||||||||||||||||||||||||||||||||||||||
| 1231 | =head3 tableOfContents() - Setze oder unterdrücke Inhaltsverzeichnis | ||||||||||||||||||||||||||||||||||||||||||
| 1232 | |||||||||||||||||||||||||||||||||||||||||||
| 1233 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 1234 | |||||||||||||||||||||||||||||||||||||||||||
| 1235 | $code = $gen->tableOfContents($bool); | ||||||||||||||||||||||||||||||||||||||||||
| 1236 | |||||||||||||||||||||||||||||||||||||||||||
| 1237 | =head4 Arguments | ||||||||||||||||||||||||||||||||||||||||||
| 1238 | |||||||||||||||||||||||||||||||||||||||||||
| 1239 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1240 | |||||||||||||||||||||||||||||||||||||||||||
| 1241 | =item $bool | ||||||||||||||||||||||||||||||||||||||||||
| 1242 | |||||||||||||||||||||||||||||||||||||||||||
| 1243 | Wenn wahr, wird an der aktuellen Position das Inhaltsverzeichnis | ||||||||||||||||||||||||||||||||||||||||||
| 1244 | der Seite gesetzt. Wenn falsch, wird kein Inhaltsverzeichnis für | ||||||||||||||||||||||||||||||||||||||||||
| 1245 | die Seite gesetzt, auch nicht automatisch. | ||||||||||||||||||||||||||||||||||||||||||
| 1246 | |||||||||||||||||||||||||||||||||||||||||||
| 1247 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1248 | |||||||||||||||||||||||||||||||||||||||||||
| 1249 | =head4 Returns | ||||||||||||||||||||||||||||||||||||||||||
| 1250 | |||||||||||||||||||||||||||||||||||||||||||
| 1251 | Markup-Code (String) | ||||||||||||||||||||||||||||||||||||||||||
| 1252 | |||||||||||||||||||||||||||||||||||||||||||
| 1253 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||
| 1254 | |||||||||||||||||||||||||||||||||||||||||||
| 1255 | Erzeuge den MediaWiki Markup-Code für das Setzen oder Unterdrücken | ||||||||||||||||||||||||||||||||||||||||||
| 1256 | des Inhaltsverzeichnisses und liefere diesen zurück. | ||||||||||||||||||||||||||||||||||||||||||
| 1257 | |||||||||||||||||||||||||||||||||||||||||||
| 1258 | =head4 See Also | ||||||||||||||||||||||||||||||||||||||||||
| 1259 | |||||||||||||||||||||||||||||||||||||||||||
| 1260 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||
| 1261 | |||||||||||||||||||||||||||||||||||||||||||
| 1262 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 1263 | |||||||||||||||||||||||||||||||||||||||||||
| 1264 | Syntax: L<https://www.mediawiki.org/wiki/Manual:Table_of_contents> | ||||||||||||||||||||||||||||||||||||||||||
| 1265 | |||||||||||||||||||||||||||||||||||||||||||
| 1266 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1267 | |||||||||||||||||||||||||||||||||||||||||||
| 1268 | =head4 Examples | ||||||||||||||||||||||||||||||||||||||||||
| 1269 | |||||||||||||||||||||||||||||||||||||||||||
| 1270 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||
| 1271 | |||||||||||||||||||||||||||||||||||||||||||
| 1272 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 1273 | |||||||||||||||||||||||||||||||||||||||||||
| 1274 | Inhaltsverzeichnis setzen | ||||||||||||||||||||||||||||||||||||||||||
| 1275 | |||||||||||||||||||||||||||||||||||||||||||
| 1276 | $gen->tableOfContents(1); | ||||||||||||||||||||||||||||||||||||||||||
| 1277 | |||||||||||||||||||||||||||||||||||||||||||
| 1278 | erzeugt | ||||||||||||||||||||||||||||||||||||||||||
| 1279 | |||||||||||||||||||||||||||||||||||||||||||
| 1280 | __TOC__ | ||||||||||||||||||||||||||||||||||||||||||
| 1281 | |||||||||||||||||||||||||||||||||||||||||||
| 1282 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 1283 | |||||||||||||||||||||||||||||||||||||||||||
| 1284 | Inhaltsverzeichnis unterdrücken | ||||||||||||||||||||||||||||||||||||||||||
| 1285 | |||||||||||||||||||||||||||||||||||||||||||
| 1286 | $gen->tableOfContents(0); | ||||||||||||||||||||||||||||||||||||||||||
| 1287 | |||||||||||||||||||||||||||||||||||||||||||
| 1288 | erzeugt | ||||||||||||||||||||||||||||||||||||||||||
| 1289 | |||||||||||||||||||||||||||||||||||||||||||
| 1290 | __NOTOC__ | ||||||||||||||||||||||||||||||||||||||||||
| 1291 | |||||||||||||||||||||||||||||||||||||||||||
| 1292 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1293 | |||||||||||||||||||||||||||||||||||||||||||
| 1294 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1295 | |||||||||||||||||||||||||||||||||||||||||||
| 1296 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1297 | |||||||||||||||||||||||||||||||||||||||||||
| 1298 | 2 | ▶ | sub tableOfContents { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tableOfContents: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1299 | 2 | my ($self,$bool) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1300 | 2 | ▶ | return ($bool? '__TOC__': '__NOTOC__')."\n\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1301 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1302 | |||||||||||||||||||||||||||||||||||||||||||
| 1303 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1304 | |||||||||||||||||||||||||||||||||||||||||||
| 1305 | =head2 Inline Code | ||||||||||||||||||||||||||||||||||||||||||
| 1306 | |||||||||||||||||||||||||||||||||||||||||||
| 1307 | =head3 fmt() - Inline-Formatierung | ||||||||||||||||||||||||||||||||||||||||||
| 1308 | |||||||||||||||||||||||||||||||||||||||||||
| 1309 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 1310 | |||||||||||||||||||||||||||||||||||||||||||
| 1311 | $str = $gen->fmt($type,$text); | ||||||||||||||||||||||||||||||||||||||||||
| 1312 | |||||||||||||||||||||||||||||||||||||||||||
| 1313 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||
| 1314 | |||||||||||||||||||||||||||||||||||||||||||
| 1315 | Erzeuge Inline-Segment für Text $text und liefere den | ||||||||||||||||||||||||||||||||||||||||||
| 1316 | resultierenden Wiki-Code zurück. Ist $text undef oder ein | ||||||||||||||||||||||||||||||||||||||||||
| 1317 | Leerstring, wird ein Leerstring geliefert. Andernfalls wird $text | ||||||||||||||||||||||||||||||||||||||||||
| 1318 | per trim() von einer etwaigen Einrückung befreit und einzeilig | ||||||||||||||||||||||||||||||||||||||||||
| 1319 | gemacht, d.h. Zeilenumbrüche in $text werden entfernt. | ||||||||||||||||||||||||||||||||||||||||||
| 1320 | |||||||||||||||||||||||||||||||||||||||||||
| 1321 | Es existieren die Formatierungen: | ||||||||||||||||||||||||||||||||||||||||||
| 1322 | |||||||||||||||||||||||||||||||||||||||||||
| 1323 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1324 | |||||||||||||||||||||||||||||||||||||||||||
| 1325 | =item comment | ||||||||||||||||||||||||||||||||||||||||||
| 1326 | |||||||||||||||||||||||||||||||||||||||||||
| 1327 | Der Text wird als einzeiliger Kommentar gesetzt. Erzeugt: | ||||||||||||||||||||||||||||||||||||||||||
| 1328 | |||||||||||||||||||||||||||||||||||||||||||
| 1329 | <!-- TEXT --> | ||||||||||||||||||||||||||||||||||||||||||
| 1330 | |||||||||||||||||||||||||||||||||||||||||||
| 1331 | =item italic | ||||||||||||||||||||||||||||||||||||||||||
| 1332 | |||||||||||||||||||||||||||||||||||||||||||
| 1333 | Erzeugt: | ||||||||||||||||||||||||||||||||||||||||||
| 1334 | |||||||||||||||||||||||||||||||||||||||||||
| 1335 | ''TEXT'' | ||||||||||||||||||||||||||||||||||||||||||
| 1336 | |||||||||||||||||||||||||||||||||||||||||||
| 1337 | =item bold | ||||||||||||||||||||||||||||||||||||||||||
| 1338 | |||||||||||||||||||||||||||||||||||||||||||
| 1339 | Erzeugt: | ||||||||||||||||||||||||||||||||||||||||||
| 1340 | |||||||||||||||||||||||||||||||||||||||||||
| 1341 | '''TEXT''' | ||||||||||||||||||||||||||||||||||||||||||
| 1342 | |||||||||||||||||||||||||||||||||||||||||||
| 1343 | =item boldItalic | ||||||||||||||||||||||||||||||||||||||||||
| 1344 | |||||||||||||||||||||||||||||||||||||||||||
| 1345 | Erzeugt: | ||||||||||||||||||||||||||||||||||||||||||
| 1346 | |||||||||||||||||||||||||||||||||||||||||||
| 1347 | '''''TEXT''''' | ||||||||||||||||||||||||||||||||||||||||||
| 1348 | |||||||||||||||||||||||||||||||||||||||||||
| 1349 | =item code | ||||||||||||||||||||||||||||||||||||||||||
| 1350 | |||||||||||||||||||||||||||||||||||||||||||
| 1351 | Der Text wird nicht interpretiert. Erzeugt: | ||||||||||||||||||||||||||||||||||||||||||
| 1352 | |||||||||||||||||||||||||||||||||||||||||||
| 1353 | <code><nowiki>TEXT</nowiki></code> | ||||||||||||||||||||||||||||||||||||||||||
| 1354 | |||||||||||||||||||||||||||||||||||||||||||
| 1355 | =item codeWithFormatting | ||||||||||||||||||||||||||||||||||||||||||
| 1356 | |||||||||||||||||||||||||||||||||||||||||||
| 1357 | Inline-Formatierungen wie bold und italic sind möglich. Erzeugt: | ||||||||||||||||||||||||||||||||||||||||||
| 1358 | |||||||||||||||||||||||||||||||||||||||||||
| 1359 | <code>TEXT</code> | ||||||||||||||||||||||||||||||||||||||||||
| 1360 | |||||||||||||||||||||||||||||||||||||||||||
| 1361 | =item nowiki | ||||||||||||||||||||||||||||||||||||||||||
| 1362 | |||||||||||||||||||||||||||||||||||||||||||
| 1363 | Erzeugt: | ||||||||||||||||||||||||||||||||||||||||||
| 1364 | |||||||||||||||||||||||||||||||||||||||||||
| 1365 | <nowiki>TEXT</nowiki> | ||||||||||||||||||||||||||||||||||||||||||
| 1366 | |||||||||||||||||||||||||||||||||||||||||||
| 1367 | =item nl | ||||||||||||||||||||||||||||||||||||||||||
| 1368 | |||||||||||||||||||||||||||||||||||||||||||
| 1369 | Erzeugt: | ||||||||||||||||||||||||||||||||||||||||||
| 1370 | |||||||||||||||||||||||||||||||||||||||||||
| 1371 | <br /> | ||||||||||||||||||||||||||||||||||||||||||
| 1372 | |||||||||||||||||||||||||||||||||||||||||||
| 1373 | =item quote | ||||||||||||||||||||||||||||||||||||||||||
| 1374 | |||||||||||||||||||||||||||||||||||||||||||
| 1375 | Erzeugt: | ||||||||||||||||||||||||||||||||||||||||||
| 1376 | |||||||||||||||||||||||||||||||||||||||||||
| 1377 | <q>TEXT</q> | ||||||||||||||||||||||||||||||||||||||||||
| 1378 | |||||||||||||||||||||||||||||||||||||||||||
| 1379 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1380 | |||||||||||||||||||||||||||||||||||||||||||
| 1381 | =head4 See Also | ||||||||||||||||||||||||||||||||||||||||||
| 1382 | |||||||||||||||||||||||||||||||||||||||||||
| 1383 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||
| 1384 | |||||||||||||||||||||||||||||||||||||||||||
| 1385 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 1386 | |||||||||||||||||||||||||||||||||||||||||||
| 1387 | Syntax: L<https://www.mediawiki.org/wiki/Help:Formatting> | ||||||||||||||||||||||||||||||||||||||||||
| 1388 | |||||||||||||||||||||||||||||||||||||||||||
| 1389 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1390 | |||||||||||||||||||||||||||||||||||||||||||
| 1391 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1392 | |||||||||||||||||||||||||||||||||||||||||||
| 1393 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1394 | |||||||||||||||||||||||||||||||||||||||||||
| 1395 | 5 | ▶ | sub fmt { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fmt: called CC=11 SCAR=30.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1396 | 5 | my ($self,$type,$text) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1397 | |||||||||||||||||||||||||||||||||||||||||||
| 1398 | 5 | my $code = Quiq::Unindent->trim($text); | |||||||||||||||||||||||||||||||||||||||||
| 1399 | 5 | ▶ | if ($code ne '') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1400 | # Text einzeilig machen | ||||||||||||||||||||||||||||||||||||||||||
| 1401 | 3 | $code =~ s/\n+/ /g; | |||||||||||||||||||||||||||||||||||||||||
| 1402 | |||||||||||||||||||||||||||||||||||||||||||
| 1403 | 3 | ▶ | if ($type eq 'comment') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 9 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1404 | 2 | $code = "<!-- $code -->"; | |||||||||||||||||||||||||||||||||||||||||
| 1405 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1406 | elsif ($type eq 'italic') { | ||||||||||||||||||||||||||||||||||||||||||
| 1407 | 0 | $code = "''$code''"; | |||||||||||||||||||||||||||||||||||||||||
| 1408 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1409 | elsif ($type eq 'bold') { | ||||||||||||||||||||||||||||||||||||||||||
| 1410 | 0 | $code = "'''$code'''"; | |||||||||||||||||||||||||||||||||||||||||
| 1411 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1412 | elsif ($type eq 'boldItalic') { | ||||||||||||||||||||||||||||||||||||||||||
| 1413 | 0 | $code = "'''''$code'''''"; | |||||||||||||||||||||||||||||||||||||||||
| 1414 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1415 | elsif ($type eq 'code') { | ||||||||||||||||||||||||||||||||||||||||||
| 1416 | 0 | $code = "<code><nowiki>$code</nowiki></code>"; | |||||||||||||||||||||||||||||||||||||||||
| 1417 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1418 | elsif ($type eq 'codeWithFormatting') { | ||||||||||||||||||||||||||||||||||||||||||
| 1419 | 0 | $code = "<code>$code</code>"; | |||||||||||||||||||||||||||||||||||||||||
| 1420 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1421 | elsif ($type eq 'nowiki') { | ||||||||||||||||||||||||||||||||||||||||||
| 1422 | 0 | $code = "<nowiki>$code</nowiki>"; | |||||||||||||||||||||||||||||||||||||||||
| 1423 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1424 | elsif ($type eq 'quote') { | ||||||||||||||||||||||||||||||||||||||||||
| 1425 | 0 | $code = "<q>$code</q>"; | |||||||||||||||||||||||||||||||||||||||||
| 1426 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1427 | elsif ($type eq 'nl') { | ||||||||||||||||||||||||||||||||||||||||||
| 1428 | 0 | $code = '<br />'; | |||||||||||||||||||||||||||||||||||||||||
| 1429 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1430 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1431 | 1 | $self->throw( | |||||||||||||||||||||||||||||||||||||||||
| 1432 | 'MEDIAWIKI-00001: Unknown inline format', | ||||||||||||||||||||||||||||||||||||||||||
| 1433 | Format => $type, | ||||||||||||||||||||||||||||||||||||||||||
| 1434 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1435 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1436 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1437 | |||||||||||||||||||||||||||||||||||||||||||
| 1438 | 4 | return $code; | |||||||||||||||||||||||||||||||||||||||||
| 1439 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1440 | |||||||||||||||||||||||||||||||||||||||||||
| 1441 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1442 | |||||||||||||||||||||||||||||||||||||||||||
| 1443 | =head3 indent() - Erzeuge Einrückung | ||||||||||||||||||||||||||||||||||||||||||
| 1444 | |||||||||||||||||||||||||||||||||||||||||||
| 1445 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 1446 | |||||||||||||||||||||||||||||||||||||||||||
| 1447 | $code = $gen->indent($n); | ||||||||||||||||||||||||||||||||||||||||||
| 1448 | |||||||||||||||||||||||||||||||||||||||||||
| 1449 | =head4 Returns | ||||||||||||||||||||||||||||||||||||||||||
| 1450 | |||||||||||||||||||||||||||||||||||||||||||
| 1451 | Markup-Code (String) | ||||||||||||||||||||||||||||||||||||||||||
| 1452 | |||||||||||||||||||||||||||||||||||||||||||
| 1453 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||
| 1454 | |||||||||||||||||||||||||||||||||||||||||||
| 1455 | Erzeuge den MediaWiki Markup-Code für eine Einrückung der Tiefe $n | ||||||||||||||||||||||||||||||||||||||||||
| 1456 | und liefere diesen zurück. | ||||||||||||||||||||||||||||||||||||||||||
| 1457 | |||||||||||||||||||||||||||||||||||||||||||
| 1458 | =head4 See Also | ||||||||||||||||||||||||||||||||||||||||||
| 1459 | |||||||||||||||||||||||||||||||||||||||||||
| 1460 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||
| 1461 | |||||||||||||||||||||||||||||||||||||||||||
| 1462 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 1463 | |||||||||||||||||||||||||||||||||||||||||||
| 1464 | Syntax: L<https://www.mediawiki.org/wiki/Help:Formatting> | ||||||||||||||||||||||||||||||||||||||||||
| 1465 | |||||||||||||||||||||||||||||||||||||||||||
| 1466 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1467 | |||||||||||||||||||||||||||||||||||||||||||
| 1468 | =head4 Example | ||||||||||||||||||||||||||||||||||||||||||
| 1469 | |||||||||||||||||||||||||||||||||||||||||||
| 1470 | $gen->indent(2); | ||||||||||||||||||||||||||||||||||||||||||
| 1471 | |||||||||||||||||||||||||||||||||||||||||||
| 1472 | erzeugt | ||||||||||||||||||||||||||||||||||||||||||
| 1473 | |||||||||||||||||||||||||||||||||||||||||||
| 1474 | :: | ||||||||||||||||||||||||||||||||||||||||||
| 1475 | |||||||||||||||||||||||||||||||||||||||||||
| 1476 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1477 | |||||||||||||||||||||||||||||||||||||||||||
| 1478 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1479 | |||||||||||||||||||||||||||||||||||||||||||
| 1480 | 2 | ▶ | sub indent { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
indent: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1481 | 2 | my ($self,$n) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1482 | 2 | return ':' x $n; | |||||||||||||||||||||||||||||||||||||||||
| 1483 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1484 | |||||||||||||||||||||||||||||||||||||||||||
| 1485 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1486 | |||||||||||||||||||||||||||||||||||||||||||
| 1487 | =head3 link() - Erzeuge internen oder externen Link | ||||||||||||||||||||||||||||||||||||||||||
| 1488 | |||||||||||||||||||||||||||||||||||||||||||
| 1489 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 1490 | |||||||||||||||||||||||||||||||||||||||||||
| 1491 | $code = $gen->link($type,$destination,$text); | ||||||||||||||||||||||||||||||||||||||||||
| 1492 | |||||||||||||||||||||||||||||||||||||||||||
| 1493 | =head4 Arguments | ||||||||||||||||||||||||||||||||||||||||||
| 1494 | |||||||||||||||||||||||||||||||||||||||||||
| 1495 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 1496 | |||||||||||||||||||||||||||||||||||||||||||
| 1497 | =item $type | ||||||||||||||||||||||||||||||||||||||||||
| 1498 | |||||||||||||||||||||||||||||||||||||||||||
| 1499 | Art des Link. Mögliche Werte: 'internal', 'external'. | ||||||||||||||||||||||||||||||||||||||||||
| 1500 | |||||||||||||||||||||||||||||||||||||||||||
| 1501 | =item $destination | ||||||||||||||||||||||||||||||||||||||||||
| 1502 | |||||||||||||||||||||||||||||||||||||||||||
| 1503 | Link-Ziel. | ||||||||||||||||||||||||||||||||||||||||||
| 1504 | |||||||||||||||||||||||||||||||||||||||||||
| 1505 | =item $text | ||||||||||||||||||||||||||||||||||||||||||
| 1506 | |||||||||||||||||||||||||||||||||||||||||||
| 1507 | Link-Text. | ||||||||||||||||||||||||||||||||||||||||||
| 1508 | |||||||||||||||||||||||||||||||||||||||||||
| 1509 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1510 | |||||||||||||||||||||||||||||||||||||||||||
| 1511 | =head4 Returns | ||||||||||||||||||||||||||||||||||||||||||
| 1512 | |||||||||||||||||||||||||||||||||||||||||||
| 1513 | Markup-Code (String) | ||||||||||||||||||||||||||||||||||||||||||
| 1514 | |||||||||||||||||||||||||||||||||||||||||||
| 1515 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||
| 1516 | |||||||||||||||||||||||||||||||||||||||||||
| 1517 | Erzeuge den MediaWiki Markup-Code für einen internen oder externen | ||||||||||||||||||||||||||||||||||||||||||
| 1518 | Link und liefere diesen zurück. | ||||||||||||||||||||||||||||||||||||||||||
| 1519 | |||||||||||||||||||||||||||||||||||||||||||
| 1520 | =head4 See Also | ||||||||||||||||||||||||||||||||||||||||||
| 1521 | |||||||||||||||||||||||||||||||||||||||||||
| 1522 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||
| 1523 | |||||||||||||||||||||||||||||||||||||||||||
| 1524 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 1525 | |||||||||||||||||||||||||||||||||||||||||||
| 1526 | Syntax: L<https://www.mediawiki.org/wiki/Help:Formatting> | ||||||||||||||||||||||||||||||||||||||||||
| 1527 | |||||||||||||||||||||||||||||||||||||||||||
| 1528 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1529 | |||||||||||||||||||||||||||||||||||||||||||
| 1530 | =head4 Examples | ||||||||||||||||||||||||||||||||||||||||||
| 1531 | |||||||||||||||||||||||||||||||||||||||||||
| 1532 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||
| 1533 | |||||||||||||||||||||||||||||||||||||||||||
| 1534 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 1535 | |||||||||||||||||||||||||||||||||||||||||||
| 1536 | Interner Link | ||||||||||||||||||||||||||||||||||||||||||
| 1537 | |||||||||||||||||||||||||||||||||||||||||||
| 1538 | $gen->link('internal','Transaktionssicherheit', | ||||||||||||||||||||||||||||||||||||||||||
| 1539 | 'Abschnitt Transaktiossicherheit'); | ||||||||||||||||||||||||||||||||||||||||||
| 1540 | |||||||||||||||||||||||||||||||||||||||||||
| 1541 | erzeugt | ||||||||||||||||||||||||||||||||||||||||||
| 1542 | |||||||||||||||||||||||||||||||||||||||||||
| 1543 | [[#Transaktionssicherheit|Abschnitt Transaktiossicherheit]] | ||||||||||||||||||||||||||||||||||||||||||
| 1544 | |||||||||||||||||||||||||||||||||||||||||||
| 1545 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 1546 | |||||||||||||||||||||||||||||||||||||||||||
| 1547 | Externer Link | ||||||||||||||||||||||||||||||||||||||||||
| 1548 | |||||||||||||||||||||||||||||||||||||||||||
| 1549 | $gen->link('external','http::/fseitz.de','Homepage Frank Seitz'); | ||||||||||||||||||||||||||||||||||||||||||
| 1550 | |||||||||||||||||||||||||||||||||||||||||||
| 1551 | erzeugt | ||||||||||||||||||||||||||||||||||||||||||
| 1552 | |||||||||||||||||||||||||||||||||||||||||||
| 1553 | [http::/fseitz.de/ Homepage Frank Seitz] | ||||||||||||||||||||||||||||||||||||||||||
| 1554 | |||||||||||||||||||||||||||||||||||||||||||
| 1555 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 1556 | |||||||||||||||||||||||||||||||||||||||||||
| 1557 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1558 | |||||||||||||||||||||||||||||||||||||||||||
| 1559 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1560 | |||||||||||||||||||||||||||||||||||||||||||
| 1561 | 2 | ▶ | sub link { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
link: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1562 | 2 | my ($self,$type,$destination,$text) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1563 | |||||||||||||||||||||||||||||||||||||||||||
| 1564 | 2 | ▶ | if ($type eq 'internal') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1565 | 1 | return sprintf '[[#%s|%s]]',$destination,$text; | |||||||||||||||||||||||||||||||||||||||||
| 1566 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1567 | elsif ($type eq 'external') { | ||||||||||||||||||||||||||||||||||||||||||
| 1568 | 1 | return sprintf '[%s %s]',$destination,$text; | |||||||||||||||||||||||||||||||||||||||||
| 1569 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1570 | |||||||||||||||||||||||||||||||||||||||||||
| 1571 | 0 | $self->throw; | |||||||||||||||||||||||||||||||||||||||||
| 1572 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1573 | |||||||||||||||||||||||||||||||||||||||||||
| 1574 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1575 | |||||||||||||||||||||||||||||||||||||||||||
| 1576 | =head2 Sonstiges | ||||||||||||||||||||||||||||||||||||||||||
| 1577 | |||||||||||||||||||||||||||||||||||||||||||
| 1578 | =head3 protect() - Schütze Metazeichen | ||||||||||||||||||||||||||||||||||||||||||
| 1579 | |||||||||||||||||||||||||||||||||||||||||||
| 1580 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 1581 | |||||||||||||||||||||||||||||||||||||||||||
| 1582 | $code = $gen->protect($text); | ||||||||||||||||||||||||||||||||||||||||||
| 1583 | |||||||||||||||||||||||||||||||||||||||||||
| 1584 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||
| 1585 | |||||||||||||||||||||||||||||||||||||||||||
| 1586 | Schütze alle Metazeichen in Text $text, so dass das Resultat als Inhalt | ||||||||||||||||||||||||||||||||||||||||||
| 1587 | in eine MediaWiki-Seite eingesetzt werden kann. | ||||||||||||||||||||||||||||||||||||||||||
| 1588 | |||||||||||||||||||||||||||||||||||||||||||
| 1589 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1590 | |||||||||||||||||||||||||||||||||||||||||||
| 1591 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1592 | |||||||||||||||||||||||||||||||||||||||||||
| 1593 | 0 | ▶ | sub protect { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
protect: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1594 | 0 | my ($self,$text) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1595 | |||||||||||||||||||||||||||||||||||||||||||
| 1596 | 0 | ▶ | if (defined $text) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1597 | #$text =~ s/&/&/g; | ||||||||||||||||||||||||||||||||||||||||||
| 1598 | #$text =~ s/</</g; | ||||||||||||||||||||||||||||||||||||||||||
| 1599 | #$text =~ s/>/>/g; | ||||||||||||||||||||||||||||||||||||||||||
| 1600 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1601 | |||||||||||||||||||||||||||||||||||||||||||
| 1602 | 0 | return $text; | |||||||||||||||||||||||||||||||||||||||||
| 1603 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1604 | |||||||||||||||||||||||||||||||||||||||||||
| 1605 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1606 | |||||||||||||||||||||||||||||||||||||||||||
| 1607 | =head2 Testseite | ||||||||||||||||||||||||||||||||||||||||||
| 1608 | |||||||||||||||||||||||||||||||||||||||||||
| 1609 | =head3 testPage() - Erzeuge Test-Seite | ||||||||||||||||||||||||||||||||||||||||||
| 1610 | |||||||||||||||||||||||||||||||||||||||||||
| 1611 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||
| 1612 | |||||||||||||||||||||||||||||||||||||||||||
| 1613 | $code = $this->testPage; | ||||||||||||||||||||||||||||||||||||||||||
| 1614 | |||||||||||||||||||||||||||||||||||||||||||
| 1615 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||
| 1616 | |||||||||||||||||||||||||||||||||||||||||||
| 1617 | Erzeuge eine Seite mit MediaWiki-Markup. Diese Seite kann in ein | ||||||||||||||||||||||||||||||||||||||||||
| 1618 | MediaWiki übertragen und dort optisch begutachtet werden. | ||||||||||||||||||||||||||||||||||||||||||
| 1619 | |||||||||||||||||||||||||||||||||||||||||||
| 1620 | =head4 Example | ||||||||||||||||||||||||||||||||||||||||||
| 1621 | |||||||||||||||||||||||||||||||||||||||||||
| 1622 | $ perl -MQuiq::MediaWiki::Markup -C -E 'print Quiq::MediaWiki::Markup->testPage' | ||||||||||||||||||||||||||||||||||||||||||
| 1623 | |||||||||||||||||||||||||||||||||||||||||||
| 1624 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1625 | |||||||||||||||||||||||||||||||||||||||||||
| 1626 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1627 | |||||||||||||||||||||||||||||||||||||||||||
| 1628 | 0 | ▶ | sub testPage { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
testPage: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1629 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1630 | |||||||||||||||||||||||||||||||||||||||||||
| 1631 | 0 | my $gen = $class->new; | |||||||||||||||||||||||||||||||||||||||||
| 1632 | |||||||||||||||||||||||||||||||||||||||||||
| 1633 | # Kommentar-Block | ||||||||||||||||||||||||||||||||||||||||||
| 1634 | |||||||||||||||||||||||||||||||||||||||||||
| 1635 | 0 | my $code .= $gen->comment(q~ | |||||||||||||||||||||||||||||||||||||||||
| 1636 | Dies ist ein Test-Dokument, das alle von der Klasse | ||||||||||||||||||||||||||||||||||||||||||
| 1637 | Quiq::MediaWiki::Markup implementierten Syntaxelemente | ||||||||||||||||||||||||||||||||||||||||||
| 1638 | enthält und in ein MediaWiki-Wiki geladen werden kann. | ||||||||||||||||||||||||||||||||||||||||||
| 1639 | ~); | ||||||||||||||||||||||||||||||||||||||||||
| 1640 | |||||||||||||||||||||||||||||||||||||||||||
| 1641 | # Table of contents | ||||||||||||||||||||||||||||||||||||||||||
| 1642 | |||||||||||||||||||||||||||||||||||||||||||
| 1643 | 0 | $code .= $gen->tableOfContents(1); | |||||||||||||||||||||||||||||||||||||||||
| 1644 | |||||||||||||||||||||||||||||||||||||||||||
| 1645 | # Section | ||||||||||||||||||||||||||||||||||||||||||
| 1646 | |||||||||||||||||||||||||||||||||||||||||||
| 1647 | 0 | $code .= $gen->section(1,'Überschrift 1'); | |||||||||||||||||||||||||||||||||||||||||
| 1648 | 0 | $code .= $gen->section(2,'Überschrift 2'); | |||||||||||||||||||||||||||||||||||||||||
| 1649 | 0 | $code .= $gen->section(3,'Überschrift 3'); | |||||||||||||||||||||||||||||||||||||||||
| 1650 | 0 | $code .= $gen->section(4,'Überschrift 4'); | |||||||||||||||||||||||||||||||||||||||||
| 1651 | 0 | $code .= $gen->section(5,'Überschrift 5'); | |||||||||||||||||||||||||||||||||||||||||
| 1652 | 0 | $code .= $gen->section(6,'Überschrift 6'); | |||||||||||||||||||||||||||||||||||||||||
| 1653 | |||||||||||||||||||||||||||||||||||||||||||
| 1654 | # Paragraph | ||||||||||||||||||||||||||||||||||||||||||
| 1655 | |||||||||||||||||||||||||||||||||||||||||||
| 1656 | 0 | $code .= $gen->section(1,'Paragraph, Horizontal Rule'); | |||||||||||||||||||||||||||||||||||||||||
| 1657 | |||||||||||||||||||||||||||||||||||||||||||
| 1658 | 0 | $code .= $gen->paragraph(q~ | |||||||||||||||||||||||||||||||||||||||||
| 1659 | Dies ist | ||||||||||||||||||||||||||||||||||||||||||
| 1660 | ein Paragraph. | ||||||||||||||||||||||||||||||||||||||||||
| 1661 | ~); | ||||||||||||||||||||||||||||||||||||||||||
| 1662 | |||||||||||||||||||||||||||||||||||||||||||
| 1663 | # Horizontal Rule | ||||||||||||||||||||||||||||||||||||||||||
| 1664 | |||||||||||||||||||||||||||||||||||||||||||
| 1665 | 0 | $code .= $gen->horizontalRule; | |||||||||||||||||||||||||||||||||||||||||
| 1666 | |||||||||||||||||||||||||||||||||||||||||||
| 1667 | # Paragraph | ||||||||||||||||||||||||||||||||||||||||||
| 1668 | |||||||||||||||||||||||||||||||||||||||||||
| 1669 | 0 | $code .= $gen->paragraph(q~ | |||||||||||||||||||||||||||||||||||||||||
| 1670 | Dies ist noch ein Paragraph | ||||||||||||||||||||||||||||||||||||||||||
| 1671 | unterhalb einer horizontalen | ||||||||||||||||||||||||||||||||||||||||||
| 1672 | Trennline. | ||||||||||||||||||||||||||||||||||||||||||
| 1673 | ~); | ||||||||||||||||||||||||||||||||||||||||||
| 1674 | |||||||||||||||||||||||||||||||||||||||||||
| 1675 | # Listen | ||||||||||||||||||||||||||||||||||||||||||
| 1676 | |||||||||||||||||||||||||||||||||||||||||||
| 1677 | 0 | $code .= $gen->section(1,'Listen'); | |||||||||||||||||||||||||||||||||||||||||
| 1678 | |||||||||||||||||||||||||||||||||||||||||||
| 1679 | 0 | $code .= $gen->section(2,'Punktliste'); | |||||||||||||||||||||||||||||||||||||||||
| 1680 | 0 | $code .= $gen->list('*',['Apfel','Birne','Pflaume']); | |||||||||||||||||||||||||||||||||||||||||
| 1681 | |||||||||||||||||||||||||||||||||||||||||||
| 1682 | 0 | $code .= $gen->section(2,'Nummerierungsliste'); | |||||||||||||||||||||||||||||||||||||||||
| 1683 | 0 | $code .= $gen->list('#',['Gurke','Spargel','Tomate']); | |||||||||||||||||||||||||||||||||||||||||
| 1684 | |||||||||||||||||||||||||||||||||||||||||||
| 1685 | 0 | $code .= $gen->section(2,'Definitionsliste'); | |||||||||||||||||||||||||||||||||||||||||
| 1686 | 0 | $code .= $gen->list(';',[A=>'Apfel',B=>'Birne',P=>'Pflaume']); | |||||||||||||||||||||||||||||||||||||||||
| 1687 | |||||||||||||||||||||||||||||||||||||||||||
| 1688 | 0 | $code .= $gen->section(2,'Geschachtelte Listen'); | |||||||||||||||||||||||||||||||||||||||||
| 1689 | |||||||||||||||||||||||||||||||||||||||||||
| 1690 | 0 | $code .= $gen->section(3,'Verschachtelte Punktlisten'); | |||||||||||||||||||||||||||||||||||||||||
| 1691 | |||||||||||||||||||||||||||||||||||||||||||
| 1692 | 0 | $code .= $gen->list('*',[ | |||||||||||||||||||||||||||||||||||||||||
| 1693 | 'A', | ||||||||||||||||||||||||||||||||||||||||||
| 1694 | $gen->list('*',[ | ||||||||||||||||||||||||||||||||||||||||||
| 1695 | 'B', | ||||||||||||||||||||||||||||||||||||||||||
| 1696 | $gen->list('*',[ | ||||||||||||||||||||||||||||||||||||||||||
| 1697 | 'C', | ||||||||||||||||||||||||||||||||||||||||||
| 1698 | 'D', | ||||||||||||||||||||||||||||||||||||||||||
| 1699 | 'E', | ||||||||||||||||||||||||||||||||||||||||||
| 1700 | ]), | ||||||||||||||||||||||||||||||||||||||||||
| 1701 | 'F', | ||||||||||||||||||||||||||||||||||||||||||
| 1702 | 'G', | ||||||||||||||||||||||||||||||||||||||||||
| 1703 | ]), | ||||||||||||||||||||||||||||||||||||||||||
| 1704 | 'H', | ||||||||||||||||||||||||||||||||||||||||||
| 1705 | $gen->list('*',[ | ||||||||||||||||||||||||||||||||||||||||||
| 1706 | 'I', | ||||||||||||||||||||||||||||||||||||||||||
| 1707 | 'J', | ||||||||||||||||||||||||||||||||||||||||||
| 1708 | 'K', | ||||||||||||||||||||||||||||||||||||||||||
| 1709 | ]), | ||||||||||||||||||||||||||||||||||||||||||
| 1710 | 'L', | ||||||||||||||||||||||||||||||||||||||||||
| 1711 | 'M', | ||||||||||||||||||||||||||||||||||||||||||
| 1712 | ]); | ||||||||||||||||||||||||||||||||||||||||||
| 1713 | |||||||||||||||||||||||||||||||||||||||||||
| 1714 | 0 | $code .= $gen->section(3,'Punktliste in Nummerierungsliste'); | |||||||||||||||||||||||||||||||||||||||||
| 1715 | |||||||||||||||||||||||||||||||||||||||||||
| 1716 | 0 | $code .= $gen->list('#',[ | |||||||||||||||||||||||||||||||||||||||||
| 1717 | 'Obst', | ||||||||||||||||||||||||||||||||||||||||||
| 1718 | $gen->list('*',[ | ||||||||||||||||||||||||||||||||||||||||||
| 1719 | 'Apfel', | ||||||||||||||||||||||||||||||||||||||||||
| 1720 | 'Birne', | ||||||||||||||||||||||||||||||||||||||||||
| 1721 | 'Pflaume', | ||||||||||||||||||||||||||||||||||||||||||
| 1722 | ]), | ||||||||||||||||||||||||||||||||||||||||||
| 1723 | 'Gemüse', | ||||||||||||||||||||||||||||||||||||||||||
| 1724 | $gen->list('*',[ | ||||||||||||||||||||||||||||||||||||||||||
| 1725 | 'Gurke', | ||||||||||||||||||||||||||||||||||||||||||
| 1726 | 'Spinat', | ||||||||||||||||||||||||||||||||||||||||||
| 1727 | 'Tomate', | ||||||||||||||||||||||||||||||||||||||||||
| 1728 | ]), | ||||||||||||||||||||||||||||||||||||||||||
| 1729 | ]); | ||||||||||||||||||||||||||||||||||||||||||
| 1730 | |||||||||||||||||||||||||||||||||||||||||||
| 1731 | 0 | $code .= $gen->section(1,'Tabelle'); | |||||||||||||||||||||||||||||||||||||||||
| 1732 | |||||||||||||||||||||||||||||||||||||||||||
| 1733 | 0 | $code .= $gen->table( | |||||||||||||||||||||||||||||||||||||||||
| 1734 | alignments => ['left','right','center'], | ||||||||||||||||||||||||||||||||||||||||||
| 1735 | caption => 'Eine Tabelle', | ||||||||||||||||||||||||||||||||||||||||||
| 1736 | titles => ['L','R','Z'], | ||||||||||||||||||||||||||||||||||||||||||
| 1737 | rows => [ | ||||||||||||||||||||||||||||||||||||||||||
| 1738 | ['A',1,'ABCDEFG'], | ||||||||||||||||||||||||||||||||||||||||||
| 1739 | ['AB',12,'HIJKL'], | ||||||||||||||||||||||||||||||||||||||||||
| 1740 | ['ABC',123,'MNO'], | ||||||||||||||||||||||||||||||||||||||||||
| 1741 | ['ABCD',1234,'P'], | ||||||||||||||||||||||||||||||||||||||||||
| 1742 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 1743 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1744 | |||||||||||||||||||||||||||||||||||||||||||
| 1745 | # Code | ||||||||||||||||||||||||||||||||||||||||||
| 1746 | |||||||||||||||||||||||||||||||||||||||||||
| 1747 | 0 | $code .= $gen->section(1,'Code'); | |||||||||||||||||||||||||||||||||||||||||
| 1748 | |||||||||||||||||||||||||||||||||||||||||||
| 1749 | 0 | $code .= $gen->section(2,'Ohne Inline-Formatierung'); | |||||||||||||||||||||||||||||||||||||||||
| 1750 | |||||||||||||||||||||||||||||||||||||||||||
| 1751 | 0 | $code .= $gen->code(q~ | |||||||||||||||||||||||||||||||||||||||||
| 1752 | sub maxFilename { | ||||||||||||||||||||||||||||||||||||||||||
| 1753 | my ($class,$dir) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1754 | |||||||||||||||||||||||||||||||||||||||||||
| 1755 | my $max; | ||||||||||||||||||||||||||||||||||||||||||
| 1756 | my $dh = Quiq::DirHandle->new($dir); | ||||||||||||||||||||||||||||||||||||||||||
| 1757 | while (my $file = $dh->next) { | ||||||||||||||||||||||||||||||||||||||||||
| 1758 | if ($file eq '.' || $file eq '..') { | ||||||||||||||||||||||||||||||||||||||||||
| 1759 | next; | ||||||||||||||||||||||||||||||||||||||||||
| 1760 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1761 | if (!defined($max) || $file gt $max) { | ||||||||||||||||||||||||||||||||||||||||||
| 1762 | $max = $file; | ||||||||||||||||||||||||||||||||||||||||||
| 1763 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1764 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1765 | $dh->close; | ||||||||||||||||||||||||||||||||||||||||||
| 1766 | |||||||||||||||||||||||||||||||||||||||||||
| 1767 | return $max; | ||||||||||||||||||||||||||||||||||||||||||
| 1768 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1769 | ~); | ||||||||||||||||||||||||||||||||||||||||||
| 1770 | |||||||||||||||||||||||||||||||||||||||||||
| 1771 | 0 | $code .= $gen->section(2,'Mit Inline-Formatierung'); | |||||||||||||||||||||||||||||||||||||||||
| 1772 | |||||||||||||||||||||||||||||||||||||||||||
| 1773 | 0 | $code .= $gen->code(q~ | |||||||||||||||||||||||||||||||||||||||||
| 1774 | sub '''maxFilename''' { | ||||||||||||||||||||||||||||||||||||||||||
| 1775 | '''my''' ($''class'',$''dir'') = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1776 | |||||||||||||||||||||||||||||||||||||||||||
| 1777 | '''my''' $''max''; | ||||||||||||||||||||||||||||||||||||||||||
| 1778 | '''my''' $''dh'' = '''Quiq::DirHandle'''->'''new'''($''dir''); | ||||||||||||||||||||||||||||||||||||||||||
| 1779 | while ('''my''' $''file'' = $''dh''->'''next''') { | ||||||||||||||||||||||||||||||||||||||||||
| 1780 | if ($''file'' '''eq''' '.' || $''file'' '''eq''' '..') { | ||||||||||||||||||||||||||||||||||||||||||
| 1781 | '''next'''; | ||||||||||||||||||||||||||||||||||||||||||
| 1782 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1783 | if (!'''defined'''($''max'') || $''file'' '''gt''' $''max'') { | ||||||||||||||||||||||||||||||||||||||||||
| 1784 | $''max'' = $''file''; | ||||||||||||||||||||||||||||||||||||||||||
| 1785 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1786 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1787 | $''dh''->'''close'''; | ||||||||||||||||||||||||||||||||||||||||||
| 1788 | |||||||||||||||||||||||||||||||||||||||||||
| 1789 | '''return''' $''max''; | ||||||||||||||||||||||||||||||||||||||||||
| 1790 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1791 | ~,1); | ||||||||||||||||||||||||||||||||||||||||||
| 1792 | |||||||||||||||||||||||||||||||||||||||||||
| 1793 | # Segmente | ||||||||||||||||||||||||||||||||||||||||||
| 1794 | |||||||||||||||||||||||||||||||||||||||||||
| 1795 | 0 | $code .= $gen->section(1,'Segmente'); | |||||||||||||||||||||||||||||||||||||||||
| 1796 | |||||||||||||||||||||||||||||||||||||||||||
| 1797 | 0 | $code .= 'italic: '.$gen->fmt('italic','Kursive Schrift')."\n\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1798 | 0 | $code .= 'bold: '.$gen->fmt('bold','Fette Schrift')."\n\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1799 | 0 | $code .= 'boldItalic: '. | |||||||||||||||||||||||||||||||||||||||||
| 1800 | $gen->fmt('boldItalic','Fette und kursive Schrift')."\n\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 1801 | |||||||||||||||||||||||||||||||||||||||||||
| 1802 | 0 | $code .= 'code: '. | |||||||||||||||||||||||||||||||||||||||||
| 1803 | $gen->fmt('code',q~Keine '''Interpretation''' <code>$x</code>~). | ||||||||||||||||||||||||||||||||||||||||||
| 1804 | "\n\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 1805 | 0 | $code .= 'codeWithFormatting: '. | |||||||||||||||||||||||||||||||||||||||||
| 1806 | $gen->fmt('codeWithFormatting',q|$''x'' = $''img''->xPos();|). | ||||||||||||||||||||||||||||||||||||||||||
| 1807 | "\n\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 1808 | 0 | $code .= 'nowiki: '. | |||||||||||||||||||||||||||||||||||||||||
| 1809 | $gen->fmt('nowiki',q~Keine '''Interpretation''' <code>$x</code>~). | ||||||||||||||||||||||||||||||||||||||||||
| 1810 | "\n\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 1811 | |||||||||||||||||||||||||||||||||||||||||||
| 1812 | 0 | $code .= 'geschachtelt: '. | |||||||||||||||||||||||||||||||||||||||||
| 1813 | $gen->fmt('italic','Kursive und '. | ||||||||||||||||||||||||||||||||||||||||||
| 1814 | $gen->fmt('bold','fette').' Schrift' | ||||||||||||||||||||||||||||||||||||||||||
| 1815 | ).', '. | ||||||||||||||||||||||||||||||||||||||||||
| 1816 | $gen->fmt('bold','Fette und '. | ||||||||||||||||||||||||||||||||||||||||||
| 1817 | $gen->fmt('italic','kursive').' Schrift' | ||||||||||||||||||||||||||||||||||||||||||
| 1818 | )."\n\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 1819 | |||||||||||||||||||||||||||||||||||||||||||
| 1820 | # Kommentar-Segment | ||||||||||||||||||||||||||||||||||||||||||
| 1821 | |||||||||||||||||||||||||||||||||||||||||||
| 1822 | 0 | $code .= $gen->fmt('comment','eof'); | |||||||||||||||||||||||||||||||||||||||||
| 1823 | 0 | $code .= "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1824 | |||||||||||||||||||||||||||||||||||||||||||
| 1825 | 0 | return $code; | |||||||||||||||||||||||||||||||||||||||||
| 1826 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1827 | |||||||||||||||||||||||||||||||||||||||||||
| 1828 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1829 | |||||||||||||||||||||||||||||||||||||||||||
| 1830 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||
| 1831 | |||||||||||||||||||||||||||||||||||||||||||
| 1832 | 1.240 | ||||||||||||||||||||||||||||||||||||||||||
| 1833 | |||||||||||||||||||||||||||||||||||||||||||
| 1834 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 1835 | |||||||||||||||||||||||||||||||||||||||||||
| 1836 | Frank Seitz, L<http://fseitz.de/> | ||||||||||||||||||||||||||||||||||||||||||
| 1837 | |||||||||||||||||||||||||||||||||||||||||||
| 1838 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||
| 1839 | |||||||||||||||||||||||||||||||||||||||||||
| 1840 | Copyright (C) 2026 Frank Seitz | ||||||||||||||||||||||||||||||||||||||||||
| 1841 | |||||||||||||||||||||||||||||||||||||||||||
| 1842 | =head1 LICENSE | ||||||||||||||||||||||||||||||||||||||||||
| 1843 | |||||||||||||||||||||||||||||||||||||||||||
| 1844 | This code is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||
| 1845 | it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||
| 1846 | |||||||||||||||||||||||||||||||||||||||||||
| 1847 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1848 | |||||||||||||||||||||||||||||||||||||||||||
| 1849 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||
| 1850 | |||||||||||||||||||||||||||||||||||||||||||
| 1851 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 1852 | |||||||||||||||||||||||||||||||||||||||||||
| 1853 | # eof | ||||||||||||||||||||||||||||||||||||||||||