1 rizwank 1.1 /**
2 * Name: html
3 * Description: Hypertext markup language HTML.
4 * Author: Markku Rossi <mtr@iki.fi>
5 */
6
7 state html_tag extends Highlight
8 {
9 />/ {
10 language_print ($0);
11 return;
12 }
13 /\"/ {
14 keyword_face (false);
15 string_face (true);
16 language_print ($0);
17 call (c_string);
18 string_face (false);
19 keyword_face (true);
20 }
21 }
22 rizwank 1.1
23 state html_entity extends Highlight
24 {
25 /;/ {
26 language_print ($0);
27 return;
28 }
29 }
30
31 state html_script_tag extends Highlight
32 {
33 /\"/ {
34 keyword_face (false);
35 string_face (true);
36 language_print ($0);
37 call (c_string);
38 string_face (false);
39 keyword_face (true);
40 }
41 /([lL][aA][nN][gG][uU][aA][gG][eE]=\")([^\"]*)(\")/ {
42 html_script_language = $2;
43 rizwank 1.1
44 language_print ($1);
45 keyword_face (false);
46
47 string_face (true);
48 language_print ($2);
49 string_face (false);
50
51 keyword_face (true);
52 language_print ($3);
53 }
54 />/ {
55 language_print ($0);
56 return;
57 }
58 }
59
60 state html_skip_script extends Highlight
61 {
62 /* Terminator for nested scripts. */
63 /<\/[sS][cC][rR][iI][pP][tT]>/ {
64 rizwank 1.1 from_html_terminator = $0;
65 return;
66 }
67 }
68
69 state html extends HighlightEntry
70 {
71 BEGIN {
72 require_state (javascript);
73 }
74
75 /* Scripts. */
76 /<[sS][cC][rR][iI][pP][tT]/ {
77 keyword_face (true);
78 language_print ($0);
79
80 /* The default script language is JavaScript. */
81 html_script_language = "JavaScript";
82 call (html_script_tag);
83 keyword_face (false);
84
85 rizwank 1.1 if (regmatch(html_script_language, /^javascript.*$/i))
86 {
87 /* A nested JavaScript block. */
88 from_html_terminator = "";
89 call (javascript_internal);
90 keyword_face (true);
91 language_print (from_html_terminator);
92 keyword_face (false);
93 }
94 else
95 {
96 /* An unknown scripting language, skip it. */
97 from_html_terminator = "";
98 call (html_skip_script);
99 keyword_face (true);
100 language_print (from_html_terminator);
101 keyword_face (false);
102 }
103 }
104
105 /</ {
106 rizwank 1.1 keyword_face (true);
107 language_print ($0);
108 call (html_tag);
109 keyword_face (false);
110 }
111 /&/ {
112 keyword_face (true);
113 language_print ($0);
114 call (html_entity);
115 keyword_face (false);
116 }
117 }
118
119
120 /*
121 Local variables:
122 mode: c
123 End:
124 */
|