aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/data/format/html.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/data/format/html.lux')
-rw-r--r--stdlib/source/library/lux/data/format/html.lux100
1 files changed, 50 insertions, 50 deletions
diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux
index 3a8bcd5c6..7a9d61adc 100644
--- a/stdlib/source/library/lux/data/format/html.lux
+++ b/stdlib/source/library/lux/data/format/html.lux
@@ -43,7 +43,7 @@
{#Top}
{#Frame Text}))
-(def: (target value)
+(def (target value)
(-> Target Text)
(case value
{#Blank} "_blank"
@@ -53,7 +53,7 @@
{#Frame name} name))
... Properly formats text to ensure no injection can happen on the HTML.
-(def: safe
+(def safe
(-> Text Text)
(|>> (text.replaced "&" "&")
(text.replaced "<" "&lt;")
@@ -62,20 +62,20 @@
(text.replaced "'" "&#x27;")
(text.replaced "/" "&#x2F;")))
-(def: attributes
+(def attributes
(-> Attributes Text)
(|>> (list#each (function (_ [key val])
(format " " key "=" text.double_quote (..safe val) text.double_quote)))
text.together))
-(def: (open tag attributes)
+(def (open tag attributes)
(-> Tag Attributes Text)
(|> attributes
..attributes
(format tag)
(text.enclosed ["<" ">"])))
-(def: close
+(def close
(-> Tag Text)
(text.enclosed ["</" ">"]))
@@ -119,40 +119,40 @@
[Track Track']]]
)
- (def: .public html
+ (def .public html
(-> Document Text)
(|>> representation))
- (def: .public (and pre post)
+ (def .public (and pre post)
(All (_ brand) (-> (HTML brand) (HTML brand) (HTML brand)))
(abstraction (format (representation pre) (representation post))))
- (def: .public (comment content node)
+ (def .public (comment content node)
(All (_ brand) (-> Text (HTML brand) (HTML brand)))
(abstraction
(format (text.enclosed ["<!--" "-->"] content)
(representation node))))
- (def: (empty name attributes)
+ (def (empty name attributes)
(-> Tag Attributes HTML)
(abstraction
(format (..open name attributes)
(..close name))))
- (def: (simple tag attributes)
+ (def (simple tag attributes)
(-> Tag Attributes HTML)
(|> attributes
(..open tag)
abstraction))
- (def: (tag name attributes content)
+ (def (tag name attributes content)
(-> Tag Attributes (HTML Any) HTML)
(abstraction
(format (..open name attributes)
(representation content)
(..close name))))
- (def: (raw tag attributes content)
+ (def (raw tag attributes content)
(-> Text Attributes Text HTML)
(abstraction
(format (..open tag attributes)
@@ -160,7 +160,7 @@
(..close tag))))
(.with_template [<name> <tag> <brand>]
- [(def: .public <name>
+ [(def .public <name>
(-> Attributes <brand>)
(..simple <tag>))]
@@ -172,7 +172,7 @@
[parameter "param" Parameter]
)
- (def: .public (base href target)
+ (def .public (base href target)
(-> URL (Maybe Target) Meta)
(let [partial (list ["href" href])
full (case target
@@ -183,40 +183,40 @@
partial)]
(..simple "base" full)))
- (def: .public style
+ (def .public style
(-> Style Meta)
(|>> style.inline (..raw "style" (list))))
- (def: .public (script attributes inline)
+ (def .public (script attributes inline)
(-> Attributes (Maybe Script) Meta)
(|> inline
(maybe#each js.code)
(maybe.else "")
(..raw "script" attributes)))
- (def: .public text
+ (def .public text
(-> Text Content)
(|>> ..safe
abstraction))
(.with_template [<tag> <alias> <name>]
- [(def: .public <name>
+ [(def .public <name>
Element
(..simple <tag> (list)))
- (def: .public <alias> <name>)]
+ (def .public <alias> <name>)]
["br" br line_break]
["wbr" wbr word_break]
["hr" hr separator]
)
- (def: .public (image source attributes)
+ (def .public (image source attributes)
(-> URL Attributes Image)
(|> attributes
{.#Item ["src" source]}
(..simple "img")))
- (def: .public (svg attributes content)
+ (def .public (svg attributes content)
(-> Attributes XML Element)
(|> content
(at xml.codec encoded)
@@ -227,10 +227,10 @@
[#horizontal Nat
#vertical Nat]))
- (def: metric_separator ",")
- (def: coord_separator ",")
+ (def metric_separator ",")
+ (def coord_separator ",")
- (def: (%coord [horizontal vertical])
+ (def (%coord [horizontal vertical])
(Format Coord)
(format (%.nat horizontal) ..metric_separator (%.nat vertical)))
@@ -251,15 +251,15 @@
#third Coord
#extra (List Coord)]))
- (def: (%rectangle [start end])
+ (def (%rectangle [start end])
(Format Rectangle)
(format (%coord start) ..coord_separator (%coord end)))
- (def: (%circle [center radius])
+ (def (%circle [center radius])
(Format Circle)
(format (%coord center) ..metric_separator (%.nat radius)))
- (def: (%polygon [first second third extra])
+ (def (%polygon [first second third extra])
(Format Polygon)
(|> (list.partial first second third extra)
(list#each %coord)
@@ -272,7 +272,7 @@
{#Polygon Polygon}))
(.with_template [<name> <shape> <type> <format>]
- [(def: (<name> attributes shape)
+ [(def (<name> attributes shape)
(-> Attributes <type> (HTML Any))
(..simple "area" (list.partial ["shape" <shape>]
["coords" (<format> shape)]
@@ -283,7 +283,7 @@
[polygon "poly" Polygon ..%polygon]
)
- (def: (area attributes shape)
+ (def (area attributes shape)
(-> Attributes Shape (HTML Any))
(case shape
{#Rectangle rectangle}
@@ -295,7 +295,7 @@
{#Polygon polygon}
(..polygon attributes polygon)))
- (def: .public (each attributes areas for)
+ (def .public (each attributes areas for)
(-> Attributes (List [Attributes Shape]) Image Image)
(all ..and
for
@@ -308,7 +308,7 @@
(list#mix (function.flipped ..and) head tail)))))
(.with_template [<name> <tag> <type>]
- [(def: .public <name>
+ [(def .public <name>
(-> Attributes <type>)
(..empty <tag>))]
@@ -320,7 +320,7 @@
)
(.with_template [<name> <tag>]
- [(def: .public (<name> attributes media on_unsupported)
+ [(def .public (<name> attributes media on_unsupported)
(-> Attributes Media (Maybe Content) Element)
(..tag <tag> attributes
(|> on_unsupported
@@ -331,20 +331,20 @@
[video "video"]
)
- (def: .public (picture attributes sources image)
+ (def .public (picture attributes sources image)
(-> Attributes Source Image Element)
(..tag "picture" attributes (..and sources image)))
- (def: .public (anchor href attributes content)
+ (def .public (anchor href attributes content)
(-> URL Attributes Element Element)
(..tag "a" (list.partial ["href" href] attributes) content))
- (def: .public label
+ (def .public label
(-> ID Input)
(|>> ["for"] list (..empty "label")))
(.with_template [<name> <container_tag> <description_tag> <type>]
- [(def: .public (<name> description attributes content)
+ [(def .public (<name> description attributes content)
(-> (Maybe Content) Attributes <type> <type>)
(..tag <container_tag> attributes
(case description
@@ -362,7 +362,7 @@
)
(.with_template [<name> <tag> <type>]
- [(def: .public (<name> attributes content)
+ [(def .public (<name> attributes content)
(-> Attributes (Maybe Content) <type>)
(|> content
(maybe.else (..text ""))
@@ -376,7 +376,7 @@
(-> Attributes Content Element))
(.with_template [<name> <tag>]
- [(def: .public <name>
+ [(def .public <name>
Phrase
(..tag <tag>))]
@@ -412,9 +412,9 @@
[variable "var"]
)
- (def: .public incorrect ..struck)
+ (def .public incorrect ..struck)
- (def: (ruby_pronunciation pronunciation)
+ (def (ruby_pronunciation pronunciation)
(-> Content (HTML Any))
(..tag "rt" (list)
(all ..and
@@ -422,7 +422,7 @@
pronunciation
(..tag "rp" (list) (..text ")")))))
- (def: .public (ruby attributes content pronunciation)
+ (def .public (ruby attributes content pronunciation)
(-> Attributes Content Content Element)
(..tag "ruby" attributes
(all ..and
@@ -433,7 +433,7 @@
(-> Attributes Element Element))
(.with_template [<name> <tag>]
- [(def: .public <name>
+ [(def .public <name>
Composite
(..tag <tag>))]
@@ -451,7 +451,7 @@
)
(.with_template [<tag> <name> <input>]
- [(def: <name>
+ [(def <name>
(-> <input> (HTML Any))
(..tag <tag> (list)))]
@@ -459,7 +459,7 @@
["dd" description Element]
)
- (def: .public (description_list attributes descriptions)
+ (def .public (description_list attributes descriptions)
(-> Attributes (List [Content Element]) Element)
(case (list#each (function (_ [term description])
(all ..and
@@ -473,10 +473,10 @@
(..tag "dl" attributes
(list#mix (function.flipped ..and) head tail))))
- (def: .public p ..paragraph)
+ (def .public p ..paragraph)
(.with_template [<name> <tag> <input> <output>]
- [(def: .public <name>
+ [(def .public <name>
(-> Attributes <input> <output>)
(..tag <tag>))]
@@ -495,7 +495,7 @@
)
(.with_template [<name> <tag> <input> <output>]
- [(def: .public <name>
+ [(def .public <name>
(-> <input> <output>)
(..tag <tag> (list)))]
@@ -509,7 +509,7 @@
)
(.with_template [<name> <tag> <input> <output>]
- [(def: <name>
+ [(def <name>
(-> <input> <output>)
(..tag <tag> (list)))]
@@ -520,7 +520,7 @@
[columns_group "colgroup" Column HTML]
)
- (def: .public (table attributes caption columns headers rows footer)
+ (def .public (table attributes caption columns headers rows footer)
(-> Attributes (Maybe Content) (Maybe Column) Header (List Cell) (Maybe Cell) Element)
(let [head (..table_head (..table_row headers))
content (case (list#each table_row rows)
@@ -556,7 +556,7 @@
content)))
(.with_template [<name> <doc_type>]
- [(def: .public <name>
+ [(def .public <name>
(-> Head Body Document)
(let [doc_type <doc_type>]
(function (_ head body)