Cleanup, documentation
diff --git a/Blog/Blog.hs b/Blog/Blog.hs
index b4185a7..6558785 100644
--- a/Blog/Blog.hs
+++ b/Blog/Blog.hs
@@ -1,6 +1,5 @@
-
import System.IO
-import Database.HDBC (SqlValue(..),toSql)
+import Database.HDBC (toSql)
import Framework.API
import Framework.Utils
diff --git a/Blog/Models.hs b/Blog/Models.hs
index fbc83da..aaec1a7 100644
--- a/Blog/Models.hs
+++ b/Blog/Models.hs
@@ -5,7 +5,6 @@ module Models where
import qualified Data.Map as M
-import Framework.Types
import Framework.TEngine.Types
import Framework.Forms.Types
import Framework.Forms.HTML
diff --git a/Framework/API/CRUD.hs b/Framework/API/CRUD.hs
index bc8f464..7a271c2 100644
--- a/Framework/API/CRUD.hs
+++ b/Framework/API/CRUD.hs
@@ -12,14 +12,12 @@ import Framework.Controller
import Framework.Http.Vars
import Framework.Http.Response
import Framework.ORM.Types
-import Framework.API.SQL
import Framework.API.SQLUtils
import Framework.API.UserMessage
import Framework.Forms.Types
import Framework.Forms.Rendering
import Framework.Forms.ModelForm
import Framework.GetText.Controller
-import Framework.TEngine.TemplateUtil
{- | Controller for creating a Model
diff --git a/Framework/GetText/HTML.hs b/Framework/GetText/HTML.hs
index 1c31f4e..4155170 100644
--- a/Framework/GetText/HTML.hs
+++ b/Framework/GetText/HTML.hs
@@ -1,7 +1,6 @@
module Framework.GetText.HTML where
import Framework.Controller
-import Framework.Forms.HTMLTypes
import Framework.Forms.Types
import qualified Framework.GetText.Controller as C
diff --git a/Framework/ORM/Models.hs b/Framework/ORM/Models.hs
index 41debc6..566be02 100644
--- a/Framework/ORM/Models.hs
+++ b/Framework/ORM/Models.hs
@@ -15,7 +15,6 @@ import Data.Maybe
import qualified Data.Convertible.Base as CD
import Database.HDBC (SqlValue(..), fromSql)
-import Framework.Types
import Framework.TEngine.Types
import Framework.ORM.Types
diff --git a/Framework/ORM/SQL.hs b/Framework/ORM/SQL.hs
index 0f22215..91f0c2e 100644
--- a/Framework/ORM/SQL.hs
+++ b/Framework/ORM/SQL.hs
@@ -11,7 +11,7 @@ module Framework.ORM.SQL
aggregate, count
) where
-import Debug.Trace
+-- import Debug.Trace
import Data.List
diff --git a/Framework/TEngine/TemplateFuncs.hs b/Framework/TEngine/TemplateFuncs.hs
index df6d3bd..b4476e8 100644
--- a/Framework/TEngine/TemplateFuncs.hs
+++ b/Framework/TEngine/TemplateFuncs.hs
@@ -13,7 +13,7 @@ import Data.List
import qualified Data.Map as M
import Framework.TEngine.Types
-import qualified Framework.Pager as Pager
+-- import qualified Framework.Pager as Pager
bold :: Maybe TContainer -> String
bold = apply $ \s -> "<strong>"++s++"</strong>"
diff --git a/Framework/TGenerator/TemplateGen.hs b/Framework/TGenerator/TemplateGen.hs
index 579ae12..15fe6ee 100644
--- a/Framework/TGenerator/TemplateGen.hs
+++ b/Framework/TGenerator/TemplateGen.hs
@@ -1,3 +1,6 @@
+-- | Generator of Templates.hs
+module TemplateGen where
+
import Prelude hiding (readFile)
import System.IO hiding (readFile,hPutStrLn,hPutStr)
import System.IO.UTF8
diff --git a/Framework/TGenerator/TemplateParser.hs b/Framework/TGenerator/TemplateParser.hs
index 398e9ba..9519a84 100644
--- a/Framework/TGenerator/TemplateParser.hs
+++ b/Framework/TGenerator/TemplateParser.hs
@@ -1,15 +1,15 @@
+-- | Parser for templates
module TemplateParser
(Format (..), Template,
parseTemplate)
where
import Data.Char
+import Data.String.Utils
import Text.ParserCombinators.Parsec
import qualified Text.ParserCombinators.Parsec.Token as P
import Text.ParserCombinators.Parsec.Language (haskellDef)
-import Framework.Utils
-
--------------------------------------------------------------------------------------------------
-- Types
--------------------------------------------------------------------------------------------------
@@ -28,11 +28,14 @@ type Template = [Format]
-- Parser
--------------------------------------------------------------------------------------------------
+lexer :: P.TokenParser st
lexer = P.makeTokenParser haskellDef
-- identifier = P.identifier lexer
+symbol :: String -> CharParser st String
symbol = P.symbol lexer
+parseTemplate :: SourceName -> String -> Either ParseError Template
parseTemplate = parse pTemplate
pTemplate :: GenParser Char st Template
@@ -88,18 +91,19 @@ pInclude = do
symbol "{%include"
s <- many1 (noneOf " %")
symbol "%}"
- return $ Include (trim s)
+ return $ Include (strip s)
pIncludeVar :: GenParser Char st Format
pIncludeVar = do
symbol "{%includevar"
v <- many1 (noneOf " %")
symbol "%}"
- return $ IncludeVar (trim v)
+ return $ IncludeVar (strip v)
-----------------------------------------------------------------------------------
-- Parser utilites
+words' :: String -> [String]
words' x = init ws ++ [v,t]
where ws = words x
- [v,t] = splitWith (==':') (last ws)
+ [v,t] = split (":") (last ws)