Skip to content

Commit

Permalink
Fix issues tomyeh#23 with font-face getting paresd as id
Browse files Browse the repository at this point in the history
  • Loading branch information
laeubi committed Jul 17, 2014
1 parent b61f199 commit 48087dd
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 1 deletion.
49 changes: 49 additions & 0 deletions zuss-test/cases/font_face.zuss
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
@font-face {
font-family: 'PT Sans';
font-style: normal;
font-weight: 400;
src: url('../../fonts/pt_sans/PT_Sans-Web-Regular.eot'); /* EOT file for IE */
src: local('PT Sans'), local('PTSans-Regular'), url('../../fonts/pt_sans/PT_Sans-Web-Regular.ttf') format("truetype"); /*CSS3 Browser*/
}

@font-face {
font-family: 'PT Sans';
font-style: normal;
font-weight: 700;
src: url('../../fonts/pt_sans/PT_Sans-Web-Bold.eot'); /* EOT file for IE */
src: local('PT Sans Bold'), local('PTSans-Bold'), url('../../fonts/pt_sans/PT_Sans-Web-Bold.ttf') format("truetype");
}

@nice_grey: #5B5B5B;
@darken(@color, @diff: 10%): @color * (1 - @diff);

div {
color: @darken(@nice_grey);
}

.bordered {
&.float {
float: left;
}
.top {
margin: 5px;
}
}

@border_radious(@radius: 4px) {
border-radius: @radius;
}

div.rounded {
@border_radious();
}
button.rounded {
@border_radious(3px);
}

@nice-blue: #5B83AD;
@light-blue: @nice-blue + #111;
@dark-orange: orange - #010203;

div.hilite { color: @light-blue;}
div.hilite2 { color: @dark-orange;}
4 changes: 3 additions & 1 deletion zuss/src/org/zkoss/zuss/impl/in/Keyword.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ public String toString() {
/** CSS's @charset. */
CHARSET("@charset"),
/** CSS's @media. */
MEDIA("@media");
MEDIA("@media"),
/** CSS's @font-face **/
FONTFACE("@font-face");

private final String value;
private Value(String value) {
Expand Down
3 changes: 3 additions & 0 deletions zuss/src/org/zkoss/zuss/impl/in/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ private void parseKeyword(Context ctx, Keyword kw) throws IOException {
newBlock(ctx,
new MediaDefinition(ctx.block.owner, scope, kw.getLine()));
return;
case FONTFACE:
new RawValue(ctx.block.owner, "@font-face "+_in.getUntil("}")+'\n', kw.getLine());
return;
case IF:
nextAndCheck(ctx, '(', false);
expr = new Expression(_in.getLine());
Expand Down
2 changes: 2 additions & 0 deletions zuss/src/org/zkoss/zuss/impl/in/Tokenizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,8 @@ private Token asId() throws IOException {
return new Keyword(Keyword.Value.IMPORT, getLine());
if ("media".equals(nm))
return new Keyword(Keyword.Value.MEDIA, getLine());
if ("font-face".equals(nm))
return new Keyword(Keyword.Value.FONTFACE, getLine());
return new Id(nm, getLine());
}
private Token asString(char quot) throws IOException {
Expand Down

0 comments on commit 48087dd

Please sign in to comment.