aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/data/format/css.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux/data/format/css.lux47
1 files changed, 26 insertions, 21 deletions
diff --git a/stdlib/source/library/lux/data/format/css.lux b/stdlib/source/library/lux/data/format/css.lux
index 041feace9..d94f97cd9 100644
--- a/stdlib/source/library/lux/data/format/css.lux
+++ b/stdlib/source/library/lux/data/format/css.lux
@@ -27,15 +27,19 @@
(abstract: #export (CSS brand)
Text
- (def: #export css (-> (CSS Any) Text) (|>> :representation))
+ (def: #export css
+ (-> (CSS Any) Text)
+ (|>> :representation))
- (def: #export empty (CSS Common) (:abstraction ""))
+ (def: #export empty
+ (CSS Common)
+ (:abstraction ""))
(def: #export (rule selector style)
(-> (Selector Any) Style (CSS Common))
(:abstraction (format (/selector.selector selector) "{" (/style.inline style) "}")))
- (def: #export char-set
+ (def: #export char_set
(-> Encoding (CSS Special))
(|>> encoding.name
%.text
@@ -44,23 +48,23 @@
(def: #export (font font)
(-> Font (CSS Special))
- (let [with-unicode (case (get@ #/font.unicode-range font)
- (#.Some unicode-range)
- (let [unicode-range' (format "U+" (\ nat.hex encode (get@ #/font.start unicode-range))
- "-" (\ nat.hex encode (get@ #/font.end unicode-range)))]
- (list ["unicode-range" unicode-range']))
+ (let [with_unicode (case (get@ #/font.unicode_range font)
+ (#.Some unicode_range)
+ (let [unicode_range' (format "U+" (\ nat.hex encode (get@ #/font.start unicode_range))
+ "-" (\ nat.hex encode (get@ #/font.end unicode_range)))]
+ (list ["unicode-range" unicode_range']))
#.None
(list))]
(|> (list& ["font-family" (get@ #/font.family font)]
["src" (format "url(" (get@ #/font.source font) ")")]
- ["font-stretch" (|> font (get@ #/font.stretch) (maybe.default /value.normal-stretch) /value.value)]
- ["font-style" (|> font (get@ #/font.style) (maybe.default /value.normal-style) /value.value)]
- ["font-weight" (|> font (get@ #/font.weight) (maybe.default /value.normal-weight) /value.value)]
- with-unicode)
+ ["font-stretch" (|> font (get@ #/font.stretch) (maybe.default /value.normal_stretch) /value.value)]
+ ["font-style" (|> font (get@ #/font.style) (maybe.default /value.normal_style) /value.value)]
+ ["font-weight" (|> font (get@ #/font.weight) (maybe.default /value.normal_weight) /value.value)]
+ with_unicode)
(list\map (function (_ [property value])
(format property ": " value ";")))
- (text.join-with /style.separator)
+ (text.join_with /style.separator)
(text.enclose ["{" "}"])
(format "@font-face")
:abstraction)))
@@ -76,13 +80,14 @@
"")
";")))
- (def: css-separator text.new-line)
+ (def: css_separator
+ text.new_line)
(type: #export Frame
{#when Percentage
#what Style})
- (def: #export (key-frames animation frames)
+ (def: #export (key_frames animation frames)
(-> (Value Animation) (List Frame) (CSS Special))
(:abstraction (format "@keyframes " (/value.value animation) " {"
(|> frames
@@ -90,11 +95,11 @@
(format (/value.percentage (get@ #when frame)) " {"
(/style.inline (get@ #what frame))
"}")))
- (text.join-with ..css-separator))
+ (text.join_with ..css_separator))
"}")))
(template: (!compose <pre> <post>)
- (:abstraction (format (:representation <pre>) ..css-separator
+ (:abstraction (format (:representation <pre>) ..css_separator
(:representation <post>))))
(def: #export (and pre post)
@@ -105,9 +110,9 @@
(-> Combinator (Selector Any) (CSS Common) (CSS Common))
(|> css
:representation
- (text.split-all-with ..css-separator)
+ (text.split_all_with ..css_separator)
(list\map (|>> (format (/selector.selector (|> selector (combinator (/selector.tag "")))))))
- (text.join-with ..css-separator)
+ (text.join_with ..css_separator)
:abstraction))
(def: #export (dependent combinator selector style inner)
@@ -120,7 +125,7 @@
(-> (Selector Any) Style (CSS Common) (CSS Common))
(..dependent <combinator>))]
- [with-descendants /selector.in]
- [with-children /selector.sub]
+ [with_descendants /selector.in]
+ [with_children /selector.sub]
)
)