Skip to content

Commit d4e7b4c

Browse files
Rowan Lewisbrendo
authored andcommitted
Correctly highlight XML tags with full-stops in them. Fixes #28
1 parent ccdeee4 commit d4e7b4c

1 file changed

Lines changed: 31 additions & 31 deletions

File tree

lib/bitter/languages/xml.php

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
/*------------------------------------------------------------------------------
33
Entities
44
------------------------------------------------------------------------------*/
5-
5+
66
Bitter::rule(
77
Bitter::id('xml-entity'),
88
Bitter::capture('&(#|#x)?([a-z0-9]+)?;?'),
9-
9+
1010
Bitter::rule(
1111
Bitter::id('xml-entity-valid'),
1212
Bitter::tag('entity'),
@@ -18,15 +18,15 @@
1818
Bitter::capture('.+')
1919
)
2020
);
21-
21+
2222
/*------------------------------------------------------------------------------
2323
Attributes
2424
------------------------------------------------------------------------------*/
25-
25+
2626
Bitter::rule(
2727
Bitter::id('xml-attribute'),
2828
Bitter::capture('([a-z][a-z0-9_\-\:]*)(\s*=\s*)?(".*?"|\'.*?\')?', 'i'),
29-
29+
3030
Bitter::rule(
3131
Bitter::id('xml-attribute-key'),
3232
Bitter::tag('attribute'),
@@ -36,14 +36,14 @@
3636
Bitter::id('xml-attribute-value-single'),
3737
Bitter::tag('value'),
3838
Bitter::capture("'.*?'$"),
39-
39+
4040
Bitter::id('xml-entity')
4141
),
4242
Bitter::rule(
4343
Bitter::id('xml-attribute-value-double'),
4444
Bitter::tag('value'),
4545
Bitter::capture('".*?"$'),
46-
46+
4747
Bitter::id('xml-entity')
4848
),
4949
Bitter::rule(
@@ -52,11 +52,11 @@
5252
Bitter::capture('.+')
5353
)
5454
);
55-
55+
5656
/*------------------------------------------------------------------------------
5757
Comments
5858
------------------------------------------------------------------------------*/
59-
59+
6060
Bitter::rule(
6161
Bitter::id('xml-doctype'),
6262
Bitter::tag('doctype'),
@@ -67,7 +67,7 @@
6767
Bitter::tag('comment'),
6868
Bitter::start('<!--'),
6969
Bitter::stop('-->?'),
70-
70+
7171
Bitter::rule(
7272
Bitter::id('xml-comment-error'),
7373
Bitter::tag('error'),
@@ -80,16 +80,16 @@
8080
Bitter::start('<!\[CDATA\['),
8181
Bitter::stop('\]\]>')
8282
);
83-
83+
8484
/*------------------------------------------------------------------------------
8585
Declarations
8686
------------------------------------------------------------------------------*/
87-
87+
8888
Bitter::rule(
8989
Bitter::id('xml-declaration'),
9090
Bitter::tag('declaration open close'),
9191
Bitter::capture('<\?xml.*?(\??)>', 'i'),
92-
92+
9393
Bitter::rule(
9494
Bitter::id('xml-declaration-begin'),
9595
Bitter::tag('begin'),
@@ -100,67 +100,67 @@
100100
Bitter::tag('end'),
101101
Bitter::capture('[\?]>$')
102102
),
103-
103+
104104
Bitter::id('xml-attribute')
105105
);
106-
106+
107107
/*------------------------------------------------------------------------------
108108
Tags
109109
------------------------------------------------------------------------------*/
110-
110+
111111
Bitter::rule(
112112
Bitter::id('xml-tag-open'),
113-
Bitter::capture('<[a-z][a-z0-9_\-\:]*(([^>]+)?)>', 'i'),
113+
Bitter::capture('<[a-z][a-z0-9_\-\:.]*(([^>]+)?)>', 'i'),
114114
Bitter::tag('tag open'),
115-
115+
116116
Bitter::rule(
117117
Bitter::id('xml-tag-open-begin'),
118-
Bitter::capture('^<[a-z][a-z0-9_\-\:]*', 'i'),
118+
Bitter::capture('^<[a-z][a-z0-9_\-\:.]*', 'i'),
119119
Bitter::tag('begin')
120120
),
121121
Bitter::rule(
122122
Bitter::id('xml-tag-open-end'),
123123
Bitter::capture('/>|>$'),
124124
Bitter::tag('end')
125125
),
126-
126+
127127
Bitter::id('xml-attribute')
128128
);
129129
Bitter::rule(
130130
Bitter::id('xml-tag-close'),
131131
Bitter::capture('</[^>]+>?'),
132-
132+
133133
Bitter::rule(
134134
Bitter::id('xml-tag-close-valid'),
135135
Bitter::tag('tag close'),
136-
Bitter::capture('</[a-z][a-z0-9_\-\:]*>', 'i')
136+
Bitter::capture('</[a-z][a-z0-9_\-\:.]*>', 'i')
137137
),
138138
Bitter::rule(
139139
Bitter::id('xml-declaration-error'),
140140
Bitter::tag('error'),
141141
Bitter::capture('.+')
142142
),
143-
143+
144144
Bitter::id('xml-attribute')
145145
);
146-
146+
147147
/*------------------------------------------------------------------------------
148148
Main
149149
------------------------------------------------------------------------------*/
150-
150+
151151
Bitter::rule(
152152
Bitter::id('xml-text'),
153153
Bitter::tag('text'),
154154
Bitter::capture('[^<>]{1,}'),
155-
155+
156156
Bitter::id('xml-entity')
157157
);
158-
158+
159159
Bitter::rule(
160160
Bitter::id('xml-include'),
161161
Bitter::tag('context-markup xml'),
162162
Bitter::capture('.+', 's'),
163-
163+
164164
Bitter::id('xml-text'),
165165
Bitter::id('xml-doctype'),
166166
Bitter::id('xml-comment'),
@@ -169,12 +169,12 @@
169169
Bitter::id('xml-tag-close'),
170170
Bitter::id('xml-tag-open')
171171
);
172-
172+
173173
Bitter::rule(
174174
Bitter::id('xml'),
175-
175+
176176
Bitter::id('xml-include')
177177
);
178-
178+
179179
/*----------------------------------------------------------------------------*/
180180
?>

0 commit comments

Comments
 (0)