Commit 79865573 authored by Taddeüs Kroes's avatar Taddeüs Kroes

@import now supports full media queries

parent 8933eb72
...@@ -80,7 +80,7 @@ charset: ...@@ -80,7 +80,7 @@ charset:
{ Charset name } { Charset name }
import: import:
| IMPORT_SYM S? tgt=string_or_uri media=wslist(COMMA, media_type) SEMICOL S? | IMPORT_SYM S? tgt=string_or_uri media=media_query_list SEMICOL S?
{ Import (tgt, media) } { Import (tgt, media) }
%inline string_or_uri: %inline string_or_uri:
| str=STRING { Strlit str } | str=STRING { Strlit str }
......
...@@ -80,7 +80,7 @@ let rec string_of_statement = function ...@@ -80,7 +80,7 @@ let rec string_of_statement = function
| Import (target, []) -> | Import (target, []) ->
"@import " ^ string_of_expr target ^ ";" "@import " ^ string_of_expr target ^ ";"
| Import (target, queries) -> | Import (target, queries) ->
"@import " ^ string_of_expr target ^ " " ^ String.concat ", " queries ^ ";" "@import " ^ string_of_expr target ^ " " ^ cat ", " string_of_media_query queries ^ ";"
| Charset charset -> | Charset charset ->
"@charset \"" ^ charset ^ "\";" "@charset \"" ^ charset ^ "\";"
| Page (None, decls) -> | Page (None, decls) ->
...@@ -140,7 +140,7 @@ let rec minify_statement = function ...@@ -140,7 +140,7 @@ let rec minify_statement = function
| Import (target, []) -> | Import (target, []) ->
"@import " ^ string_of_expr target ^ ";" "@import " ^ string_of_expr target ^ ";"
| Import (target, queries) -> | Import (target, queries) ->
"@import " ^ string_of_expr target ^ " " ^ String.concat "," queries ^ ";" "@import " ^ string_of_expr target ^ " " ^ cat "," string_of_media_query queries ^ ";"
| Page (None, decls) -> | Page (None, decls) ->
"@page{" ^ cat "" minify_declaration decls ^ "}" "@page{" ^ cat "" minify_declaration decls ^ "}"
| Page (Some pseudo, decls) -> | Page (Some pseudo, decls) ->
......
...@@ -23,7 +23,7 @@ type statement = ...@@ -23,7 +23,7 @@ type statement =
(* <selectors> { <declarations> } *) (* <selectors> { <declarations> } *)
| Media of media_query list * statement list | Media of media_query list * statement list
(* @media <queries> { <rulesets> } *) (* @media <queries> { <rulesets> } *)
| Import of expr * string list | Import of expr * media_query list
(* @import <target> [<media>]; *) (* @import <target> [<media>]; *)
| Charset of string | Charset of string
(* @charset "<charset>"; *) (* @charset "<charset>"; *)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment