Skip to content

Commit

Permalink
Fixed categories page when metadata ends with ---.
Browse files Browse the repository at this point in the history
Closes jgm#547.
  • Loading branch information
jgm committed Sep 30, 2016
1 parent fe50da5 commit 1da8a36
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Network/Gitit/Page.hs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ readCategories f =
E.catch (do fl <- B.hGetLine h
if dashline fl
then do -- get rest of metadata
rest <- hGetLinesTill h dotline
rest <- hGetLinesTill h dotOrDashline
let (md,_) = parseMetadata $ unlines $ "---":rest
return $ splitCategories $ fromMaybe ""
$ lookup "categories" md
Expand All @@ -185,9 +185,10 @@ dashline x =
('-':'-':'-':xs) | all (==' ') xs -> True
_ -> False

dotline :: B.ByteString -> Bool
dotline x =
dotOrDashline :: B.ByteString -> Bool
dotOrDashline x =
case BC.unpack x of
('-':'-':'-':xs) | all (==' ') xs -> True
('.':'.':'.':xs) | all (==' ') xs -> True
_ -> False

Expand Down

0 comments on commit 1da8a36

Please sign in to comment.