aboutsummaryrefslogtreecommitdiff
path: root/Tags.hs
diff options
context:
space:
mode:
authorMirek Kratochvil <miroslav.kratochvil@uni.lu>2023-10-16 19:08:27 +0200
committerMirek Kratochvil <miroslav.kratochvil@uni.lu>2023-10-16 19:08:27 +0200
commite2cec0c7a7d56058773f3534c202e1b85f57baff (patch)
treecfffdeb0b8214c455f5e84919dcc621460408d67 /Tags.hs
parent56dcda56193d0148af8868d81247010c0d0b8db3 (diff)
downloadreploy-e2cec0c7a7d56058773f3534c202e1b85f57baff.tar.gz
reploy-e2cec0c7a7d56058773f3534c202e1b85f57baff.tar.bz2
reformat using new hindent (cuteness +63)
Diffstat (limited to 'Tags.hs')
-rw-r--r--Tags.hs55
1 files changed, 30 insertions, 25 deletions
diff --git a/Tags.hs b/Tags.hs
index 1a55453..c407dfd 100644
--- a/Tags.hs
+++ b/Tags.hs
@@ -44,8 +44,10 @@ sourceTagMetaFile fp = do
case yml' of
Left err ->
error
- ("Failed to load tag metadata from " ++ fp ++ ": " ++
- Y.prettyPrintParseException err)
+ ("Failed to load tag metadata from "
+ ++ fp
+ ++ ": "
+ ++ Y.prettyPrintParseException err)
Right yml -> traverse_ go (KM.toList yml)
where go :: (KM.Key, Y.Value) -> Site ()
go (k, v') =
@@ -61,8 +63,10 @@ sourceTagMetaFile fp = do
| v == ov = Just ov
| otherwise =
error
- ("conflicting tag metadata for tag " ++ ks ++ " in " ++
- fp)
+ ("conflicting tag metadata for tag "
+ ++ ks
+ ++ " in "
+ ++ fp)
ins Nothing = Just v
in tagMeta %= M.alter ins kx
@@ -87,10 +91,11 @@ sourceTags :: Site ()
sourceTags = do
sgat <-
map
- (second $ map splitTag .
- (^.. pageMeta . key "tags" . values . _String . to T.unpack)) .
- M.assocs <$>
- use pages
+ (second
+ $ map splitTag
+ . (^.. pageMeta . key "tags" . values . _String . to T.unpack))
+ . M.assocs
+ <$> use pages
ehtags .= M.fromList (invExpandTags sgat)
htags .= M.fromList (invTags sgat)
@@ -115,19 +120,19 @@ htagRenderMeta makeLink htag = do
links <- map fromString <$> traverse makeLink htags
names <- map fromString <$> traverse getTagGroupName htags
metas <- traverse htagMeta htags
- pure $
- Y.object
- [ ("href", last links)
- , ("name", last names)
- , ("meta", last metas)
- , ( "htag"
- , Y.array $
- zipWith3
- (\l n m -> Y.object [("href", l), ("name", n), ("meta", m)])
- links
- names
- metas)
- ]
+ pure
+ $ Y.object
+ [ ("href", last links)
+ , ("name", last names)
+ , ("meta", last metas)
+ , ( "htag"
+ , Y.array
+ $ zipWith3
+ (\l n m -> Y.object [("href", l), ("name", n), ("meta", m)])
+ links
+ names
+ metas)
+ ]
data SortKey num
= Negative num
@@ -151,8 +156,8 @@ genericTaggedPagesRenderMeta ::
-> M.Map [String] [FilePath]
-> Site Y.Value
genericTaggedPagesRenderMeta makePageMeta htag tagmap =
- Y.array . map snd . sortOn (uncurry toSortKey) <$>
- traverse metaPair (maybe [] id $ tagmap M.!? htag)
+ Y.array . map snd . sortOn (uncurry toSortKey)
+ <$> traverse metaPair (maybe [] id $ tagmap M.!? htag)
where
metaPair x = do
m <- makePageMeta x
@@ -190,6 +195,6 @@ htagRenderMetaWithSubtags makeLink extraMeta subtagMeta htag = do
m <- subtagMeta x
pure (joinPath x, m)
subtagMetas <-
- Y.array . filter (/= Y.Null) . map snd . sortOn (uncurry toSortKey) <$>
- traverse metaPair subtags
+ Y.array . filter (/= Y.Null) . map snd . sortOn (uncurry toSortKey)
+ <$> traverse metaPair subtags
pure $ meta `objMerge` Y.object [("subtags", subtagMetas)] `objMerge` em