Loading src/Build.hs +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ putNavbar nebelhorn@Nebelhorn{..} = nebelhorn f n@NavItem{..} = navItemToMeta navItemActiveOnArticles n putNavbarPage pandoc@(Pandoc meta _) = addMeta "navbar" (MetaList $ f <$> nebelhornNavItems) pandoc where f n@NavItem{..} = case lookupMeta "link" meta of Just (MetaString link) -> navItemToMeta (unpack navItemLink == "/" <> link) n Just (MetaString link) -> navItemToMeta (unpack navItemLink == link) n _ -> navItemToMeta False n navItemToMeta :: Bool -> NavItem -> MetaValue navItemToMeta active NavItem{..} = MetaMap $ Map.fromList Loading src/Load.hs +2 −2 Original line number Diff line number Diff line Loading @@ -35,9 +35,9 @@ prependPath :: Path a Dir -> (Path Rel b, t) -> (Path a b, t) prependPath basePath (path, x) = (basePath </> path, x) -- | Puts a path into the meta values of a pandocument. linkIntoMeta :: Path a File -> Pandoc -> Pandoc linkIntoMeta :: Path Rel File -> Pandoc -> Pandoc linkIntoMeta link (Pandoc (Meta metaMap) bs) = Pandoc (Meta $ Map.insert "link" (MetaString $ toFilePath link) metaMap) bs = Pandoc (Meta $ Map.insert "link" (MetaString $toFilePath $ [absdir|/|] </> link) metaMap) bs -- | Reads all markdown files from a folder recursively, -- returning their contents and paths (relative to the folder path). Loading src/Save.hs +3 −1 Original line number Diff line number Diff line Loading @@ -41,4 +41,6 @@ copyFolders sources sink = forM_ sources $ \source -> copyDirRecur source (sink -- | Retrieves the link meta value as Path from a pandocument getLink :: Pandoc -> Maybe (Path Rel File) getLink (Pandoc meta _) = lookupMeta "link" meta >>= \(MetaString link) -> parseRelFile link getLink (Pandoc meta _) = lookupMeta "link" meta >>= (\(MetaString link) -> parseAbsFile link) >>= stripProperPrefix [absdir|/|] Loading
src/Build.hs +1 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ putNavbar nebelhorn@Nebelhorn{..} = nebelhorn f n@NavItem{..} = navItemToMeta navItemActiveOnArticles n putNavbarPage pandoc@(Pandoc meta _) = addMeta "navbar" (MetaList $ f <$> nebelhornNavItems) pandoc where f n@NavItem{..} = case lookupMeta "link" meta of Just (MetaString link) -> navItemToMeta (unpack navItemLink == "/" <> link) n Just (MetaString link) -> navItemToMeta (unpack navItemLink == link) n _ -> navItemToMeta False n navItemToMeta :: Bool -> NavItem -> MetaValue navItemToMeta active NavItem{..} = MetaMap $ Map.fromList Loading
src/Load.hs +2 −2 Original line number Diff line number Diff line Loading @@ -35,9 +35,9 @@ prependPath :: Path a Dir -> (Path Rel b, t) -> (Path a b, t) prependPath basePath (path, x) = (basePath </> path, x) -- | Puts a path into the meta values of a pandocument. linkIntoMeta :: Path a File -> Pandoc -> Pandoc linkIntoMeta :: Path Rel File -> Pandoc -> Pandoc linkIntoMeta link (Pandoc (Meta metaMap) bs) = Pandoc (Meta $ Map.insert "link" (MetaString $ toFilePath link) metaMap) bs = Pandoc (Meta $ Map.insert "link" (MetaString $toFilePath $ [absdir|/|] </> link) metaMap) bs -- | Reads all markdown files from a folder recursively, -- returning their contents and paths (relative to the folder path). Loading
src/Save.hs +3 −1 Original line number Diff line number Diff line Loading @@ -41,4 +41,6 @@ copyFolders sources sink = forM_ sources $ \source -> copyDirRecur source (sink -- | Retrieves the link meta value as Path from a pandocument getLink :: Pandoc -> Maybe (Path Rel File) getLink (Pandoc meta _) = lookupMeta "link" meta >>= \(MetaString link) -> parseRelFile link getLink (Pandoc meta _) = lookupMeta "link" meta >>= (\(MetaString link) -> parseAbsFile link) >>= stripProperPrefix [absdir|/|]