# Compact HTML

#======= ELEMENTS =======
$emptyTags = 'BASE|BR|HR|IMG|INPUT|META';
$pairTags = 'A|BLOCKQUOTE|BODY|CENTER|DD|DIR|DIV|DL|DT|FORM|H1|H2|H3|H4|H5|H6'.
            '|HEAD|HTML|LI|MENU|OL|OPTION|P|PRE|SELECT|TEXTAREA|TITLE|UL';
$deprecatedTags = '';
$omitStartTags = 'BODY|HEAD|HTML';
$omitEndTags = 'BODY|DD|DT|HEAD|HTML|LI|OPTION|P';
#$maybeEmpty = 'A|BLOCKQUOTE|BODY|CENTER|DD|DIV|DT|FORM|H1|H2|H3|H4|H5|H6|LI'.
#              '|OPTION|P|PRE|TEXTAREA|TITLE';
$maybeEmpty = 'PRE|TEXTAREA';
%requiredTags = (
  'HEAD' => 'TITLE',
  'HTML' => 'HEAD|BODY',
);
%onceonlyTags = (
  'HEAD' => 'TITLE|BASE',
  'HTML' => 'HEAD|BODY',
);
$sequencialTags = 'HTML';
%tagsElements = (
  'A'          => 'TEXTAREA|SELECT|INPUT|BR|IMG|#PCDATA',
  'BLOCKQUOTE' => 'HR|FORM|BLOCKQUOTE|CENTER|DIV|DL|PRE|MENU|DIR|OL|UL|P'.
                  '|TEXTAREA|SELECT|INPUT|BR|IMG|A|#PCDATA|H6|H5|H4|H3|H2|H1',
  'BODY'       => 'HR|FORM|BLOCKQUOTE|CENTER|DIV|DL|PRE|MENU|DIR|OL|UL|P'.
                  '|TEXTAREA|SELECT|INPUT|BR|IMG|A|#PCDATA|H6|H5|H4|H3|H2|H1',
  'CENTER'     => 'HR|FORM|BLOCKQUOTE|CENTER|DIV|DL|PRE|MENU|DIR|OL|UL|P'.
                  '|TEXTAREA|SELECT|INPUT|BR|IMG|A|#PCDATA|H6|H5|H4|H3|H2|H1',
  'DD'         => 'HR|FORM|BLOCKQUOTE|CENTER|DIV|DL|PRE|MENU|DIR|OL|UL|P'.
                  '|TEXTAREA|SELECT|INPUT|BR|IMG|A|#PCDATA',
  'DIR'        => 'LI',
  'DIV'        => 'HR|FORM|BLOCKQUOTE|CENTER|DIV|DL|PRE|MENU|DIR|OL|UL|P'.
                  '|TEXTAREA|SELECT|INPUT|BR|IMG|A|#PCDATA|H6|H5|H4|H3|H2|H1',
  'DL'         => 'DD|DT',
  'DT'         => 'TEXTAREA|SELECT|INPUT|BR|IMG|A|#PCDATA',
  'FORM'       => 'HR|BLOCKQUOTE|CENTER|DIV|DL|PRE|MENU|DIR|OL|UL|P|TEXTAREA'.
                  '|SELECT|INPUT|BR|IMG|A|#PCDATA|H6|H5|H4|H3|H2|H1',
  'H1'         => 'TEXTAREA|SELECT|INPUT|BR|IMG|A|#PCDATA',
  'H2'         => 'TEXTAREA|SELECT|INPUT|BR|IMG|A|#PCDATA',
  'H3'         => 'TEXTAREA|SELECT|INPUT|BR|IMG|A|#PCDATA',
  'H4'         => 'TEXTAREA|SELECT|INPUT|BR|IMG|A|#PCDATA',
  'H5'         => 'TEXTAREA|SELECT|INPUT|BR|IMG|A|#PCDATA',
  'H6'         => 'TEXTAREA|SELECT|INPUT|BR|IMG|A|#PCDATA',
  'HEAD'       => 'TITLE|BASE|META',
  'HTML'       => 'HEAD|BODY',
  'LI'         => 'HR|FORM|BLOCKQUOTE|CENTER|DIV|DL|PRE|MENU|DIR|OL|UL|P'.
                  '|TEXTAREA|SELECT|INPUT|BR|IMG|A|#PCDATA',
  'MENU'       => 'LI',
  'OL'         => 'LI',
  'OPTION'     => '#PCDATA',
  'P'          => 'TEXTAREA|SELECT|INPUT|BR|IMG|A|#PCDATA',
  'PRE'        => 'TEXTAREA|SELECT|INPUT|BR|A|#PCDATA',
  'SELECT'     => 'OPTION',
  'TEXTAREA'   => '#PCDATA',
  'TITLE'      => '#PCDATA',
  'UL'         => 'LI',
);
%excludedElems = (
  'A'    => 'A',
  'DIR'  => 'P|UL|OL|DIR|MENU|PRE|DL|DIV|CENTER|BLOCKQUOTE|FORM|HR',
  'FORM' => 'FORM',
  'MENU' => 'P|UL|OL|DIR|MENU|PRE|DL|DIV|CENTER|BLOCKQUOTE|FORM|HR',
  'PRE'  => 'IMG',
);
%includedElems = (
  'HEAD' => 'META',
);
#======= ATTRIBUTES =======
%tagsAttributes = (
  'A' => {
    'HREF' => '%URL',
    'NAME' => 'CDATA',
  },
  'BASE' => {
    'HREF' => '%URL',
  },
  'BR' => {
    'CLEAR' => 'LEFT|ALL|RIGHT|NONE',
  },
  'DIV' => {
    'ALIGN' => 'LEFT|CENTER|RIGHT',
  },
  'FORM' => {
    'ACTION'  => '%URL',
    'ENCTYPE' => '%Content-Type',
    'METHOD'  => 'GET|POST',
  },
  'H1' => {
    'ALIGN' => 'LEFT|CENTER|RIGHT',
  },
  'H2' => {
    'ALIGN' => 'LEFT|CENTER|RIGHT',
  },
  'H3' => {
    'ALIGN' => 'LEFT|CENTER|RIGHT',
  },
  'H4' => {
    'ALIGN' => 'LEFT|CENTER|RIGHT',
  },
  'H5' => {
    'ALIGN' => 'LEFT|CENTER|RIGHT',
  },
  'H6' => {
    'ALIGN' => 'LEFT|CENTER|RIGHT',
  },
  'HR' => {
    'ALIGN'   => 'LEFT|RIGHT|CENTER',
    'NOSHADE' => 'NOSHADE',
    'SIZE'    => '%Pixels',
    'WIDTH'   => '%Length',
  },
  'HTML' => {
    'VERSION' => 'CDATA=-//W3C//DTD Compact HTML 1.0 Draft//EN',
  },
  'IMG' => {
    'ALIGN'  => 'TOP|MIDDLE|BOTTOM|LEFT|RIGHT',
    'ALT'    => 'CDATA',
    'BORDER' => '%Pixels',
    'HEIGHT' => '%Length',
    'HSPACE' => '%Pixels',
    'SRC'    => '%URL',
    'VSPACE' => '%Pixels',
    'WIDTH'  => '%Length',
  },
  'INPUT' => {
    'ALIGN'     => 'TOP|MIDDLE|BOTTOM|LEFT|RIGHT',
    'CHECKED'   => 'CHECKED',
    'MAXLENGTH' => 'NUMBER',
    'NAME'      => 'CDATA',
    'SIZE'      => 'CDATA',
    'SRC'       => '%URL',
    'TYPE'      => 'TEXT|PASSWORD|CHECKBOX|RADIO|HIDDEN|IMAGE|SUBMIT|RESET',
    'VALUE'     => 'CDATA',
  },
  'META' => {
    'CONTENT'    => 'CDATA',
    'HTTP-EQUIV' => 'REFRESH',
    'NAME'       => 'NAME',
  },
  'OPTION' => {
    'SELECTED' => 'SELECTED',
    'VALUE'    => 'CDATA',
  },
  'P' => {
    'ALIGN' => 'LEFT|CENTER|RIGHT',
  },
  'SELECT' => {
    'MULTIPLE' => 'MULTIPLE',
    'NAME'     => 'CDATA',
    'SIZE'     => 'NUMBER',
  },
  'TEXTAREA' => {
    'COLS' => 'NUMBER',
    'NAME' => 'CDATA',
    'ROWS' => 'NUMBER',
  },
);
%requiredAttrs = (
  'A'        => 'NAME|HREF',
  'BASE'     => 'HREF',
  'IMG'      => 'SRC',
  'SELECT'   => 'NAME',
  'TEXTAREA' => 'NAME&ROWS&COLS',
);
#======= ENTITIES =======
%refEntities = (
  'AElig'  => '&#198;',
  'Aacute' => '&#193;',
  'Acirc'  => '&#194;',
  'Agrave' => '&#192;',
  'Aring'  => '&#197;',
  'Atilde' => '&#195;',
  'Auml'   => '&#196;',
  'Ccedil' => '&#199;',
  'ETH'    => '&#208;',
  'Eacute' => '&#201;',
  'Ecirc'  => '&#202;',
  'Egrave' => '&#200;',
  'Euml'   => '&#203;',
  'Iacute' => '&#205;',
  'Icirc'  => '&#206;',
  'Igrave' => '&#204;',
  'Iuml'   => '&#207;',
  'Ntilde' => '&#209;',
  'Oacute' => '&#211;',
  'Ocirc'  => '&#212;',
  'Ograve' => '&#210;',
  'Oslash' => '&#216;',
  'Otilde' => '&#213;',
  'Ouml'   => '&#214;',
  'THORN'  => '&#222;',
  'Uacute' => '&#218;',
  'Ucirc'  => '&#219;',
  'Ugrave' => '&#217;',
  'Uuml'   => '&#220;',
  'Yacute' => '&#221;',
  'aacute' => '&#225;',
  'acirc'  => '&#226;',
  'acute'  => '&#180;',
  'aelig'  => '&#230;',
  'agrave' => '&#224;',
  'amp'    => '&',
  'aring'  => '&#229;',
  'atilde' => '&#227;',
  'auml'   => '&#228;',
  'brvbar' => '&#166;',
  'ccedil' => '&#231;',
  'cedil'  => '&#184;',
  'cent'   => '&#162;',
  'copy'   => '&#169;',
  'curren' => '&#164;',
  'deg'    => '&#176;',
  'divide' => '&#247;',
  'eacute' => '&#233;',
  'ecirc'  => '&#234;',
  'egrave' => '&#232;',
  'eth'    => '&#240;',
  'euml'   => '&#235;',
  'frac12' => '&#189;',
  'frac14' => '&#188;',
  'frac34' => '&#190;',
  'gt'     => '>',
  'iacute' => '&#237;',
  'icirc'  => '&#238;',
  'iexcl'  => '&#161;',
  'igrave' => '&#236;',
  'iquest' => '&#191;',
  'iuml'   => '&#239;',
  'laquo'  => '&#171;',
  'lt'     => '<',
  'macr'   => '&#175;',
  'micro'  => '&#181;',
  'middot' => '&#183;',
  'nbsp'   => '&#160;',
  'not'    => '&#172;',
  'ntilde' => '&#241;',
  'oacute' => '&#243;',
  'ocirc'  => '&#244;',
  'ograve' => '&#242;',
  'ordf'   => '&#170;',
  'ordm'   => '&#186;',
  'oslash' => '&#248;',
  'otilde' => '&#245;',
  'ouml'   => '&#246;',
  'para'   => '&#182;',
  'plusmn' => '&#177;',
  'pound'  => '&#163;',
  'raquo'  => '&#187;',
  'reg'    => '&#174;',
  'sect'   => '&#167;',
  'shy'    => '&#173;',
  'sup1'   => '&#185;',
  'sup2'   => '&#178;',
  'sup3'   => '&#179;',
  'szlig'  => '&#223;',
  'thorn'  => '&#254;',
  'times'  => '&#215;',
  'uacute' => '&#250;',
  'ucirc'  => '&#251;',
  'ugrave' => '&#249;',
  'uml'    => '&#168;',
  'uuml'   => '&#252;',
  'yacute' => '&#253;',
  'yen'    => '&#165;',
  'yuml'   => '&#255;',
);
%refParams = (
  'Content-Type' => 'CDATA+',
  'Length'       => '\d+[%]?',
  'Pixels'       => '\d+',
  'URL'          => '&URL',
);

1;
