2
* $Id: html.c 2317 2008-03-09 18:50:41Z eht16 $
4
* Copyright (c) 2003, Darren Hiebert
6
* This source code is released for free distribution under the terms of the
7
* GNU General Public License.
9
* This module contains functions for generating tags for HTML language
16
#include "general.h" /* must always come first */
20
* FUNCTION DEFINITIONS
23
static void installHtmlRegex (const langType language)
25
#define POSSIBLE_ATTRIBUTES "([ \t]+[a-z]+=\"?[^>\"]*\"?)*"
26
/* the following matches headings with "<a>" tags inside like
27
* <h1><a href="#id109">Some Text</a></h1>
28
* but it fails matching simple headings like
29
* <h1>Some Text</h1> */
30
/*#define INNER_HEADING "[ \t]*(<.*>(.*+)<.*>[ \t]*"*/
32
/* this matches simple heading without nested tags */
33
/** TODO combine both pattern to be able to match both heading styles */
34
#define INNER_HEADING "[ \t]*(.*+)[ \t]*"
36
addTagRegex (language,
39
"[ \t]+name=\"?([^>\"]+)\"?"
42
"\\2", "m,member,named anchors", "i");
44
addTagRegex (language,
45
"<h1>" INNER_HEADING "</h1>",
46
"\\1", "n,namespace,H1 heading", "i");
48
addTagRegex (language,
49
"<h2>" INNER_HEADING "</h2>",
50
"\\1", "c,class,H2 heading", "i");
52
addTagRegex (language,
53
"<h3>" INNER_HEADING "</h3>",
54
"\\1", "v,variable,H3 heading", "i");
56
addTagRegex (language, "^[ \t]*function[ \t]*([A-Za-z0-9_]+)[ \t]*\\(",
57
"\\1", "f,function,JavaScript functions", NULL);
60
/* Create parser definition stucture */
61
extern parserDefinition* HtmlParser (void)
63
static const char *const extensions [] = { "htm", "html", NULL };
64
parserDefinition *const def = parserNew ("HTML");
65
def->extensions = extensions;
66
def->initialize = installHtmlRegex;
71
/* vi:set tabstop=4 shiftwidth=4: */