Skip to content

Commit

Permalink
only return last diff. Next up, work out how to strip meta data
Browse files Browse the repository at this point in the history
  • Loading branch information
irv committed Oct 2, 2011
1 parent 02b95f9 commit 99cf5af
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/site.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ getRevisionList = unsafeCompiler $ \path -> do
getDiff :: Compiler (FilePath, [(Revision, Revision)]) Diff
getDiff = unsafeCompiler $ \(page,rl) -> do
diffs <- mapM (getFileDiff (takeFileName page) ) rl
putStrLn $ show diffs
return $ concat diffs
return $ head diffs

renderDiff :: (DI, [String]) -> String
renderDiff l = diffInd (fst l) ++ unlines (snd l) --renderHtml $ H.pre ! A.class_ (attrCls (fst l)) $ diffCnt l
Expand Down Expand Up @@ -56,8 +55,8 @@ getListPrev i l = l !! checkBounds (fromMaybe 0 (i `elemIndex` l) +1 )
constructDiff :: String -> Diff -> Compiler () (Page String)
constructDiff i d = constA mempty
>>> addDefaultFields >>> arr applySelf
-- >>> arr (setField "diff" (writeHtmlString options $ readMarkdown defaultParserState $ diff' d))
>>> arr (setField "diff" (diff' d))
>>> arr (setField "diff" (writeHtmlString options $ readMarkdown defaultParserState $ diff' d))
-- >>> arr (setField "diff" (diff' d))
>>> arr (setField "title" ("Changes " ++ i))
>>> applyTemplateCompiler "templates/diff.html"
>>> applyTemplateCompiler "templates/default.html"
Expand Down Expand Up @@ -142,7 +141,7 @@ main = hakyll $ do
group "diffs" $ match "articles/*" $ do
metaCompileWith "diffs" $ requireAll_ "articles/*"
>>> mapCompiler makeRevisionCompiler
match "diffs/*" $ route $( gsubRoute "diffs/" (const "articles/diffs/") `composeRoutes` setExtension "markdown")
match "diffs/*" $ route $( gsubRoute "diffs/" (const "articles/diffs/") `composeRoutes` setExtension "html")
match "templates/*" $ compile templateCompiler
-- Index
match "index.html" $ route idRoute
Expand Down

0 comments on commit 99cf5af

Please sign in to comment.