blob: 5aa67f51319b895059cfae58a94cfff634d8ec56 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
{-# LANGUAGE OverloadedStrings #-}
{- |
Module : Text.Pandoc.Emoji
Copyright : Copyright (C) 2015 John MacFarlane
License : GNU GPL, version 2 or above
Maintainer : John MacFarlane <jgm@berkeley.edu>
Stability : alpha
Portability : portable
Emoji symbol lookup from canonical string identifier.
-}
module Text.Pandoc.Emoji ( emojis, emojiToInline ) where
import qualified Text.Emoji as E
import Text.Pandoc.Definition (Inline (Span, Str))
import Data.Text (Text)
import qualified Data.Map as M
emojis :: M.Map Text Text
emojis = M.fromList E.emojis
emojiToInline :: Text -> Maybe Inline
emojiToInline emojikey = makeSpan <$> E.emojiFromAlias emojikey
where makeSpan = Span ("", ["emoji"], [("data-emoji", emojikey)]) . (:[]) . Str
|