{-# OPTIONS -fno-monomorphism-restriction #-}

module Autolib.Multilingual.Html where

import Autolib.Multilingual

-- import qualified Text.XHtml as Html
import qualified Text.Blaze.Html  as Html
import qualified Text.Blaze.Html5 as Html
import qualified Text.Blaze.Html5.Attributes as HtmlAttr
import qualified Text.Blaze.Html4.Strict (tt)

import Control.Monad ( forM_ )

type Html = Autolib.Multilingual.Type Html.Html

stringToHtml :: a -> Type Html
stringToHtml = Html -> Type Html
forall {a}. a -> Type a
uniform (Html -> Type Html) -> (a -> Html) -> a -> Type Html
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Html
forall a. ToMarkup a => a -> Html
Html.toHtml
textToHtml :: a -> Type Html
textToHtml = Html -> Type Html
forall {a}. a -> Type a
uniform (Html -> Type Html) -> (a -> Html) -> a -> Type Html
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Html
forall a. ToMarkup a => a -> Html
Html.toHtml

blockquote :: f Html -> f Html
blockquote = (Html -> Html) -> f Html -> f Html
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Html -> Html
Html.blockquote
li :: f Html -> f Html
li = (Html -> Html) -> f Html -> f Html
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Html -> Html
Html.li
ulist :: f Html -> f Html
ulist = (Html -> Html) -> f Html -> f Html
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Html -> Html
Html.ul
tt :: f Html -> f Html
tt = (Html -> Html) -> f Html -> f Html
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Html -> Html
Text.Blaze.Html4.Strict.tt
details :: f Html -> f Html
details = (Html -> Html) -> f Html -> f Html
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Html -> Html
Html.details
summary :: f Html -> f Html
summary = (Html -> Html) -> f Html -> f Html
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Html -> Html
Html.summary

itemize :: t (Type Html) -> Type Html
itemize t (Type Html)
xs = [(Language, Html)] -> Type Html
forall a. [(Language, a)] -> Type a
make ([(Language, Html)] -> Type Html)
-> [(Language, Html)] -> Type Html
forall a b. (a -> b) -> a -> b
$ do
    l <- [ Language
forall a. Bounded a => a
minBound, Language
forall a. Bounded a => a
maxBound ]
    return ( l, Html.ul $ forM_ xs $ \ Type Html
x -> Html -> Html
Html.li (Html -> Html) -> Html -> Html
forall a b. (a -> b) -> a -> b
$ Language -> Type Html -> Html
forall a. Language -> Type a -> a
specialize Language
l Type Html
x )

br :: Type Html
br = Html -> Type Html
forall {a}. a -> Type a
uniform Html
Html.br
noHtml :: Type (m ())
noHtml = m () -> Type (m ())
forall {a}. a -> Type a
uniform (m () -> Type (m ())) -> m () -> Type (m ())
forall a b. (a -> b) -> a -> b
$ () -> m ()
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

pre :: f Html -> f Html
pre = (Html -> Html) -> f Html -> f Html
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Html -> Html
Html.pre
primHtml :: f a -> f Html
primHtml = (a -> Html) -> f a -> f Html
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> Html
forall a. ToMarkup a => a -> Html
Html.preEscapedToHtml
image :: Type Html
image = Html -> Type Html
forall {a}. a -> Type a
uniform Html
Html.img

f b
x ! :: f b -> Attribute -> f b
! Attribute
y  = (b -> b) -> f b -> f b
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (b -> Attribute -> b
forall h. Attributable h => h -> Attribute -> h
Html.! Attribute
y) f b
x
f b
x !? :: f b -> (Bool, Attribute) -> f b
!? (Bool, Attribute)
y = (b -> b) -> f b -> f b
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (b -> (Bool, Attribute) -> b
forall h. Attributable h => h -> (Bool, Attribute) -> h
Html.!? (Bool, Attribute)
y) f b
x

src :: AttributeValue -> Attribute
src = AttributeValue -> Attribute
HtmlAttr.src
alt :: AttributeValue -> Attribute
alt = AttributeValue -> Attribute
HtmlAttr.alt
href :: AttributeValue -> Attribute
href = AttributeValue -> Attribute
HtmlAttr.href
name :: AttributeValue -> Attribute
name = AttributeValue -> Attribute
HtmlAttr.name
open :: AttributeValue -> Attribute
open = AttributeValue -> Attribute
HtmlAttr.open
class_ :: AttributeValue -> Attribute
class_ = AttributeValue -> Attribute
HtmlAttr.class_

anchor :: f Html -> f Html
anchor = (Html -> Html) -> f Html -> f Html
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Html -> Html
Html.a

-- f << doc = fold_list  (f Html.<<)  doc

+++ :: Type (m a) -> Type (m a) -> Type (m a)
(+++) = (m a -> m a -> m a) -> Type (m a) -> Type (m a) -> Type (m a)
forall a. (a -> a -> a) -> Type a -> Type a -> Type a
fold_binary m a -> m a -> m a
forall a b. m a -> m b -> m b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
(>>)