Version bump.
[geany-mirror.git] / tagmanager / html.c
blobe5f8c4f31ca0cdaf1fc93ca7346a6ae7fd699d37
1 /*
2 * $Id$
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
10 * files.
14 * INCLUDE FILES
16 #include "general.h" /* must always come first */
17 #include "parse.h"
20 * FUNCTION DEFINITIONS
23 static void installHtmlRegex (const langType language)
25 #define POSSIBLE_ATTRIBUTES "([ \t]+[a-z]+=\"?[^>\"]*\"?)*"
27 addTagRegex (language,
28 "<a"
29 POSSIBLE_ATTRIBUTES
30 "[ \t]+name=\"?([^>\"]+)\"?"
31 POSSIBLE_ATTRIBUTES
32 "[ \t]*>",
33 "\\2", "m,member,named anchors", "i");
35 addTagRegex (language, "^[ \t]*function[ \t]*([A-Za-z0-9_]+)[ \t]*\\(",
36 "\\1", "f,function,JavaScript functions", NULL);
38 /* the following matches headings with tags inside like
39 * <h1><a href="#id109"><i>Some Text</i></a></h1>
40 * and
41 * <h1>Some Text</h1> */
42 #define SPACES "[ \t]*"
43 #define ATTRS "[^>]*"
44 #define INNER_HEADING \
45 ATTRS ">" SPACES "(<" ATTRS ">" SPACES ")*([^<]+).*"
47 addTagRegex (language,
48 "<h1" INNER_HEADING "</h1>",
49 "\\2", "n,namespace,H1 heading", "i");
51 addTagRegex (language,
52 "<h2" INNER_HEADING "</h2>",
53 "\\2", "c,class,H2 heading", "i");
55 addTagRegex (language,
56 "<h3" INNER_HEADING "</h3>",
57 "\\2", "v,variable,H3 heading", "i");
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;
67 def->regex = TRUE;
68 return def;
71 /* vi:set tabstop=4 shiftwidth=4: */