bamboo-2009.6.6: src/Bamboo/Model/Helper.hs
{-# LANGUAGE NoImplicitPrelude #-}
module Bamboo.Model.Helper where
import Bamboo.Env
import Bamboo.Helper.StateHelper
import Bamboo.Type.Reader
import Data.ByteString (ByteString)
-- import Bamboo.Type.Plugin (apply_plugin)
get_body :: String -> IO ByteString
get_body id = id.id_to_path .read_bytestring
get_reader :: String -> Reader
get_reader id =
id
.take_extension
.guess_reader
.fromMaybe (static_config.default_reader)
--
-- apply_plugin_for_resource id
-- | id.id_to_type.belongs_to [static_config.post_id, static_config.static_id] = apply_plugin
-- | otherwise = return
meta :: String -> String
meta = (++ ".meta")
image_extensions :: [String]
image_extensions = ["jpg", "jpeg", "png", "gif"]
is_image :: String -> Bool
is_image x = image_extensions.any (`isSuffixOf` x)
spaced_url :: String -> String
spaced_url = gsub "/" " / "