Convert Text docs
This commit is contained in:
parent
2edcced713
commit
7b86205c4f
1 changed files with 44 additions and 25 deletions
|
@ -1,6 +1,19 @@
|
|||
|
||||
module Text where
|
||||
|
||||
{-| Functions for displaying text
|
||||
|
||||
# Constructors
|
||||
@docs toText
|
||||
|
||||
# Stylizing and displaying Text
|
||||
@docs typeface, monospace, header, link, height, color, bold, italic, overline, underline, strikethrough, justified, centered, righted, text, plaintext
|
||||
|
||||
# Converting other elements to Text
|
||||
@docs asText
|
||||
|
||||
-}
|
||||
|
||||
import open Basics
|
||||
import Color (Color)
|
||||
import Graphics.Element (Element, Three, Pos, ElementPrim, Properties)
|
||||
|
@ -10,84 +23,90 @@ import Native.Text
|
|||
|
||||
data Text = Text
|
||||
|
||||
-- Convert a string into text which can be styled and displayed.
|
||||
{-| Convert a string into text which can be styled and displayed. -}
|
||||
toText : String -> Text
|
||||
toText = Native.Text.toText
|
||||
|
||||
-- Set the typeface of some text. The first argument should be a comma separated listing of the desired typefaces
|
||||
-- "helvetica, arial, sans-serif"
|
||||
-- Works the same as the CSS font-family property.
|
||||
{-| Set the typeface of some text. The first argument should be a comma
|
||||
separated listing of the desired typefaces
|
||||
|
||||
"helvetica, arial, sans-serif"
|
||||
|
||||
Works the same as the CSS font-family property.
|
||||
-}
|
||||
typeface : String -> Text -> Text
|
||||
typeface = Native.Text.typeface
|
||||
|
||||
-- Switch to a monospace typeface. Good for code snippets.
|
||||
{-| Switch to a monospace typeface. Good for code snippets. -}
|
||||
monospace : Text -> Text
|
||||
monospace = Native.Text.monospace
|
||||
|
||||
-- Make text big and noticable.
|
||||
{-| Make text big and noticable. -}
|
||||
header : Text -> Text
|
||||
header = Native.Text.header
|
||||
|
||||
-- Create a link.
|
||||
{-| Create a link. -}
|
||||
link : String -> Text -> Text
|
||||
link = Native.Text.link
|
||||
|
||||
-- Set the height of text in pixels.
|
||||
{-| Set the height of text in pixels. -}
|
||||
height : Float -> Text -> Text
|
||||
height = Native.Text.height
|
||||
|
||||
-- Set the color of a string.
|
||||
{-| Set the color of a string. -}
|
||||
color : Color -> Text -> Text
|
||||
color = Native.Text.color
|
||||
|
||||
-- Make a string bold.
|
||||
{-| Make a string bold. -}
|
||||
bold : Text -> Text
|
||||
bold = Native.Text.bold
|
||||
|
||||
-- Italicize a string.
|
||||
{-| Italicize a string. -}
|
||||
italic : Text -> Text
|
||||
italic = Native.Text.italic
|
||||
|
||||
-- Draw a line above a string.
|
||||
{-| Draw a line above a string. -}
|
||||
overline : Text -> Text
|
||||
overline = Native.Text.overline
|
||||
|
||||
-- Underline a string.
|
||||
{-| Underline a string. -}
|
||||
underline : Text -> Text
|
||||
underline = Native.Text.underline
|
||||
|
||||
-- Draw a line through a string.
|
||||
{-| Draw a line through a string. -}
|
||||
strikeThrough : Text -> Text
|
||||
strikeThrough = Native.Text.strikeThrough
|
||||
|
||||
-- Display justified, styled text.
|
||||
{-| Display justified, styled text. -}
|
||||
justified : Text -> Element
|
||||
justified = Native.Text.justified
|
||||
|
||||
-- Display centered, styled text.
|
||||
{-| Display centered, styled text. -}
|
||||
centered : Text -> Element
|
||||
centered = Native.Text.centered
|
||||
|
||||
-- Display right justified, styled text.
|
||||
{-| Display right justified, styled text. -}
|
||||
righted : Text -> Element
|
||||
righted = Native.Text.righted
|
||||
|
||||
-- Display styled text.
|
||||
{-| Display styled text. -}
|
||||
text : Text -> Element
|
||||
text = Native.Text.text
|
||||
|
||||
-- Display a plain string.
|
||||
{-| Display a plain string. -}
|
||||
plainText : String -> Element
|
||||
plainText = Native.Text.plainText
|
||||
|
||||
-- for internal use only
|
||||
{-| for internal use only -}
|
||||
markdown : Element
|
||||
markdown = Native.Text.markdown
|
||||
|
||||
-- Convert anything to it's textual representation and make it displayable in browser
|
||||
--
|
||||
-- asText == text . monospace . show
|
||||
--
|
||||
-- Excellent for debugging.
|
||||
{-| Convert anything to it's textual representation and make it displayable in
|
||||
browser
|
||||
|
||||
asText == text . monospace . show
|
||||
|
||||
Excellent for debugging.
|
||||
-}
|
||||
asText : a -> Element
|
||||
asText = Native.Text.asText
|
Loading…
Reference in a new issue