Skip to content

Commit

Permalink
Correctly handle Category: links.
Browse files Browse the repository at this point in the history
  • Loading branch information
John MacFarlane committed May 20, 2012
1 parent 1486f3f commit a891928
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions hw2gitit.hs
Expand Up @@ -293,7 +293,10 @@ handleLinksImages fs insubdir (Link lab (src,tit))
return $ Link lab ("/Image/" ++ fromUrl (stripPref "/haskellwiki/Image:" src),"") return $ Link lab ("/Image/" ++ fromUrl (stripPref "/haskellwiki/Image:" src),"")
| "/haskellwiki/" `isPrefixOf` src = do | "/haskellwiki/" `isPrefixOf` src = do
let suff = fromUrl $ stripPref "/haskellwiki/" src let suff = fromUrl $ stripPref "/haskellwiki/" src
if suff == fromUrlString tit then let suff' = if "Category:" `isPrefixOf` suff
then "_category/" ++ drop 9 suff
else suff
if suff' == fromUrlString tit then
if stringify lab == tit then if stringify lab == tit then
if insubdir then -- in gitit a link is relative if insubdir then -- in gitit a link is relative
return $ Link lab ('/':tit,"") -- this will change in gitit2 return $ Link lab ('/':tit,"") -- this will change in gitit2
Expand All @@ -302,7 +305,7 @@ handleLinksImages fs insubdir (Link lab (src,tit))
else else
return $ Link lab ('/':tit,tit) return $ Link lab ('/':tit,tit)
else else
return $ Link lab ('/':suff,"") return $ Link lab ('/':suff',"")
| otherwise = return $ Link lab (src,tit) | otherwise = return $ Link lab (src,tit)
handleLinksImages fs insubdir (Image alt (src,tit)) handleLinksImages fs insubdir (Image alt (src,tit))
| "http://www.haskell.org/haskellwiki" `isPrefixOf` src || | "http://www.haskell.org/haskellwiki" `isPrefixOf` src ||
Expand Down

0 comments on commit a891928

Please sign in to comment.