1# Copyright (c) 2005 - 2006 Hans Jeuken. All rights reserved. 2# This program is free software; you can redistribute it and/or 3# modify it under the same terms as Perl itself. 4 5# This file was generated from the 'html.xml' file of the syntax highlight 6# engine of the kate text editor (http://www.kate-editor.org 7 8#kate xml version 1.98 9#kate version 2.4 10#kate author Wilbert Berendsen (wilbert@kde.nl) 11#generated: Sun Feb 3 22:02:05 2008, localtime 12 13package Syntax::Highlight::Engine::Kate::HTML; 14 15our $VERSION = '0.14'; 16 17use strict; 18use warnings; 19use base('Syntax::Highlight::Engine::Kate::Template'); 20 21sub new { 22 my $proto = shift; 23 my $class = ref($proto) || $proto; 24 my $self = $class->SUPER::new(@_); 25 $self->attributes({ 26 'Attribute' => 'Others', 27 'CDATA' => 'BaseN', 28 'Comment' => 'Comment', 29 'Doctype' => 'DataType', 30 'Element' => 'Keyword', 31 'EntityRef' => 'DecVal', 32 'Error' => 'Error', 33 'Normal Text' => 'Normal', 34 'PEntityRef' => 'DecVal', 35 'Processing Instruction' => 'Keyword', 36 'Value' => 'String', 37 }); 38 $self->contextdata({ 39 'CDATA' => { 40 callback => \&parseCDATA, 41 attribute => 'Normal Text', 42 }, 43 'CSS' => { 44 callback => \&parseCSS, 45 attribute => 'Normal Text', 46 }, 47 'CSS content' => { 48 callback => \&parseCSScontent, 49 attribute => 'Normal Text', 50 }, 51 'Comment' => { 52 callback => \&parseComment, 53 attribute => 'Comment', 54 }, 55 'Doctype' => { 56 callback => \&parseDoctype, 57 attribute => 'Normal Text', 58 }, 59 'Doctype Internal Subset' => { 60 callback => \&parseDoctypeInternalSubset, 61 attribute => 'Normal Text', 62 }, 63 'Doctype Markupdecl' => { 64 callback => \&parseDoctypeMarkupdecl, 65 attribute => 'Normal Text', 66 }, 67 'Doctype Markupdecl DQ' => { 68 callback => \&parseDoctypeMarkupdeclDQ, 69 attribute => 'Value', 70 }, 71 'Doctype Markupdecl SQ' => { 72 callback => \&parseDoctypeMarkupdeclSQ, 73 attribute => 'Value', 74 }, 75 'El Close' => { 76 callback => \&parseElClose, 77 attribute => 'Normal Text', 78 }, 79 'El Close 2' => { 80 callback => \&parseElClose2, 81 attribute => 'Normal Text', 82 }, 83 'El Close 3' => { 84 callback => \&parseElClose3, 85 attribute => 'Normal Text', 86 }, 87 'El Open' => { 88 callback => \&parseElOpen, 89 attribute => 'Normal Text', 90 }, 91 'FindAttributes' => { 92 callback => \&parseFindAttributes, 93 attribute => 'Normal Text', 94 }, 95 'FindDTDRules' => { 96 callback => \&parseFindDTDRules, 97 attribute => 'Normal Text', 98 }, 99 'FindEntityRefs' => { 100 callback => \&parseFindEntityRefs, 101 attribute => 'Normal Text', 102 }, 103 'FindHTML' => { 104 callback => \&parseFindHTML, 105 attribute => 'Normal Text', 106 }, 107 'FindPEntityRefs' => { 108 callback => \&parseFindPEntityRefs, 109 attribute => 'Normal Text', 110 }, 111 'JS' => { 112 callback => \&parseJS, 113 attribute => 'Normal Text', 114 }, 115 'JS comment close' => { 116 callback => \&parseJScommentclose, 117 attribute => 'Comment', 118 lineending => '#pop', 119 }, 120 'JS content' => { 121 callback => \&parseJScontent, 122 attribute => 'Normal Text', 123 }, 124 'PI' => { 125 callback => \&parsePI, 126 attribute => 'Normal Text', 127 }, 128 'Start' => { 129 callback => \&parseStart, 130 attribute => 'Normal Text', 131 }, 132 'Value' => { 133 callback => \&parseValue, 134 attribute => 'Normal Text', 135 fallthrough => 'Value NQ', 136 }, 137 'Value DQ' => { 138 callback => \&parseValueDQ, 139 attribute => 'Value', 140 }, 141 'Value NQ' => { 142 callback => \&parseValueNQ, 143 attribute => 'Normal Text', 144 lineending => '#pop#pop', 145 fallthrough => '#pop#pop', 146 }, 147 'Value SQ' => { 148 callback => \&parseValueSQ, 149 attribute => 'Value', 150 }, 151 }); 152 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); 153 $self->basecontext('Start'); 154 $self->keywordscase(1); 155 $self->initialize; 156 bless ($self, $class); 157 return $self; 158} 159 160sub language { 161 return 'HTML'; 162} 163 164sub parseCDATA { 165 my ($self, $text) = @_; 166 # type => 'DetectSpaces' 167 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) { 168 return 1 169 } 170 # type => 'DetectIdentifier' 171 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) { 172 return 1 173 } 174 # String => ']]>' 175 # attribute => 'CDATA' 176 # context => '#pop' 177 # endRegion => 'cdata' 178 # type => 'StringDetect' 179 if ($self->testStringDetect($text, ']]>', 0, 0, 0, undef, 0, '#pop', 'CDATA')) { 180 return 1 181 } 182 # String => ']]>' 183 # attribute => 'EntityRef' 184 # context => '#stay' 185 # type => 'StringDetect' 186 if ($self->testStringDetect($text, ']]>', 0, 0, 0, undef, 0, '#stay', 'EntityRef')) { 187 return 1 188 } 189 return 0; 190}; 191 192sub parseCSS { 193 my ($self, $text) = @_; 194 # attribute => 'Element' 195 # char => '/' 196 # char1 => '>' 197 # context => '#pop' 198 # endRegion => 'style' 199 # type => 'Detect2Chars' 200 if ($self->testDetect2Chars($text, '/', '>', 0, 0, 0, undef, 0, '#pop', 'Element')) { 201 return 1 202 } 203 # attribute => 'Element' 204 # char => '>' 205 # context => 'CSS content' 206 # type => 'DetectChar' 207 if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, 'CSS content', 'Element')) { 208 return 1 209 } 210 # context => 'FindAttributes' 211 # type => 'IncludeRules' 212 if ($self->includeRules('FindAttributes', $text)) { 213 return 1 214 } 215 # String => '\S' 216 # attribute => 'Error' 217 # context => '#stay' 218 # type => 'RegExpr' 219 if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) { 220 return 1 221 } 222 return 0; 223}; 224 225sub parseCSScontent { 226 my ($self, $text) = @_; 227 # String => '</style\b' 228 # attribute => 'Element' 229 # context => 'El Close 2' 230 # endRegion => 'style' 231 # insensitive => 'TRUE' 232 # type => 'RegExpr' 233 if ($self->testRegExpr($text, '</style\\b', 1, 0, 0, undef, 0, 'El Close 2', 'Element')) { 234 return 1 235 } 236 # context => '##CSS' 237 # includeAttrib => 'true' 238 # type => 'IncludeRules' 239 if ($self->includePlugin('CSS', $text)) { 240 return 1 241 } 242 return 0; 243}; 244 245sub parseComment { 246 my ($self, $text) = @_; 247 # type => 'DetectSpaces' 248 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) { 249 return 1 250 } 251 # context => '##Alerts' 252 # type => 'IncludeRules' 253 if ($self->includePlugin('Alerts', $text)) { 254 return 1 255 } 256 # type => 'DetectIdentifier' 257 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) { 258 return 1 259 } 260 # String => '-->' 261 # attribute => 'Comment' 262 # context => '#pop' 263 # endRegion => 'comment' 264 # type => 'StringDetect' 265 if ($self->testStringDetect($text, '-->', 0, 0, 0, undef, 0, '#pop', 'Comment')) { 266 return 1 267 } 268 # String => '-(-(?!->))+' 269 # attribute => 'Error' 270 # context => '#stay' 271 # type => 'RegExpr' 272 if ($self->testRegExpr($text, '-(-(?!->))+', 0, 0, 0, undef, 0, '#stay', 'Error')) { 273 return 1 274 } 275 return 0; 276}; 277 278sub parseDoctype { 279 my ($self, $text) = @_; 280 # attribute => 'Doctype' 281 # char => '>' 282 # context => '#pop' 283 # endRegion => 'doctype' 284 # type => 'DetectChar' 285 if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop', 'Doctype')) { 286 return 1 287 } 288 # attribute => 'Doctype' 289 # beginRegion => 'int_subset' 290 # char => '[' 291 # context => 'Doctype Internal Subset' 292 # type => 'DetectChar' 293 if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, 'Doctype Internal Subset', 'Doctype')) { 294 return 1 295 } 296 return 0; 297}; 298 299sub parseDoctypeInternalSubset { 300 my ($self, $text) = @_; 301 # attribute => 'Doctype' 302 # char => ']' 303 # context => '#pop' 304 # endRegion => 'int_subset' 305 # type => 'DetectChar' 306 if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop', 'Doctype')) { 307 return 1 308 } 309 # context => 'FindDTDRules' 310 # type => 'IncludeRules' 311 if ($self->includeRules('FindDTDRules', $text)) { 312 return 1 313 } 314 # String => '<!--' 315 # attribute => 'Comment' 316 # beginRegion => 'comment' 317 # context => 'Comment' 318 # type => 'StringDetect' 319 if ($self->testStringDetect($text, '<!--', 0, 0, 0, undef, 0, 'Comment', 'Comment')) { 320 return 1 321 } 322 # String => '<\?[\w:-]*' 323 # attribute => 'Processing Instruction' 324 # beginRegion => 'pi' 325 # context => 'PI' 326 # type => 'RegExpr' 327 if ($self->testRegExpr($text, '<\\?[\\w:-]*', 0, 0, 0, undef, 0, 'PI', 'Processing Instruction')) { 328 return 1 329 } 330 # context => 'FindPEntityRefs' 331 # type => 'IncludeRules' 332 if ($self->includeRules('FindPEntityRefs', $text)) { 333 return 1 334 } 335 return 0; 336}; 337 338sub parseDoctypeMarkupdecl { 339 my ($self, $text) = @_; 340 # attribute => 'Doctype' 341 # char => '>' 342 # context => '#pop' 343 # type => 'DetectChar' 344 if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop', 'Doctype')) { 345 return 1 346 } 347 # attribute => 'Value' 348 # char => '"' 349 # context => 'Doctype Markupdecl DQ' 350 # type => 'DetectChar' 351 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'Doctype Markupdecl DQ', 'Value')) { 352 return 1 353 } 354 # attribute => 'Value' 355 # char => ''' 356 # context => 'Doctype Markupdecl SQ' 357 # type => 'DetectChar' 358 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'Doctype Markupdecl SQ', 'Value')) { 359 return 1 360 } 361 return 0; 362}; 363 364sub parseDoctypeMarkupdeclDQ { 365 my ($self, $text) = @_; 366 # attribute => 'Value' 367 # char => '"' 368 # context => '#pop' 369 # type => 'DetectChar' 370 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'Value')) { 371 return 1 372 } 373 # context => 'FindPEntityRefs' 374 # type => 'IncludeRules' 375 if ($self->includeRules('FindPEntityRefs', $text)) { 376 return 1 377 } 378 return 0; 379}; 380 381sub parseDoctypeMarkupdeclSQ { 382 my ($self, $text) = @_; 383 # attribute => 'Value' 384 # char => ''' 385 # context => '#pop' 386 # type => 'DetectChar' 387 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'Value')) { 388 return 1 389 } 390 # context => 'FindPEntityRefs' 391 # type => 'IncludeRules' 392 if ($self->includeRules('FindPEntityRefs', $text)) { 393 return 1 394 } 395 return 0; 396}; 397 398sub parseElClose { 399 my ($self, $text) = @_; 400 # attribute => 'Element' 401 # char => '>' 402 # context => '#pop' 403 # type => 'DetectChar' 404 if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop', 'Element')) { 405 return 1 406 } 407 # String => '\S' 408 # attribute => 'Error' 409 # context => '#stay' 410 # type => 'RegExpr' 411 if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) { 412 return 1 413 } 414 return 0; 415}; 416 417sub parseElClose2 { 418 my ($self, $text) = @_; 419 # attribute => 'Element' 420 # char => '>' 421 # context => '#pop#pop#pop' 422 # type => 'DetectChar' 423 if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop#pop#pop', 'Element')) { 424 return 1 425 } 426 # String => '\S' 427 # attribute => 'Error' 428 # context => '#stay' 429 # type => 'RegExpr' 430 if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) { 431 return 1 432 } 433 return 0; 434}; 435 436sub parseElClose3 { 437 my ($self, $text) = @_; 438 # attribute => 'Element' 439 # char => '>' 440 # context => '#pop#pop#pop#pop' 441 # type => 'DetectChar' 442 if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop#pop#pop#pop', 'Element')) { 443 return 1 444 } 445 # String => '\S' 446 # attribute => 'Error' 447 # context => '#stay' 448 # type => 'RegExpr' 449 if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) { 450 return 1 451 } 452 return 0; 453}; 454 455sub parseElOpen { 456 my ($self, $text) = @_; 457 # attribute => 'Element' 458 # char => '/' 459 # char1 => '>' 460 # context => '#pop' 461 # type => 'Detect2Chars' 462 if ($self->testDetect2Chars($text, '/', '>', 0, 0, 0, undef, 0, '#pop', 'Element')) { 463 return 1 464 } 465 # attribute => 'Element' 466 # char => '>' 467 # context => '#pop' 468 # type => 'DetectChar' 469 if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop', 'Element')) { 470 return 1 471 } 472 # context => 'FindAttributes' 473 # type => 'IncludeRules' 474 if ($self->includeRules('FindAttributes', $text)) { 475 return 1 476 } 477 # String => '\S' 478 # attribute => 'Error' 479 # context => '#stay' 480 # type => 'RegExpr' 481 if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) { 482 return 1 483 } 484 return 0; 485}; 486 487sub parseFindAttributes { 488 my ($self, $text) = @_; 489 # String => '[A-Za-z_:][\w.:_-]*' 490 # attribute => 'Attribute' 491 # column => '0' 492 # context => '#stay' 493 # type => 'RegExpr' 494 if ($self->testRegExpr($text, '[A-Za-z_:][\\w.:_-]*', 0, 0, 0, 0, 0, '#stay', 'Attribute')) { 495 return 1 496 } 497 # String => '\s+[A-Za-z_:][\w.:_-]*' 498 # attribute => 'Attribute' 499 # context => '#stay' 500 # type => 'RegExpr' 501 if ($self->testRegExpr($text, '\\s+[A-Za-z_:][\\w.:_-]*', 0, 0, 0, undef, 0, '#stay', 'Attribute')) { 502 return 1 503 } 504 # attribute => 'Attribute' 505 # char => '=' 506 # context => 'Value' 507 # type => 'DetectChar' 508 if ($self->testDetectChar($text, '=', 0, 0, 0, undef, 0, 'Value', 'Attribute')) { 509 return 1 510 } 511 return 0; 512}; 513 514sub parseFindDTDRules { 515 my ($self, $text) = @_; 516 # String => '<!(ELEMENT|ENTITY|ATTLIST|NOTATION)\b' 517 # attribute => 'Doctype' 518 # context => 'Doctype Markupdecl' 519 # type => 'RegExpr' 520 if ($self->testRegExpr($text, '<!(ELEMENT|ENTITY|ATTLIST|NOTATION)\\b', 0, 0, 0, undef, 0, 'Doctype Markupdecl', 'Doctype')) { 521 return 1 522 } 523 return 0; 524}; 525 526sub parseFindEntityRefs { 527 my ($self, $text) = @_; 528 # String => '&(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z_:][\w.:_-]*);' 529 # attribute => 'EntityRef' 530 # context => '#stay' 531 # type => 'RegExpr' 532 if ($self->testRegExpr($text, '&(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z_:][\\w.:_-]*);', 0, 0, 0, undef, 0, '#stay', 'EntityRef')) { 533 return 1 534 } 535 # String => '&<' 536 # attribute => 'Error' 537 # context => '#stay' 538 # type => 'AnyChar' 539 if ($self->testAnyChar($text, '&<', 0, 0, undef, 0, '#stay', 'Error')) { 540 return 1 541 } 542 return 0; 543}; 544 545sub parseFindHTML { 546 my ($self, $text) = @_; 547 # type => 'DetectSpaces' 548 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) { 549 return 1 550 } 551 # type => 'DetectIdentifier' 552 if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) { 553 return 1 554 } 555 # String => '<!--' 556 # attribute => 'Comment' 557 # beginRegion => 'comment' 558 # context => 'Comment' 559 # type => 'StringDetect' 560 if ($self->testStringDetect($text, '<!--', 0, 0, 0, undef, 0, 'Comment', 'Comment')) { 561 return 1 562 } 563 # String => '<![CDATA[' 564 # attribute => 'CDATA' 565 # beginRegion => 'cdata' 566 # context => 'CDATA' 567 # type => 'StringDetect' 568 if ($self->testStringDetect($text, '<![CDATA[', 0, 0, 0, undef, 0, 'CDATA', 'CDATA')) { 569 return 1 570 } 571 # String => '<!DOCTYPE\s+' 572 # attribute => 'Doctype' 573 # beginRegion => 'doctype' 574 # context => 'Doctype' 575 # type => 'RegExpr' 576 if ($self->testRegExpr($text, '<!DOCTYPE\\s+', 0, 0, 0, undef, 0, 'Doctype', 'Doctype')) { 577 return 1 578 } 579 # String => '<\?[\w:-]*' 580 # attribute => 'Processing Instruction' 581 # beginRegion => 'pi' 582 # context => 'PI' 583 # type => 'RegExpr' 584 if ($self->testRegExpr($text, '<\\?[\\w:-]*', 0, 0, 0, undef, 0, 'PI', 'Processing Instruction')) { 585 return 1 586 } 587 # String => '<style\b' 588 # attribute => 'Element' 589 # beginRegion => 'style' 590 # context => 'CSS' 591 # insensitive => 'TRUE' 592 # type => 'RegExpr' 593 if ($self->testRegExpr($text, '<style\\b', 1, 0, 0, undef, 0, 'CSS', 'Element')) { 594 return 1 595 } 596 # String => '<script\b' 597 # attribute => 'Element' 598 # beginRegion => 'script' 599 # context => 'JS' 600 # insensitive => 'TRUE' 601 # type => 'RegExpr' 602 if ($self->testRegExpr($text, '<script\\b', 1, 0, 0, undef, 0, 'JS', 'Element')) { 603 return 1 604 } 605 # String => '<pre\b' 606 # attribute => 'Element' 607 # beginRegion => 'pre' 608 # context => 'El Open' 609 # insensitive => 'TRUE' 610 # type => 'RegExpr' 611 if ($self->testRegExpr($text, '<pre\\b', 1, 0, 0, undef, 0, 'El Open', 'Element')) { 612 return 1 613 } 614 # String => '<div\b' 615 # attribute => 'Element' 616 # beginRegion => 'div' 617 # context => 'El Open' 618 # insensitive => 'TRUE' 619 # type => 'RegExpr' 620 if ($self->testRegExpr($text, '<div\\b', 1, 0, 0, undef, 0, 'El Open', 'Element')) { 621 return 1 622 } 623 # String => '<table\b' 624 # attribute => 'Element' 625 # beginRegion => 'table' 626 # context => 'El Open' 627 # insensitive => 'TRUE' 628 # type => 'RegExpr' 629 if ($self->testRegExpr($text, '<table\\b', 1, 0, 0, undef, 0, 'El Open', 'Element')) { 630 return 1 631 } 632 # String => '<[A-Za-z_:][\w.:_-]*' 633 # attribute => 'Element' 634 # context => 'El Open' 635 # type => 'RegExpr' 636 if ($self->testRegExpr($text, '<[A-Za-z_:][\\w.:_-]*', 0, 0, 0, undef, 0, 'El Open', 'Element')) { 637 return 1 638 } 639 # String => '</pre\b' 640 # attribute => 'Element' 641 # context => 'El Close' 642 # endRegion => 'pre' 643 # insensitive => 'TRUE' 644 # type => 'RegExpr' 645 if ($self->testRegExpr($text, '</pre\\b', 1, 0, 0, undef, 0, 'El Close', 'Element')) { 646 return 1 647 } 648 # String => '</div\b' 649 # attribute => 'Element' 650 # context => 'El Close' 651 # endRegion => 'div' 652 # insensitive => 'TRUE' 653 # type => 'RegExpr' 654 if ($self->testRegExpr($text, '</div\\b', 1, 0, 0, undef, 0, 'El Close', 'Element')) { 655 return 1 656 } 657 # String => '</table\b' 658 # attribute => 'Element' 659 # context => 'El Close' 660 # endRegion => 'table' 661 # insensitive => 'TRUE' 662 # type => 'RegExpr' 663 if ($self->testRegExpr($text, '</table\\b', 1, 0, 0, undef, 0, 'El Close', 'Element')) { 664 return 1 665 } 666 # String => '</[A-Za-z_:][\w.:_-]*' 667 # attribute => 'Element' 668 # context => 'El Close' 669 # type => 'RegExpr' 670 if ($self->testRegExpr($text, '</[A-Za-z_:][\\w.:_-]*', 0, 0, 0, undef, 0, 'El Close', 'Element')) { 671 return 1 672 } 673 # context => 'FindDTDRules' 674 # type => 'IncludeRules' 675 if ($self->includeRules('FindDTDRules', $text)) { 676 return 1 677 } 678 # context => 'FindEntityRefs' 679 # type => 'IncludeRules' 680 if ($self->includeRules('FindEntityRefs', $text)) { 681 return 1 682 } 683 return 0; 684}; 685 686sub parseFindPEntityRefs { 687 my ($self, $text) = @_; 688 # String => '&(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z_:][\w.:_-]*);' 689 # attribute => 'EntityRef' 690 # context => '#stay' 691 # type => 'RegExpr' 692 if ($self->testRegExpr($text, '&(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z_:][\\w.:_-]*);', 0, 0, 0, undef, 0, '#stay', 'EntityRef')) { 693 return 1 694 } 695 # String => '%[A-Za-z_:][\w.:_-]*;' 696 # attribute => 'PEntityRef' 697 # context => '#stay' 698 # type => 'RegExpr' 699 if ($self->testRegExpr($text, '%[A-Za-z_:][\\w.:_-]*;', 0, 0, 0, undef, 0, '#stay', 'PEntityRef')) { 700 return 1 701 } 702 # String => '&%' 703 # attribute => 'Error' 704 # context => '#stay' 705 # type => 'AnyChar' 706 if ($self->testAnyChar($text, '&%', 0, 0, undef, 0, '#stay', 'Error')) { 707 return 1 708 } 709 return 0; 710}; 711 712sub parseJS { 713 my ($self, $text) = @_; 714 # attribute => 'Element' 715 # char => '/' 716 # char1 => '>' 717 # context => '#pop' 718 # endRegion => 'script' 719 # type => 'Detect2Chars' 720 if ($self->testDetect2Chars($text, '/', '>', 0, 0, 0, undef, 0, '#pop', 'Element')) { 721 return 1 722 } 723 # attribute => 'Element' 724 # char => '>' 725 # context => 'JS content' 726 # type => 'DetectChar' 727 if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, 'JS content', 'Element')) { 728 return 1 729 } 730 # context => 'FindAttributes' 731 # type => 'IncludeRules' 732 if ($self->includeRules('FindAttributes', $text)) { 733 return 1 734 } 735 # String => '\S' 736 # attribute => 'Error' 737 # context => '#stay' 738 # type => 'RegExpr' 739 if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#stay', 'Error')) { 740 return 1 741 } 742 return 0; 743}; 744 745sub parseJScommentclose { 746 my ($self, $text) = @_; 747 # String => '</script\b' 748 # attribute => 'Element' 749 # context => 'El Close 3' 750 # endRegion => 'script' 751 # insensitive => 'TRUE' 752 # type => 'RegExpr' 753 if ($self->testRegExpr($text, '</script\\b', 1, 0, 0, undef, 0, 'El Close 3', 'Element')) { 754 return 1 755 } 756 # context => '##Alerts' 757 # type => 'IncludeRules' 758 if ($self->includePlugin('Alerts', $text)) { 759 return 1 760 } 761 return 0; 762}; 763 764sub parseJScontent { 765 my ($self, $text) = @_; 766 # String => '</script\b' 767 # attribute => 'Element' 768 # context => 'El Close 2' 769 # endRegion => 'script' 770 # insensitive => 'TRUE' 771 # type => 'RegExpr' 772 if ($self->testRegExpr($text, '</script\\b', 1, 0, 0, undef, 0, 'El Close 2', 'Element')) { 773 return 1 774 } 775 # String => '//(?=.*</script\b)' 776 # attribute => 'Comment' 777 # context => 'JS comment close' 778 # insensitive => 'TRUE' 779 # type => 'RegExpr' 780 if ($self->testRegExpr($text, '//(?=.*</script\\b)', 1, 0, 0, undef, 0, 'JS comment close', 'Comment')) { 781 return 1 782 } 783 # context => '##JavaScript' 784 # includeAttrib => 'true' 785 # type => 'IncludeRules' 786 if ($self->includePlugin('JavaScript', $text)) { 787 return 1 788 } 789 return 0; 790}; 791 792sub parsePI { 793 my ($self, $text) = @_; 794 # attribute => 'Processing Instruction' 795 # char => '?' 796 # char1 => '>' 797 # context => '#pop' 798 # endRegion => 'pi' 799 # type => 'Detect2Chars' 800 if ($self->testDetect2Chars($text, '?', '>', 0, 0, 0, undef, 0, '#pop', 'Processing Instruction')) { 801 return 1 802 } 803 return 0; 804}; 805 806sub parseStart { 807 my ($self, $text) = @_; 808 # context => 'FindHTML' 809 # type => 'IncludeRules' 810 if ($self->includeRules('FindHTML', $text)) { 811 return 1 812 } 813 return 0; 814}; 815 816sub parseValue { 817 my ($self, $text) = @_; 818 # attribute => 'Value' 819 # char => '"' 820 # context => 'Value DQ' 821 # type => 'DetectChar' 822 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'Value DQ', 'Value')) { 823 return 1 824 } 825 # attribute => 'Value' 826 # char => ''' 827 # context => 'Value SQ' 828 # type => 'DetectChar' 829 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'Value SQ', 'Value')) { 830 return 1 831 } 832 # type => 'DetectSpaces' 833 if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) { 834 return 1 835 } 836 return 0; 837}; 838 839sub parseValueDQ { 840 my ($self, $text) = @_; 841 # attribute => 'Value' 842 # char => '"' 843 # context => '#pop#pop' 844 # type => 'DetectChar' 845 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop#pop', 'Value')) { 846 return 1 847 } 848 # context => 'FindEntityRefs' 849 # type => 'IncludeRules' 850 if ($self->includeRules('FindEntityRefs', $text)) { 851 return 1 852 } 853 return 0; 854}; 855 856sub parseValueNQ { 857 my ($self, $text) = @_; 858 # context => 'FindEntityRefs' 859 # type => 'IncludeRules' 860 if ($self->includeRules('FindEntityRefs', $text)) { 861 return 1 862 } 863 # String => '/(?!>)' 864 # attribute => 'Value' 865 # context => '#stay' 866 # type => 'RegExpr' 867 if ($self->testRegExpr($text, '/(?!>)', 0, 0, 0, undef, 0, '#stay', 'Value')) { 868 return 1 869 } 870 # String => '[^/><"'\s]' 871 # attribute => 'Value' 872 # context => '#stay' 873 # type => 'RegExpr' 874 if ($self->testRegExpr($text, '[^/><"\'\\s]', 0, 0, 0, undef, 0, '#stay', 'Value')) { 875 return 1 876 } 877 return 0; 878}; 879 880sub parseValueSQ { 881 my ($self, $text) = @_; 882 # attribute => 'Value' 883 # char => ''' 884 # context => '#pop#pop' 885 # type => 'DetectChar' 886 if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop#pop', 'Value')) { 887 return 1 888 } 889 # context => 'FindEntityRefs' 890 # type => 'IncludeRules' 891 if ($self->includeRules('FindEntityRefs', $text)) { 892 return 1 893 } 894 return 0; 895}; 896 897 8981; 899 900__END__ 901 902=head1 NAME 903 904Syntax::Highlight::Engine::Kate::HTML - a Plugin for HTML syntax highlighting 905 906=head1 SYNOPSIS 907 908 require Syntax::Highlight::Engine::Kate::HTML; 909 my $sh = new Syntax::Highlight::Engine::Kate::HTML([ 910 ]); 911 912=head1 DESCRIPTION 913 914Syntax::Highlight::Engine::Kate::HTML is a plugin module that provides syntax highlighting 915for HTML to the Syntax::Haghlight::Engine::Kate highlighting engine. 916 917This code is generated from the syntax definition files used 918by the Kate project. 919It works quite fine, but can use refinement and optimization. 920 921It inherits Syntax::Higlight::Engine::Kate::Template. See also there. 922 923=head1 AUTHOR 924 925Hans Jeuken (haje <at> toneel <dot> demon <dot> nl) 926 927=head1 BUGS 928 929Unknown. If you find any, please contact the author