package xm::code::html;

use xm::o;
use xm::code::vars;
use xm::code::func;

sub DESC{"
  highlight sourcecode - HTML mode
"}

# BEGIN {
# taken from nedit
# modified by PP
$LANGUAGE{'html'}       = {
                            'filename'   => '(?i)\\.html?$',
                            'regex'      => '',
                            'patterns'   => [
                                              {
                                                'name'       => 'comment',
                                                'regex'      => '<!--.*?-->',
                                                'style'      => 'comment',
                                                'childregex' => []
                                              },
                                              {
                                                'name'       => 'entity',
                                                'regex'      => '\\&[-.a-zA-Z0-9#]*;?',
                                                'style'      => 'entity',
                                                'childregex' => []
                                              },
                                              {
                                                'name'       => 'tag',
                                                'regex'      => '<(/|!)?[-.a-zA-Z0-9]*.*?>',
                                                'style'      => 'predefined identifier',
                                                'childregex' => [
                                                                  {
                                                                    'name'       => 'double quote string',
                                                                    'regex'      => '".*?"',
                                                                    'style'      => 'string',
                                                                    'childregex' => []
                                                                  },
                                                                  {
                                                                    'name'       => 'single quote string',
                                                                    'regex'      => '\'.*?\'',
                                                                    'style'      => 'string',
                                                                    'childregex' => []
                                                                  },
                                                                  {
                                                                    'name'       => 'brackets',
                                                                    'regex'      => '[<>]',
                                                                    'style'      => 'braces',
                                                                    'childregex' => []
                                                                  },
                                                                  {
                                                                    'name'       => 'attribute',
                                                                    'regex'      => '[^\'" ]+(?=.)',
                                                                    'style'      => 'identifier',
                                                                    'childregex' => []
                                                                  }
                                                                ]
                                              }
                                            ]
                       };
 
 
 
# }1;

sub DO
{
    return xm::code::func::DO($_[0],$LANGUAGE{html}{patterns});
}

sub ARGS { return    xm::o::args_stdin(@_, DESC); }
sub main { return DO(xm::o::args_stdin(@_, DESC)); }

1;