From ff57c2f660d604bc6fcae104e108f8d991a48906 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Sun, 4 Apr 2010 15:08:59 +0200 Subject: Added fix to allow dashes in pages. Hakyll splits pages into metadata sections by lines starting with `---`. Because of this, thing like Header ------ Some text. will not parse. This commit fixes this, by fixating the length of the the dash pattern -- all dashed lines should contain the same number of dashes. Therefor, you can use something like --- title: Foobar --- Header ------ Some text. --- tests/Page.hs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests') diff --git a/tests/Page.hs b/tests/Page.hs index ae1fcd9..1b80578 100644 --- a/tests/Page.hs +++ b/tests/Page.hs @@ -23,6 +23,7 @@ pageGroup = testGroup "Page" [ testCase "test_readPage_1" test_readPage_1 , testCase "test_readPage_2" test_readPage_2 , testCase "test_readPage_3" test_readPage_3 + , testCase "test_readPage_4" test_readPage_4 ] -- | An abstract function to test page reading. @@ -68,3 +69,20 @@ test_readPage_3 = test_readPage fileName content assertion @? "test_readPage_3" content = unlines [ "No metadata here, sorry." ] assertion page = M.lookup "body" page == Just "No metadata here, sorry.\n" + +-- | readPage test case 4. +test_readPage_4 = test_readPage fileName content assertion @? "test_readPage_4" + where + fileName = "test_readPage_4.txt" + content = unlines [ "--- section" + , "This is a section." + , "---" + , "Header" + , "------" + , "The header is not a separate section." + ] + assertion page = M.lookup "body" page == Just body + body = unlines [ "Header" + , "------" + , "The header is not a separate section." + ] -- cgit v1.2.3