module Data.Aviation.Casr.Logbook.TrackLog (
TrackLog(..)
) where
import Data.Aviation.Casr.Logbook.Printer.Markdown
import Data.Aviation.Casr.Logbook.Printer.Html
import Data.Aviation.Casr.Logbook.TrackLogType
import Data.Maybe
data TrackLog =
TrackLog
String -- uri
(Maybe String) -- name
TrackLogType
deriving (Eq, Ord, Show)
instance Markdown TrackLog where
markdown (TrackLog uri name ttype) =
let t = markdown ttype
n = fmap (\z -> "**" ++ z ++ "**") name
in concat $
case ttype of
ImageLog _ ->
[
" * "
, case n of
Nothing ->
"*" ++ t ++ "*"
Just n' ->
n'
, "\n\n "
, ""
]
_ ->
[
" * "
, case n of
Nothing ->
""
Just n' ->
n' ++ ": "
, "["
, t
, "]("
, uri
, ")"
]
instance Html TrackLog where
html (TrackLog uri name ttype) =
let t = html ttype
n = fmap html name
in concat [
"
"
, ""
, ""
, ""
, ""
, ""
, "