package eg.syntax;

/**
 * Syntax coloring for Html
 */
public class HtmlColoring implements Colorable {
   
   // incomplete
   private final static String[] TAGS = {
      "a", "area", "applet",
      "b", "blockquote", "body", "bold", "button", "br",
      "code", "col",
      "data", "div",
      "em",
      "font", "form",
      "head", "html", "hr",
      "h1", "h2", "h3", "h4", "h5", "h6",
      "i", "img", "input",
      "label", "li",
      "meta",
      "object", "ol", "output",
      "p",
      "s", "script", "span", "strong", "style", "sub", "sup",
      "table", "textarea", "title", "td", "th", "tr",
      "ul",
   };

   // incomplete
   private final static String[] ATTRIBUTES = {
      "align", "alt",
      "bgcolor",
      "checked", "class",  "content", "cols",
      "for",
      "height", "href",
      "id",
      "name",
      "onclick",
      "rows",
      "src", "source", "style",
      "title",  "type",
      "valign", "value",
      "width"
   };

   private final static String BLOCK_CMNT_START = "<!--";
   private final static String BLOCK_CMNT_END = "-->";
   private final JavascriptColoring jsCol = new JavascriptColoring();

   @Override
   public void color(SyntaxSearch search) {
      if (!search.isInBlock(BLOCK_CMNT_START, BLOCK_CMNT_END)) {
         search.setCharAttrBlack();
         search.htmlTags(TAGS, ATTRIBUTES);
         search.javascriptInHtml(jsCol);
      }
      search.blockComments(BLOCK_CMNT_START, BLOCK_CMNT_END);
   }
}

package eg.syntax;

/**
 * Syntax coloring for Html
 */
public class HtmlColoring implements Colorable {
   
   // incomplete
   private final static String[] TAGS = {
      "a", "applet", "article", "area",
      "b", "blockquote", "body", "bold", "button", "br",
      "code", "col",
      "data", "div",
      "em",
      "figure", "figcaption", "font", "form",
      "head", "header", "html", "hr",
      "h1", "h2", "h3", "h4", "h5", "h6",
      "i", "img", "input",
      "label", "li",
      "main", "meta",
      "nav",
      "object", "ol", "output",
      "p",
      "s", "script", "span", "strong", "style", "sub", "sup",
      "table", "textarea", "title", "td", "th", "tr",
      "ul",
   };

   // incomplete
   private final static String[] ATTRIBUTES = {
      "align", "alt",
      "bgcolor",
      "checked", "class",  "content", "cols",
      "for",
      "height", "href",
      "id",
      "name",
      "onclick",
      "rows",
      "src", "source", "style",
      "title",  "type",
      "valign", "value",
      "width"
   };

   private final static String BLOCK_CMNT_START = "<!--";
   private final static String BLOCK_CMNT_END = "-->";
   private final JavascriptColoring jsCol = new JavascriptColoring();

   @Override
   public void color(SyntaxSearch search) {
      if (!search.isInBlock(BLOCK_CMNT_START, BLOCK_CMNT_END)) {
         search.setCharAttrBlack();
         search.htmlTags(TAGS, ATTRIBUTES);
         search.javascriptInHtml(jsCol);
      }
      search.blockComments(BLOCK_CMNT_START, BLOCK_CMNT_END);
   }
}

add a few more tags for coloring