1
1
{-# LANGUAGE DerivingStrategies #-}
2
2
{-# LANGUAGE LambdaCase #-}
3
- {-# LANGUAGE OverloadedRecordDot #-}
4
3
{-# LANGUAGE OverloadedStrings #-}
5
4
6
5
module Security.Advisories.Generate.HTML
@@ -59,10 +58,10 @@ renderAdvisoriesIndex src dst = do
59
58
let advisoriesDir = dst </> " advisory"
60
59
createDirectoryIfMissing False advisoriesDir
61
60
forM_ advisories $ \ advisory ->
62
- renderToFile' (advisoriesDir </> advisoryHtmlFilename advisory . advisoryId) $
61
+ renderToFile' (advisoriesDir </> advisoryHtmlFilename ( Advisories . advisoryId advisory) ) $
63
62
inPage PageAdvisory $
64
63
div_ [class_ " pure-u-1" ] $
65
- toHtmlRaw advisory . advisoryHtml
64
+ toHtmlRaw ( Advisories . advisoryHtml advisory)
66
65
67
66
-- * Rendering types
68
67
@@ -97,13 +96,13 @@ listByDates advisories =
97
96
tbody_ $ do
98
97
let sortedAdvisories =
99
98
zip
100
- (sortOn (Down . ( . advisoryId) ) advisories)
99
+ (sortOn (Down . advisoryId) advisories)
101
100
(cycle [[] , [class_ " pure-table-odd" ]])
102
101
forM_ sortedAdvisories $ \ (advisory, trClasses) ->
103
102
tr_ trClasses $ do
104
- td_ [class_ " advisory-id" ] $ a_ [href_ $ advisoryLink advisory . advisoryId] $ toHtml (Advisories. printHsecId advisory . advisoryId)
105
- td_ [class_ " advisory-packages" ] $ toHtml $ T. intercalate " ," $ ( . packageName) <$> advisory . advisoryAffected
106
- td_ [class_ " advisory-summary" ] $ toHtml advisory . advisorySummary
103
+ td_ [class_ " advisory-id" ] $ a_ [href_ $ advisoryLink ( advisoryId advisory) ] $ toHtml (Advisories. printHsecId ( advisoryId advisory) )
104
+ td_ [class_ " advisory-packages" ] $ toHtml $ T. intercalate " ," $ packageName <$> advisoryAffected advisory
105
+ td_ [class_ " advisory-summary" ] $ toHtml $ advisorySummary advisory
107
106
108
107
listByPackages :: [AdvisoryR ] -> Html ()
109
108
listByPackages advisories =
@@ -113,9 +112,9 @@ listByPackages advisories =
113
112
byPackage =
114
113
Map. fromList $
115
114
groupSort
116
- [ (package . packageName, (advisory, package))
115
+ [ (packageName package , (advisory, package))
117
116
| advisory <- advisories,
118
- package <- advisory . advisoryAffected
117
+ package <- advisoryAffected advisory
119
118
]
120
119
121
120
forM_ (Map. toList byPackage) $ \ (currentPackageName, perPackageAdvisory) -> do
@@ -132,14 +131,14 @@ listByPackages advisories =
132
131
tbody_ $ do
133
132
let sortedAdvisories =
134
133
zip
135
- (sortOn (Down . ( . advisoryId) . fst ) perPackageAdvisory)
134
+ (sortOn (Down . advisoryId . fst ) perPackageAdvisory)
136
135
(cycle [[] , [class_ " pure-table-odd" ]])
137
136
forM_ sortedAdvisories $ \ ((advisory, package), trClasses) ->
138
137
tr_ trClasses $ do
139
- td_ [class_ " advisory-id" ] $ a_ [href_ $ advisoryLink advisory . advisoryId] $ toHtml (Advisories. printHsecId advisory . advisoryId)
140
- td_ [class_ " advisory-introduced" ] $ toHtml package . introduced
141
- td_ [class_ " advisory-fixed" ] $ maybe (return () ) toHtml package . fixed
142
- td_ [class_ " advisory-summary" ] $ toHtml advisory . advisorySummary
138
+ td_ [class_ " advisory-id" ] $ a_ [href_ $ advisoryLink $ advisoryId advisory ] $ toHtml (Advisories. printHsecId $ advisoryId advisory )
139
+ td_ [class_ " advisory-introduced" ] $ toHtml $ introduced package
140
+ td_ [class_ " advisory-fixed" ] $ maybe (return () ) toHtml $ fixed package
141
+ td_ [class_ " advisory-summary" ] $ toHtml $ advisorySummary advisory
143
142
144
143
-- * Utils
145
144
@@ -199,16 +198,16 @@ advisoryLink advisoryId' = "/advisory/" <> T.pack (advisoryHtmlFilename advisory
199
198
toAdvisoryR :: Advisories. Advisory -> AdvisoryR
200
199
toAdvisoryR x =
201
200
AdvisoryR
202
- { advisoryId = x . advisoryId,
203
- advisorySummary = x . advisorySummary,
204
- advisoryAffected = concatMap toAffectedPackageR x . advisoryAffected
201
+ { advisoryId = Advisories . advisoryId x ,
202
+ advisorySummary = Advisories . advisorySummary x ,
203
+ advisoryAffected = concatMap toAffectedPackageR $ Advisories . advisoryAffected x
205
204
}
206
205
where
207
206
toAffectedPackageR :: Advisories. Affected -> [AffectedPackageR ]
208
207
toAffectedPackageR p =
209
- flip map p . affectedVersions $ \ versionRange ->
208
+ flip map ( Advisories . affectedVersions p) $ \ versionRange ->
210
209
AffectedPackageR
211
- { packageName = p . affectedPackage,
212
- introduced = versionRange . affectedVersionRangeIntroduced,
213
- fixed = versionRange . affectedVersionRangeFixed
210
+ { packageName = Advisories . affectedPackage p ,
211
+ introduced = Advisories . affectedVersionRangeIntroduced versionRange ,
212
+ fixed = Advisories . affectedVersionRangeFixed versionRange
214
213
}
0 commit comments