HAppSHelpers 0.6 → 0.7
raw patch · 2 files changed
+32/−24 lines, 2 files
Files
- HAppS/Helpers/DirBrowse.hs +31/−23
- HAppSHelpers.cabal +1/−1
HAppS/Helpers/DirBrowse.hs view
@@ -20,27 +20,17 @@ import Language.Haskell.HsColour.HTML import Language.Haskell.HsColour.Colourise -defaultColourPrefs = ColourPrefs- { keyword = [Foreground Green,Underscore]- , keyglyph = [Foreground Red]- , layout = [Foreground Cyan]- , comment = [Foreground Blue]- , conid = [Normal]- , varid = [Normal]- , conop = [Foreground Red,Bold]- , varop = [Foreground Cyan]- , string = [Foreground Magenta]- , char = [Foreground Magenta]- , number = [Foreground Magenta]- , cpp = [Foreground Magenta,Dim]- , selection = [Bold, Foreground Magenta]- , variantselection = [Dim, Foreground Red, Underscore]- , definition = [Foreground Blue]- }-- {- | browsedir = browsedir' defPaintdir defPaintfile ++ define a ServerPartT value with something like++ sp = browsedir \"projectroot\" \".\" ++ where projectroot is an alias (what you see in the url) and "." is the path relative to the executable running + + the happs server+ -} browsedir :: FilePath -> FilePath -> ServerPartT IO Response browsedir = browsedir' defPaintdir defPaintfile @@ -50,7 +40,7 @@ browsedirHS = browsedir' defPaintdir hsPaintfile -}-browsedirHS :: [Char] -> [Char] -> ServerPartT IO Response+browsedirHS :: FilePath -> FilePath -> ServerPartT IO Response browsedirHS = browsedir' defPaintdir hsPaintfile {- |@@ -62,8 +52,8 @@ syspath: real system path -}-browsedir' :: (String -> [FilePath] -> BrowseHtmlString)- -> (String -> String -> BrowseHtmlString)+browsedir' :: (ToMessage a, ToMessage b) => (String -> [FilePath] -> a)+ -> (String -> String -> b) -> FilePath -> FilePath -> ServerPartT IO Response@@ -100,8 +90,26 @@ ( (drop (length filename - 3) n) ) == ".hs" || (drop (length filename - 3) n) == ".lhs" where n = map toLower filename+ defaultColourPrefs = ColourPrefs+ { keyword = [Foreground Green,Underscore]+ , keyglyph = [Foreground Red]+ , layout = [Foreground Cyan]+ , comment = [Foreground Blue]+ , conid = [Normal]+ , varid = [Normal]+ , conop = [Foreground Red,Bold]+ , varop = [Foreground Cyan]+ , string = [Foreground Magenta]+ , char = [Foreground Magenta]+ , number = [Foreground Magenta]+ , cpp = [Foreground Magenta,Dim]+ , selection = [Bold, Foreground Magenta]+ , variantselection = [Dim, Foreground Red, Underscore]+ , definition = [Foreground Blue]+ } -defPaintfile _ f = BrowseHtmlString f ++defPaintfile _ f = f defPaintdir aliaspath fs = let flinks = map g . filter (not . boringfile ) . sort $ fs g f = simpleLink ('/' : (combine aliaspath f)) f
HAppSHelpers.cabal view
@@ -1,5 +1,5 @@ Name: HAppSHelpers-Version: 0.6+Version: 0.7 License: BSD3 License-file: bsd3.txt Description: Functions I found I was using repeatedly when programming HAppS based web-apps.