diff options
| author | Mirek Kratochvil <miroslav.kratochvil@uni.lu> | 2023-10-16 19:08:27 +0200 |
|---|---|---|
| committer | Mirek Kratochvil <miroslav.kratochvil@uni.lu> | 2023-10-16 19:08:27 +0200 |
| commit | e2cec0c7a7d56058773f3534c202e1b85f57baff (patch) | |
| tree | cfffdeb0b8214c455f5e84919dcc621460408d67 /Tags.hs | |
| parent | 56dcda56193d0148af8868d81247010c0d0b8db3 (diff) | |
| download | reploy-e2cec0c7a7d56058773f3534c202e1b85f57baff.tar.gz reploy-e2cec0c7a7d56058773f3534c202e1b85f57baff.tar.bz2 | |
reformat using new hindent (cuteness +63)
Diffstat (limited to 'Tags.hs')
| -rw-r--r-- | Tags.hs | 55 |
1 files changed, 30 insertions, 25 deletions
@@ -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 |
