1 |
|
-- |
2 |
|
-- This file is part of FactorCSS |
3 |
|
-- Licensed under the MIT License, |
4 |
|
-- http://www.opensource.org/licenses/mit-license |
5 |
|
-- Copyright 2005 James Bursa <james@semichrome.net> |
6 |
|
-- |
7 |
|
|
8 |
-- Datatypes for CSS |
-- Datatypes for CSS |
9 |
|
|
10 |
module CSS where |
module CSS where |
11 |
import List |
import List |
12 |
|
import Numeric |
13 |
|
|
14 |
data Stylesheet |
data Stylesheet |
15 |
= Stylesheet |
= Stylesheet |
120 |
|
|
121 |
show_simple_selector :: SimpleSelector -> String |
show_simple_selector :: SimpleSelector -> String |
122 |
show_simple_selector (Just s, ds) = s ++ (concat . map show_detail) ds |
show_simple_selector (Just s, ds) = s ++ (concat . map show_detail) ds |
123 |
|
show_simple_selector (Nothing, []) = "*" |
124 |
show_simple_selector (Nothing, ds) = (concat . map show_detail) ds |
show_simple_selector (Nothing, ds) = (concat . map show_detail) ds |
125 |
|
|
126 |
show_detail :: Detail -> String |
show_detail :: Detail -> String |
147 |
show_values = concat . intersperse " " . map show_value |
show_values = concat . intersperse " " . map show_value |
148 |
|
|
149 |
show_value :: Value -> String |
show_value :: Value -> String |
150 |
show_value (Number n) = show n |
show_value (Number n) = showFFloat Nothing n "" |
151 |
show_value (Percentage p) = show p ++ "%" |
show_value (Percentage p) = showFFloat Nothing p "%" |
152 |
show_value (Length l) = l |
show_value (Length l) = l |
153 |
show_value (Ems e) = show e ++ "em" |
show_value (Ems e) = showFFloat Nothing e "em" |
154 |
show_value (Exs x) = show x ++ "ex" |
show_value (Exs x) = showFFloat Nothing x "ex" |
155 |
show_value (Angle a) = a |
show_value (Angle a) = a |
156 |
show_value (Time t) = t |
show_value (Time t) = t |
157 |
show_value (Freq f) = f |
show_value (Freq f) = f |