on master help sign in
Embedded working too
0ac1398Michael Snoyman
Network/Wai/Application/Static.hs+15−15
@@ -614,8 +614,8 @@ defaultListing pieces (Folder _ contents) = do
614 H.head $ do
614 H.head $ do
615 let title = T.unpack $ T.intercalate "/" $ map piecePretty pieces
615 let title = T.unpack $ T.intercalate "/" $ map piecePretty pieces
616 let title' = if null title then "root folder" else title
616 let title' = if null title then "root folder" else title
617− H.title $ H.string title'
617+ H.title $ H.toHtml title'
618− H.style $ H.string $ unlines [ "table { margin: 0 auto; width: 760px; border-collapse: collapse; font-family: 'sans-serif'; }"
618+ H.style $ H.toHtml $ unlines [ "table { margin: 0 auto; width: 760px; border-collapse: collapse; font-family: 'sans-serif'; }"
619 , "table, th, td { border: 1px solid #353948; }"
619 , "table, th, td { border: 1px solid #353948; }"
620 , "td.size { text-align: right; font-size: 0.7em; width: 50px }"
620 , "td.size { text-align: right; font-size: 0.7em; width: 50px }"
621 , "td.date { text-align: right; font-size: 0.7em; width: 130px }"
621 , "td.date { text-align: right; font-size: 0.7em; width: 130px }"
@@ -638,12 +638,12 @@ defaultListing pieces (Folder _ contents) = do
638 haskellSrc = image "haskell"
638 haskellSrc = image "haskell"
639 showName "" = "root"
639 showName "" = "root"
640 showName x = x
640 showName x = x
641− showFolder [] = H.string "/"
641+ showFolder [] = "/"
642− showFolder [x] = H.string $ showName x
642+ showFolder [x] = H.toHtml $ showName x
643 showFolder (x:xs) = do
643 showFolder (x:xs) = do
644− let href = concat $ replicate (length xs) "../"
644+ let href = concat $ replicate (length xs) "../" :: String
645− H.a ! A.href (H.stringValue href) $ H.string $ showName x
645+ H.a ! A.href (H.toValue href) $ H.toHtml $ showName x
646− H.string " / "
646+ " / "
647 showFolder xs
647 showFolder xs
648
648
649-- | a function to generate an HTML table showing the contents of a directory on the disk
649-- | a function to generate an HTML table showing the contents of a directory on the disk
@@ -659,10 +659,10 @@ renderDirectoryContentsTable :: String
659 -> [Either Folder File]
659 -> [Either Folder File]
660 -> H.Html
660 -> H.Html
661renderDirectoryContentsTable haskellSrc folderSrc fps =
661renderDirectoryContentsTable haskellSrc folderSrc fps =
662− H.table $ do H.thead $ do H.th ! (A.class_ $ H.stringValue "first") $ H.img ! (A.src $ H.stringValue haskellSrc)
662+ H.table $ do H.thead $ do H.th ! (A.class_ "first") $ H.img ! (A.src $ H.toValue haskellSrc)
663− H.th $ H.string "Name"
663+ H.th "Name"
664− H.th $ H.string "Modified"
664+ H.th "Modified"
665− H.th $ H.string "Size"
665+ H.th "Size"
666 H.tbody $ mapM_ mkRow (zip (sortBy sortMD fps) $ cycle [False, True])
666 H.tbody $ mapM_ mkRow (zip (sortBy sortMD fps) $ cycle [False, True])
667 where
667 where
668 sortMD :: Either Folder File -> Either Folder File -> Ordering
668 sortMD :: Either Folder File -> Either Folder File -> Ordering
@@ -672,12 +672,12 @@ renderDirectoryContentsTable haskellSrc folderSrc fps =
672 sortMD (Right a) (Right b) = compare (fileName a) (fileName b)
672 sortMD (Right a) (Right b) = compare (fileName a) (fileName b)
673 mkRow :: (Either Folder File, Bool) -> H.Html
673 mkRow :: (Either Folder File, Bool) -> H.Html
674 mkRow (md, alt) =
674 mkRow (md, alt) =
675− (if alt then (! A.class_ (H.stringValue "alt")) else id) $
675+ (if alt then (! A.class_ "alt") else id) $
676 H.tr $ do
676 H.tr $ do
677− H.td ! A.class_ (H.stringValue "first")
677+ H.td ! A.class_ "first"
678 $ case md of
678 $ case md of
679− Left{} -> H.img ! A.src (H.stringValue folderSrc)
679+ Left{} -> H.img ! A.src (H.toValue folderSrc)
680− ! A.alt (H.stringValue "Folder")
680+ ! A.alt "Folder"
681 Right{} -> return ()
681 Right{} -> return ()
682 let name = either folderName fileName md
682 let name = either folderName fileName md
683 let isFile = either (const False) (const True) md
683 let isFile = either (const False) (const True) md