Skip to content

Commit 1854d0c

Browse files
committed
Merge pull request #57 from daleeidd/master
Add @font-face messed test case and update parsing
2 parents 341257a + 46d2b22 commit 1854d0c

File tree

5 files changed

+110
-1
lines changed

5 files changed

+110
-1
lines changed

lib/parse/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ module.exports = function(css, options){
461461

462462
function atfontface() {
463463
var pos = position();
464-
var m = match(/^@font-face */);
464+
var m = match(/^@font-face\s*/);
465465
if (!m) return;
466466

467467
if (!open()) return error("@font-face missing '{'");
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{
2+
"type": "stylesheet",
3+
"stylesheet": {
4+
"rules": [
5+
{
6+
"type": "font-face",
7+
"declarations": [
8+
{
9+
"type": "declaration",
10+
"property": "font-family",
11+
"value": "\"Bitstream Vera Serif Bold\"",
12+
"position": {
13+
"start": {
14+
"line": 4,
15+
"column": 3
16+
},
17+
"end": {
18+
"line": 4,
19+
"column": 43
20+
},
21+
"source": "input.css"
22+
}
23+
},
24+
{
25+
"type": "declaration",
26+
"property": "src",
27+
"value": "url(\"http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf\")",
28+
"position": {
29+
"start": {
30+
"line": 5,
31+
"column": 3
32+
},
33+
"end": {
34+
"line": 5,
35+
"column": 78
36+
},
37+
"source": "input.css"
38+
}
39+
}
40+
],
41+
"position": {
42+
"start": {
43+
"line": 1,
44+
"column": 1
45+
},
46+
"end": {
47+
"line": 6,
48+
"column": 2
49+
},
50+
"source": "input.css"
51+
}
52+
},
53+
{
54+
"type": "rule",
55+
"selectors": [
56+
"body"
57+
],
58+
"declarations": [
59+
{
60+
"type": "declaration",
61+
"property": "font-family",
62+
"value": "\"Bitstream Vera Serif Bold\", serif",
63+
"position": {
64+
"start": {
65+
"line": 9,
66+
"column": 3
67+
},
68+
"end": {
69+
"line": 9,
70+
"column": 50
71+
},
72+
"source": "input.css"
73+
}
74+
}
75+
],
76+
"position": {
77+
"start": {
78+
"line": 8,
79+
"column": 1
80+
},
81+
"end": {
82+
"line": 10,
83+
"column": 2
84+
},
85+
"source": "input.css"
86+
}
87+
}
88+
]
89+
}
90+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@font-face{font-family:"Bitstream Vera Serif Bold";src:url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");}body{font-family:"Bitstream Vera Serif Bold", serif;}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@font-face
2+
3+
{
4+
font-family: "Bitstream Vera Serif Bold";
5+
src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");
6+
}
7+
8+
body {
9+
font-family: "Bitstream Vera Serif Bold", serif;
10+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@font-face {
2+
font-family: "Bitstream Vera Serif Bold";
3+
src: url("http://developer.mozilla.org/@api/deki/files/2934/=VeraSeBd.ttf");
4+
}
5+
6+
body {
7+
font-family: "Bitstream Vera Serif Bold", serif;
8+
}

0 commit comments

Comments
 (0)