diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux/data/format/html.lux | 102 |
1 files changed, 52 insertions, 50 deletions
diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux index 6bbef9f5b..33500a7ac 100644 --- a/stdlib/source/library/lux/data/format/html.lux +++ b/stdlib/source/library/lux/data/format/html.lux @@ -23,17 +23,17 @@ ["." style (#+ Style)]] ["." xml (#+ XML)]]) -(type: #export Tag selector.Tag) -(type: #export ID selector.ID) -(type: #export Class selector.Class) +(type: .public Tag selector.Tag) +(type: .public ID selector.ID) +(type: .public Class selector.Class) -(type: #export Attributes +(type: .public Attributes {#.doc "Attributes for an HTML tag."} (List [Text Text])) -(type: #export Script js.Statement) +(type: .public Script js.Statement) -(type: #export Target +(type: .public Target #Blank #Parent #Self @@ -76,12 +76,14 @@ (-> Tag Text) (text.enclosed ["</" ">"])) -(abstract: #export (HTML brand) +(abstract: .public (HTML brand) + {} + Text (template [<name> <brand>] - [(abstract: #export <brand> Any) - (type: #export <name> (HTML <brand>))] + [(abstract: .public <brand> {} Any) + (type: .public <name> (HTML <brand>))] [Meta Meta'] [Head Head'] @@ -98,12 +100,12 @@ ) (template [<super> <super_raw> <sub>+] - [(abstract: #export (<super_raw> brand) Any) - (type: #export <super> (HTML (<super_raw> Any))) + [(abstract: .public (<super_raw> brand) {} Any) + (type: .public <super> (HTML (<super_raw> Any))) (`` (template [<sub> <sub_raw>] - [(abstract: #export <sub_raw> Any) - (type: #export <sub> (HTML (<super_raw> <sub_raw>)))] + [(abstract: .public <sub_raw> {} Any) + (type: .public <sub> (HTML (<super_raw> <sub_raw>)))] (~~ (template.spliced <sub>+))))] @@ -116,15 +118,15 @@ [Track Track']]] ) - (def: #export html + (def: .public html (-> Document Text) (|>> :representation)) - (def: #export (and pre post) + (def: .public (and pre post) (All [brand] (-> (HTML brand) (HTML brand) (HTML brand))) (:abstraction (format (:representation pre) (:representation post)))) - (def: #export (comment content node) + (def: .public (comment content node) (All [brand] (-> Text (HTML brand) (HTML brand))) (:abstraction (format (text.enclosed ["<!--" "-->"] content) @@ -157,7 +159,7 @@ (..close tag)))) (template [<name> <tag> <brand>] - [(def: #export <name> + [(def: .public <name> (-> Attributes <brand>) (..simple <tag>))] @@ -169,7 +171,7 @@ [parameter "param" Parameter] ) - (def: #export (base href target) + (def: .public (base href target) (-> URL (Maybe Target) Meta) (let [partial (list ["href" href]) full (case target @@ -180,46 +182,46 @@ partial)] (..simple "base" full))) - (def: #export style + (def: .public style (-> Style Meta) (|>> style.inline (..raw "style" (list)))) - (def: #export (script attributes inline) + (def: .public (script attributes inline) (-> Attributes (Maybe Script) Meta) (|> inline (maybe\map js.code) (maybe.else "") (..raw "script" attributes))) - (def: #export text + (def: .public text (-> Text Content) (|>> ..safe :abstraction)) (template [<tag> <alias> <name>] - [(def: #export <name> + [(def: .public <name> Element (..simple <tag> (list))) - (def: #export <alias> <name>)] + (def: .public <alias> <name>)] ["br" br line_break] ["wbr" wbr word_break] ["hr" hr separator] ) - (def: #export (image source attributes) + (def: .public (image source attributes) (-> URL Attributes Image) (|> attributes (#.Item ["src" source]) (..simple "img"))) - (def: #export (svg attributes content) + (def: .public (svg attributes content) (-> Attributes XML Element) (|> content (\ xml.codec encode) (..raw "svg" attributes))) - (type: #export Coord + (type: .public Coord {#horizontal Nat #vertical Nat}) @@ -230,15 +232,15 @@ (Format Coord) (format (%.nat horizontal) ..metric_separator (%.nat vertical))) - (type: #export Rectangle + (type: .public Rectangle {#start Coord #end Coord}) - (type: #export Circle + (type: .public Circle {#center Coord #radius Nat}) - (type: #export Polygon + (type: .public Polygon {#first Coord #second Coord #third Coord @@ -258,7 +260,7 @@ (list\map %coord) (text.join_with ..coord_separator))) - (type: #export Shape + (type: .public Shape (#Rectangle Rectangle) (#Circle Circle) (#Polygon Polygon)) @@ -287,7 +289,7 @@ (#Polygon polygon) (..polygon attributes polygon))) - (def: #export (map attributes areas for) + (def: .public (map attributes areas for) (-> Attributes (List [Attributes Shape]) Image Image) ($_ ..and for @@ -300,7 +302,7 @@ (list\fold (function.flip ..and) head tail))))) (template [<name> <tag> <type>] - [(def: #export <name> + [(def: .public <name> (-> Attributes <type>) (..empty <tag>))] @@ -312,7 +314,7 @@ ) (template [<name> <tag>] - [(def: #export (<name> attributes media on_unsupported) + [(def: .public (<name> attributes media on_unsupported) (-> Attributes Media (Maybe Content) Element) (..tag <tag> attributes (|> on_unsupported @@ -323,20 +325,20 @@ [video "video"] ) - (def: #export (picture attributes sources image) + (def: .public (picture attributes sources image) (-> Attributes Source Image Element) (..tag "picture" attributes (..and sources image))) - (def: #export (anchor href attributes content) + (def: .public (anchor href attributes content) (-> URL Attributes Element Element) (..tag "a" (list& ["href" href] attributes) content)) - (def: #export label + (def: .public label (-> ID Input) (|>> ["for"] list (..empty "label"))) (template [<name> <container_tag> <description_tag> <type>] - [(def: #export (<name> description attributes content) + [(def: .public (<name> description attributes content) (-> (Maybe Content) Attributes <type> <type>) (..tag <container_tag> attributes (case description @@ -354,7 +356,7 @@ ) (template [<name> <tag> <type>] - [(def: #export (<name> attributes content) + [(def: .public (<name> attributes content) (-> Attributes (Maybe Content) <type>) (|> content (maybe.else (..text "")) @@ -364,10 +366,10 @@ [iframe "iframe" Element] ) - (type: #export Phrase (-> Attributes Content Element)) + (type: .public Phrase (-> Attributes Content Element)) (template [<name> <tag>] - [(def: #export <name> + [(def: .public <name> Phrase (..tag <tag>))] @@ -403,7 +405,7 @@ [variable "var"] ) - (def: #export incorrect ..struck) + (def: .public incorrect ..struck) (def: (ruby_pronunciation pronunciation) (-> Content (HTML Any)) @@ -413,18 +415,18 @@ pronunciation (..tag "rp" (list) (..text ")"))))) - (def: #export (ruby attributes content pronunciation) + (def: .public (ruby attributes content pronunciation) (-> Attributes Content Content Element) (..tag "ruby" attributes ($_ ..and content (ruby_pronunciation pronunciation)))) - (type: #export Composite + (type: .public Composite (-> Attributes Element Element)) (template [<name> <tag>] - [(def: #export <name> + [(def: .public <name> Composite (..tag <tag>))] @@ -450,7 +452,7 @@ ["dd" description Element] ) - (def: #export (description_list attributes descriptions) + (def: .public (description_list attributes descriptions) (-> Attributes (List [Content Element]) Element) (case (list\map (function (_ [term description]) ($_ ..and @@ -464,10 +466,10 @@ (..tag "dl" attributes (list\fold (function.flip ..and) head tail)))) - (def: #export p ..paragraph) + (def: .public p ..paragraph) (template [<name> <tag> <input> <output>] - [(def: #export <name> + [(def: .public <name> (-> Attributes <input> <output>) (..tag <tag>))] @@ -486,7 +488,7 @@ ) (template [<name> <tag> <input> <output>] - [(def: #export <name> + [(def: .public <name> (-> <input> <output>) (..tag <tag> (list)))] @@ -511,7 +513,7 @@ [columns_group "colgroup" Column HTML] ) - (def: #export (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\map table_row rows) @@ -547,7 +549,7 @@ content))) (template [<name> <doc_type>] - [(def: #export <name> + [(def: .public <name> (-> Head Body Document) (let [doc_type <doc_type>] (function (_ head body) |