forked from ff-notes/ff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFeatures.hs
115 lines (105 loc) · 3.31 KB
/
Features.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE RecordWildCards #-}
module Main (main) where
import Data.Foldable (for_)
import Data.Function ((&))
import Data.Semigroup ((<>))
import Data.String (IsString, fromString)
import Data.String.Interpolate.IsString (i)
import Text.Blaze.Html.Renderer.Pretty (renderHtml)
import Text.Blaze.Html5 (Html, code, li, meta, string, style, table,
td, th, tr, ul, (!))
import Text.Blaze.Html5.Attributes (charset, class_, colspan, rowspan)
type Implemetation = Bool
data Feature = Feature
{ fDescription :: String
, fCli :: Implemetation
, fQt :: Implemetation
, fGtk :: Implemetation
, fWx :: Implemetation
, fAndroid :: Implemetation
, fIos :: Implemetation
}
instance IsString Feature where
fromString description = Feature
{ fDescription = fromString description
, fCli = False
, fQt = False
, fGtk = False
, fWx = False
, fAndroid = False
, fIos = False
}
features :: [Feature]
features =
[ "Any note list" & cli & qt
, "- Show start/end dates" & cli
, "- Sort by start date/time" & cli
, "- Limit by default" & cli
, "- Agenda" & cli & qt
, "- - Show only active" & cli & qt
, "- - Show only started (now >= start)"
, "Add note/task" & cli
, "- with start date" & cli
, "- with start time"
, "- with end date" & cli
, "- with end time"
, "Mark as done/archive" & cli
, "Configuration" & cli
, "- detect folder" & cli
, "- - ~/Yandex.Disk" & cli
, "- - ~/Yandex.Disk.localized" & cli
, "UI" & cli & qt
, "- поддержка русского языка (кириллицы, Юникода) в заметках" & cli & qt
, "- multiline notes" & qt
, "Search"
, "Postpone" & cli
, "Workspaces"
]
main :: IO ()
main = writeFile "/tmp/features.html" $ renderHtml $ do
meta ! charset "utf-8"
style [i|
table { border-collapse: collapse; }
th, td { border: solid 1px; }
td.no { background: lightcoral; }
td.yes { background: lightgreen; }
ul { margin: 0; }
|]
table $ do
tr $ do
th ! rowspan "2" $ "Feature"
th ! rowspan "2" $ "CLI" <> code "ff"
th ! colspan "3" $ "GUI"
th ! colspan "2" $ "Mobile"
tr $ do
th $ code "ff-qt"
th $ code "ff-gtk"
th $ code "ff-wx"
th "Android"
th "iOS"
for_ features $ \Feature{..} -> tr $ do
td $ deep fDescription
check True fCli
check False fQt
check False fGtk
check False fWx
check True fAndroid
check False fIos
check
:: Bool -- ^ needed
-> Bool -- ^ implemeted
-> Html
check False False = td ""
check True False = td ! class_ "no" $ "❌"
check _ True = td ! class_ "yes" $ "✅"
deep :: String -> Html
deep = \case
'-' : ' ' : s -> ul $ li $ deep s
s -> string s
cli, qt :: Feature -> Feature
cli f = f{fCli = True}
qt f = f{fQt = True}