on master help sign in
Convert Text docs
7b86205Justin Leitgeb
libraries/Text.elm+44−25
@@ -1,6 +1,19 @@
1
1
2module Text where
2module Text where
3
3
4+{-| Functions for displaying text
5+
6+# Constructors
7+@docs toText
8+
9+# Stylizing and displaying Text
10+@docs typeface, monospace, header, link, height, color, bold, italic, overline, underline, strikethrough, justified, centered, righted, text, plaintext
11+
12+# Converting other elements to Text
13+@docs asText
14+
15+-}
16+
4import open Basics
17import open Basics
5import Color (Color)
18import Color (Color)
6import Graphics.Element (Element, Three, Pos, ElementPrim, Properties)
19import Graphics.Element (Element, Three, Pos, ElementPrim, Properties)
@@ -10,84 +23,90 @@ import Native.Text
10
23
11data Text = Text
24data Text = Text
12
25
13−-- Convert a string into text which can be styled and displayed.
26+{-| Convert a string into text which can be styled and displayed. -}
14toText : String -> Text
27toText : String -> Text
15toText = Native.Text.toText
28toText = Native.Text.toText
16
29
17−-- Set the typeface of some text. The first argument should be a comma separated listing of the desired typefaces
30+{-| Set the typeface of some text. The first argument should be a comma
31+separated listing of the desired typefaces
32+
18−-- "helvetica, arial, sans-serif"
33+ "helvetica, arial, sans-serif"
34+
19−-- Works the same as the CSS font-family property.
35+Works the same as the CSS font-family property.
36+-}
20typeface : String -> Text -> Text
37typeface : String -> Text -> Text
21typeface = Native.Text.typeface
38typeface = Native.Text.typeface
22
39
23−-- Switch to a monospace typeface. Good for code snippets.
40+{-| Switch to a monospace typeface. Good for code snippets. -}
24monospace : Text -> Text
41monospace : Text -> Text
25monospace = Native.Text.monospace
42monospace = Native.Text.monospace
26
43
27−-- Make text big and noticable.
44+{-| Make text big and noticable. -}
28header : Text -> Text
45header : Text -> Text
29header = Native.Text.header
46header = Native.Text.header
30
47
31−-- Create a link.
48+{-| Create a link. -}
32link : String -> Text -> Text
49link : String -> Text -> Text
33link = Native.Text.link
50link = Native.Text.link
34
51
35−-- Set the height of text in pixels.
52+{-| Set the height of text in pixels. -}
36height : Float -> Text -> Text
53height : Float -> Text -> Text
37height = Native.Text.height
54height = Native.Text.height
38
55
39−-- Set the color of a string.
56+{-| Set the color of a string. -}
40color : Color -> Text -> Text
57color : Color -> Text -> Text
41color = Native.Text.color
58color = Native.Text.color
42
59
43−-- Make a string bold.
60+{-| Make a string bold. -}
44bold : Text -> Text
61bold : Text -> Text
45bold = Native.Text.bold
62bold = Native.Text.bold
46
63
47−-- Italicize a string.
64+{-| Italicize a string. -}
48italic : Text -> Text
65italic : Text -> Text
49italic = Native.Text.italic
66italic = Native.Text.italic
50
67
51−-- Draw a line above a string.
68+{-| Draw a line above a string. -}
52overline : Text -> Text
69overline : Text -> Text
53overline = Native.Text.overline
70overline = Native.Text.overline
54
71
55−-- Underline a string.
72+{-| Underline a string. -}
56underline : Text -> Text
73underline : Text -> Text
57underline = Native.Text.underline
74underline = Native.Text.underline
58
75
59−-- Draw a line through a string.
76+{-| Draw a line through a string. -}
60strikeThrough : Text -> Text
77strikeThrough : Text -> Text
61strikeThrough = Native.Text.strikeThrough
78strikeThrough = Native.Text.strikeThrough
62
79
63−-- Display justified, styled text.
80+{-| Display justified, styled text. -}
64justified : Text -> Element
81justified : Text -> Element
65justified = Native.Text.justified
82justified = Native.Text.justified
66
83
67−-- Display centered, styled text.
84+{-| Display centered, styled text. -}
68centered : Text -> Element
85centered : Text -> Element
69centered = Native.Text.centered
86centered = Native.Text.centered
70
87
71−-- Display right justified, styled text.
88+{-| Display right justified, styled text. -}
72righted : Text -> Element
89righted : Text -> Element
73righted = Native.Text.righted
90righted = Native.Text.righted
74
91
75−-- Display styled text.
92+{-| Display styled text. -}
76text : Text -> Element
93text : Text -> Element
77text = Native.Text.text
94text = Native.Text.text
78
95
79−-- Display a plain string.
96+{-| Display a plain string. -}
80plainText : String -> Element
97plainText : String -> Element
81plainText = Native.Text.plainText
98plainText = Native.Text.plainText
82
99
83−-- for internal use only
100+{-| for internal use only -}
84markdown : Element
101markdown : Element
85markdown = Native.Text.markdown
102markdown = Native.Text.markdown
86
103
87−-- Convert anything to it's textual representation and make it displayable in browser
104+{-| Convert anything to it's textual representation and make it displayable in
88−--
105+browser
106+
89−-- asText == text . monospace . show
107+ asText == text . monospace . show
90−--
108+
91−-- Excellent for debugging.
109+Excellent for debugging.
110+-}
92asText : a -> Element
111asText : a -> Element
93asText = Native.Text.asText
112asText = Native.Text.asText