Commit 29fa37ef authored by Nicolas Lenz's avatar Nicolas Lenz

Commentary

parent 39e8e5aa
Pipeline #172 passed with stage
in 2 minutes and 36 seconds
......@@ -76,6 +76,7 @@ buildArticles navbar inputs = do
where extraMeta = Meta $ Map.fromList [("navbar", navbar)]
-- | Gets the previous and next neigbors for each article in the list. This only works if every pandocument has the link meta value set.
getNeighbors :: [Pandoc] -> [(Maybe MetaValue, Maybe MetaValue)]
getNeighbors articles = f <$> [0..(length articles - 1)] where
-- Index + 1 is previous as the newest is first in the list
......@@ -84,7 +85,8 @@ getNeighbors articles = f <$> [0..(length articles - 1)] where
getLink :: Pandoc -> Maybe MetaValue
getLink (Pandoc meta _) = lookupMeta "link" meta
-- TODO replace with library function
-- | Safely retrieve an item from a list, returning Nothing on failure.
safeIndex :: [a] -> Int -> Maybe a
safeIndex [] _ = Nothing
safeIndex _ n | n < 0 = Nothing
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment