Commit 591c9af7 authored by Taddeus Kroes's avatar Taddeus Kroes

Code cleanup

parent 369ee206
......@@ -29,9 +29,9 @@ let prune_duplicates decls =
in
prune 0 decls
let transform = function
| Statement (Ruleset (selectors, decls)) ->
Statement (Ruleset (selectors, prune_duplicates decls))
| v -> v
let compress = Util.transform_stylesheet transform
let compress =
Util.transform_stylesheet begin function
| Statement (Ruleset (selectors, decls)) ->
Statement (Ruleset (selectors, prune_duplicates decls))
| v -> v
end
......@@ -274,16 +274,16 @@ let make_shorthands decls =
in
List.filter keep_prop decls @ shorthands
let transform = function
| Statement (Ruleset (selectors, decls)) ->
Statement (Ruleset (selectors, make_shorthands decls))
| v -> v
let compress = Util.transform_stylesheet transform
let transform_unfold = function
| Statement (Ruleset (selectors, decls)) ->
Statement (Ruleset (selectors, unfold decls))
| v -> v
let unfold_stylesheet = Util.transform_stylesheet transform_unfold
let compress =
Util.transform_stylesheet begin function
| Statement (Ruleset (selectors, decls)) ->
Statement (Ruleset (selectors, make_shorthands decls))
| v -> v
end
let unfold_stylesheet =
Util.transform_stylesheet begin function
| Statement (Ruleset (selectors, decls)) ->
Statement (Ruleset (selectors, unfold decls))
| v -> v
end
......@@ -47,10 +47,10 @@ let shorten_font_weight = function
| Ident "bold" -> Number (700.0, None)
| v -> v
let transform = function
| Expr value -> Expr (shorten_expr value)
| Declaration ("font-weight", value, imp) ->
Declaration ("font-weight", shorten_font_weight value, imp)
| v -> v
let compress = Util.transform_stylesheet transform
let compress =
Util.transform_stylesheet begin function
| Expr value -> Expr (shorten_expr value)
| Declaration ("font-weight", value, imp) ->
Declaration ("font-weight", shorten_font_weight value, imp)
| v -> v
end
......@@ -237,7 +237,7 @@ let is_color = Color_names.is_color
(* Sorting declarations *)
let sort_stylesheet =
let transform_sort_decls = function
transform_stylesheet begin function
| Statement (Ruleset (selectors, decls)) ->
let pattern = Str.regexp "^\\([^-]+\\)-" in
let stem x =
......@@ -246,6 +246,4 @@ let sort_stylesheet =
let cmp (a, _, _) (b, _, _) = String.compare (stem a) (stem b) in
Statement (Ruleset (selectors, List.stable_sort cmp decls))
| v -> v
in
transform_stylesheet transform_sort_decls
end
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