packages feed

halipeto 2.1 → 2.2

raw patch · 7 files changed

+162/−165 lines, 7 filesdep −haskell98dep ~base

Dependencies removed: haskell98

Dependency ranges changed: base

Files

Halipeto/Dictionary.lhs view
@@ -1,30 +1,30 @@-%  -% Halipeto 2.0 -  Haskell static web page generator -% Copyright 2004 Andrew Cooke (andrew@acooke.org) -% Copyright 2007 Peter Simons (simons@cryp.to) -%  -%     This program is free software; you can redistribute it and/or modify -%     it under the terms of the GNU General Public License as published by -%     the Free Software Foundation; either version 2 of the License, or -%     (at your option) any later version. -%  -%     This program is distributed in the hope that it will be useful, -%     but WITHOUT ANY WARRANTY; without even the implied warranty of -%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -%     GNU General Public License for more details. -%  -%     You should have received a copy of the GNU General Public License -%     along with this program; if not, write to the Free Software -%     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA -%  -% EXCEPT -%  -% Files in FromHaxml are from HaXml - http://www.cs.york.ac.uk/HaXml - -% see the COPYRIGHT and LICENSE in that directory.  The files included -% are a subset of the full HaXml distribution and have been modified to -% originate from the FromHaxml module (so that install on Win32 is -% easy). -%  +%+% Halipeto -- Haskell static web page generator+% Copyright 2004 Andrew Cooke (andrew@acooke.org)+% Copyright 2007-2010 Peter Simons (simons@cryp.to)+%+%     This program is free software; you can redistribute it and/or modify+%     it under the terms of the GNU General Public License as published by+%     the Free Software Foundation; either version 2 of the License, or+%     (at your option) any later version.+%+%     This program is distributed in the hope that it will be useful,+%     but WITHOUT ANY WARRANTY; without even the implied warranty of+%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+%     GNU General Public License for more details.+%+%     You should have received a copy of the GNU General Public License+%     along with this program; if not, write to the Free Software+%     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA+%+% EXCEPT+%+% Files in FromHaxml are from HaXml - http://www.cs.york.ac.uk/HaXml -+% see the COPYRIGHT and LICENSE in that directory.  The files included+% are a subset of the full HaXml distribution and have been modified to+% originate from the FromHaxml module (so that install on Win32 is+% easy).+%  \section{Dictionary} @@ -55,9 +55,8 @@ ) where  import Prelude hiding (null)-import Char-import List hiding (find, null, partition, insert)-import Maybe+import Data.Char+import Data.List hiding (find, null, partition, insert) import Halipeto.Utilities \end{code} @@ -219,7 +218,7 @@   values            = map snd . contents   children d k      = map packNC $ children'' (unpackNC d) (uncase $ toNull k)   children' d k     = children d (fromDot k)-  adopt d1 (k, d2)  = +  adopt d1 (k, d2)  =     packNC $ adopt'' (unpackNC d1) (uncase $ toNull k) (unpackNC d2)   adopt' d1 (k, d2) = adopt d1 (fromDot k, d2)   merge d1 d2       = packNC $ merge'' (unpackNC d1) (unpackNC d2)@@ -235,24 +234,24 @@ %%Haddock: A dictionary whose values can be ordered (and so sorted) \begin{code} class (Ord a, Dictionary d a) => OrdDictionary d a where-  diff      :: d a -> d a +  diff      :: d a -> d a                  -> ([([String], a)], [([String], a)], [([String], a)])                  -- ^ Partition into common and distinct values-  diff'     :: d a -> d a +  diff'     :: d a -> d a                  -> ([(String, a)], [(String, a)], [(String, a)])                  -- ^ Partition into common and distinct values .-format  instance Ord a => OrdDictionary DictCase a where-  diff d1 d2  = mapT3 (map (\(k, v) -> (fromNull k, v))) $ +  diff d1 d2  = mapT3 (map (\(k, v) -> (fromNull k, v))) $                   diff'' (unpack d1) (unpack d2)   diff' d1 d2 = mapT3 (map (\(k, v) -> (toDot k, v))) $ diff d1 d2  instance Ord a => OrdDictionary DictNoCase a where-  diff d1 d2  = mapT3 (map (\(k, v) -> (fromNull k, v))) $ +  diff d1 d2  = mapT3 (map (\(k, v) -> (fromNull k, v))) $                   diff'' (unpackNC d1) (unpackNC d2)   diff' d1 d2 = mapT3 (map (\(k, v) -> (toDot k, v))) $ diff d1 d2 -diff'' :: Ord a => Unpacked a -> Unpacked a +diff'' :: Ord a => Unpacked a -> Unpacked a   -> ([(String, a)], [(String, a)], [(String, a)]) diff'' d1 d2 = partition [] [] [] (contents'' d1) (contents'' d2) @@ -266,7 +265,7 @@     case compare k1 k2 of       LT -> partition (o1++[(k1, v1)]) o2 b d1 d2'       GT -> partition o1 (o2++[(k2, v2)]) b d1' d2-      EQ -> case compare v1 v2 of +      EQ -> case compare v1 v2 of               LT -> partition (o1++[(k1, v1)]) o2 b d1 d2'               GT -> partition o1 (o2++[(k2, v2)]) b d1' d2               EQ -> partition o1 o2 (b++[(k1, v1)]) d1 d2@@ -290,7 +289,7 @@ \begin{verbatim} foo.bar = baz foo.baz = hello-\end{verbatim} +\end{verbatim} the string ``\{foo.\{foo.bar\}\} $\backslash$$\backslash$ world'' will evaluate to ``hello $\backslash$ world''. @@ -324,7 +323,7 @@ txt' _ ""               = error "end of string during character escape" txt' d (c:s)            = c : (txt d s) -pth, pth' :: (Dictionary d String) => +pth, pth' :: (Dictionary d String) =>   d String -> [String] -> String -> String -> String pth _ _ _ "" = error $ "end of string during substitution\n" ++                        " (probably missing '}')"@@ -440,7 +439,7 @@  \begin{code} children'' :: Unpacked a -> String -> [Unpacked a]-children'' (d, Just x) "" = +children'' (d, Just x) "" =   combine $ (SU "" (Empty, Just x)):(sort $ subTree d [null]) children'' (d, _) s  = combine . sort $ subTree d (s ++ [null]) @@ -458,7 +457,7 @@ collect :: Dict a -> [(SU a)] collect d = foldD' f g d ("", Nothing)   where-    f n c v l m r pre'@(pre, vp) | c == null = +    f n c v l m r pre'@(pre, vp) | c == null =       (l pre') ++ [SU (reverse pre) (match n, vp)] ++ (r pre')                                  | otherwise =       (l pre') ++ (m $ (c:pre, v)) ++ (r pre')@@ -507,8 +506,8 @@ \begin{code} data Dict a = Node {char  :: Char,                     value :: Maybe a,-                    left  :: Dict a, -                    match :: Dict a, +                    left  :: Dict a,+                    match :: Dict a,                     right :: Dict a}             | Empty @@ -518,7 +517,7 @@  foldD' :: (Dict b -> Char -> Maybe b -> a -> a -> a -> a) -> a -> Dict b -> a foldD' _ a Empty              = a-foldD' f a n@(Node c v l m r) = f n c v (foldD' f a l) +foldD' f a n@(Node c v l m r) = f n c v (foldD' f a l)                                   (foldD' f a m) (foldD' f a r)  instance (Show a) => Show (Dict a) where@@ -527,7 +526,7 @@ showDict :: (Show t) => Dict t -> [Char] showDict Empty = "-" showDict (Node c v l m r) = "[" ++ [c] ++ ":" ++ (show v) ++ "," ++-                              (show l) ++ "," ++ (show m) ++ "," ++ +                              (show l) ++ "," ++ (show m) ++ "," ++                               (show r) ++ "]" \end{code} 
Halipeto/Functions.lhs view
@@ -1,30 +1,30 @@-%  -% Halipeto 2.0 -  Haskell static web page generator -% Copyright 2004 Andrew Cooke (andrew@acooke.org) -% Copyright 2007 Peter Simons (simons@cryp.to) -%  -%     This program is free software; you can redistribute it and/or modify -%     it under the terms of the GNU General Public License as published by -%     the Free Software Foundation; either version 2 of the License, or -%     (at your option) any later version. -%  -%     This program is distributed in the hope that it will be useful, -%     but WITHOUT ANY WARRANTY; without even the implied warranty of -%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -%     GNU General Public License for more details. -%  -%     You should have received a copy of the GNU General Public License -%     along with this program; if not, write to the Free Software -%     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA -%  -% EXCEPT -%  -% Files in FromHaxml are from HaXml - http://www.cs.york.ac.uk/HaXml - -% see the COPYRIGHT and LICENSE in that directory.  The files included -% are a subset of the full HaXml distribution and have been modified to -% originate from the FromHaxml module (so that install on Win32 is -% easy). -%  +%+% Halipeto -- Haskell static web page generator+% Copyright 2004 Andrew Cooke (andrew@acooke.org)+% Copyright 2007-2010 Peter Simons (simons@cryp.to)+%+%     This program is free software; you can redistribute it and/or modify+%     it under the terms of the GNU General Public License as published by+%     the Free Software Foundation; either version 2 of the License, or+%     (at your option) any later version.+%+%     This program is distributed in the hope that it will be useful,+%     but WITHOUT ANY WARRANTY; without even the implied warranty of+%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+%     GNU General Public License for more details.+%+%     You should have received a copy of the GNU General Public License+%     along with this program; if not, write to the Free Software+%     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA+%+% EXCEPT+%+% Files in FromHaxml are from HaXml - http://www.cs.york.ac.uk/HaXml -+% see the COPYRIGHT and LICENSE in that directory.  The files included+% are a subset of the full HaXml distribution and have been modified to+% originate from the FromHaxml module (so that install on Win32 is+% easy).+%  \section{Functions} @@ -43,7 +43,7 @@ import Halipeto.Template import Halipeto.Dictionary import Halipeto.Utilities-import Char+import Data.Char import Text.XML.HaXml.Parse import Text.XML.HaXml.Types \end{code}@@ -58,7 +58,7 @@ %%Haddock: Separate the argument into the expected number of values \begin{code} split :: Int -> String -> [String]-split n s = +split n s =     case split' n [] "" (dropSpace s) of       Just ss -> ss       Nothing -> error $ "too few arguments (<" ++ (show n) ++ "): " ++ s@@ -144,19 +144,19 @@ \end{code} %%Haddock: Prepend text to the current element \begin{code}-text :: +text ::   (SubDictionary s, Dictionary f (CustomFn s f)) => CustomFn s f text = text' Before \end{code} %%Haddock: Append text to the current element \begin{code}-textAfter :: +textAfter ::   (SubDictionary s, Dictionary f (CustomFn s f)) => CustomFn s f textAfter = text' After \end{code} %%Haddock: Replace text to the current element \begin{code}-textReplace :: +textReplace ::   (SubDictionary s, Dictionary f (CustomFn s f)) => CustomFn s f textReplace = text' Replace \end{code}@@ -189,11 +189,11 @@     [nm, val] = parse dct 2 arg     vals = children' dct val -repeat' :: (SubDictionary s, Dictionary f (CustomFn s f)) => +repeat' :: (SubDictionary s, Dictionary f (CustomFn s f)) =>   String -> [s String] -> CustomFn s f repeat' p []     ctx _ = do putStrLn $ "end of repeat: " ++ p                             return (ctx, Skip)-repeat' p (s:ss) ctx _ = do putStrLn $ "repeat: " ++ p ++ ": " ++ +repeat' p (s:ss) ctx _ = do putStrLn $ "repeat: " ++ p ++ ": " ++                               (show (contents s))                             return (ctx', Repeat $ repeat' p ss)   where@@ -218,7 +218,7 @@ neq :: (SubDictionary s, Dictionary f (CustomFn s f)) => CustomFn s f neq ctx arg = eq' ctx False $ parse (state ctx) 2 arg -eq' :: (SubDictionary s, Dictionary f (CustomFn s f)) => +eq' :: (SubDictionary s, Dictionary f (CustomFn s f)) =>   Context s f -> Bool -> [String] -> IO (Context s f, Result s f) eq' ctx x (a:[b]) = do return $ (ctx, if x `xor` (a /= b)                                         then Continue@@ -258,7 +258,7 @@ mkElements :: Position -> String -> CustomFn s f mkElements pos txt ctx _ = do return (ctx, Xml pos (parseElements txt)) \end{code}-%%Haddock: Generate a function that inserts XML parsed from text, +%%Haddock: Generate a function that inserts XML parsed from text, %%Haddock: within an element \begin{code} mkElement :: Position -> String -> String -> CustomFn s f@@ -281,7 +281,7 @@  %%Haddock: A custom function for inserting XHTML \begin{code}-xhtml :: (SubDictionary s, Dictionary f (CustomFn s f)) => +xhtml :: (SubDictionary s, Dictionary f (CustomFn s f)) =>   Position -> CustomFn s f xhtml pos ctx txt = do return (ctx, Xml pos (parseElements txt'))   where@@ -303,7 +303,7 @@  %%Haddock: A custom function for inserting XHTML within an element \begin{code}-element :: (SubDictionary s, Dictionary f (CustomFn s f)) => +element :: (SubDictionary s, Dictionary f (CustomFn s f)) =>   Position -> CustomFn s f element pos ctx txt = do return (ctx, Xml pos [parseElement tag txt''])   where@@ -323,7 +323,7 @@  %%Haddock: Add standard functions to a dictionary \begin{code}-addDefaultsFn :: (SubDictionary s, Dictionary f (CustomFn s f)) => +addDefaultsFn :: (SubDictionary s, Dictionary f (CustomFn s f)) =>   f (CustomFn s f) -> f (CustomFn s f) addDefaultsFn fn = addAll fn fns   where
Halipeto/Pages.lhs view
@@ -1,30 +1,30 @@-%  -% Halipeto 2.0 -  Haskell static web page generator -% Copyright 2004 Andrew Cooke (andrew@acooke.org) -% Copyright 2007 Peter Simons (simons@cryp.to) -%  -%     This program is free software; you can redistribute it and/or modify -%     it under the terms of the GNU General Public License as published by -%     the Free Software Foundation; either version 2 of the License, or -%     (at your option) any later version. -%  -%     This program is distributed in the hope that it will be useful, -%     but WITHOUT ANY WARRANTY; without even the implied warranty of -%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -%     GNU General Public License for more details. -%  -%     You should have received a copy of the GNU General Public License -%     along with this program; if not, write to the Free Software -%     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA -%  -% EXCEPT -%  -% Files in FromHaxml are from HaXml - http://www.cs.york.ac.uk/HaXml - -% see the COPYRIGHT and LICENSE in that directory.  The files included -% are a subset of the full HaXml distribution and have been modified to -% originate from the FromHaxml module (so that install on Win32 is -% easy). -%  +%+% Halipeto -- Haskell static web page generator+% Copyright 2004 Andrew Cooke (andrew@acooke.org)+% Copyright 2007-2010 Peter Simons (simons@cryp.to)+%+%     This program is free software; you can redistribute it and/or modify+%     it under the terms of the GNU General Public License as published by+%     the Free Software Foundation; either version 2 of the License, or+%     (at your option) any later version.+%+%     This program is distributed in the hope that it will be useful,+%     but WITHOUT ANY WARRANTY; without even the implied warranty of+%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+%     GNU General Public License for more details.+%+%     You should have received a copy of the GNU General Public License+%     along with this program; if not, write to the Free Software+%     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA+%+% EXCEPT+%+% Files in FromHaxml are from HaXml - http://www.cs.york.ac.uk/HaXml -+% see the COPYRIGHT and LICENSE in that directory.  The files included+% are a subset of the full HaXml distribution and have been modified to+% originate from the FromHaxml module (so that install on Win32 is+% easy).+%  \section{Pages} @@ -44,9 +44,9 @@ import Halipeto.Utilities import Text.XML.HaXml.Pretty import Text.XML.HaXml.Types-import Maybe-import IO-import Monad+import Data.Maybe+import System.IO+import Control.Monad import System.Directory \end{code} @@ -134,7 +134,7 @@ \begin{code} type PageGen s = s String -> s String -> TreeSite s \end{code}-%%Haddock: The intermediate function used to construct a list +%%Haddock: The intermediate function used to construct a list %%Haddock: of pages within a hierarchy \begin{code} type PageGenS s = s String -> s String -> [TreeSite s]@@ -153,9 +153,9 @@  %%Haddock: Construct a page with its children \begin{code}-page :: SubDictionary s => +page :: SubDictionary s =>   [String] -> String -> UpdateDict s -> PageGenS s -> PageGen s-page pth tmpl upd ts dct dc0 = +page pth tmpl upd ts dct dc0 =     TreeSite (Just $ Page pth' tmpl' upd') (ts dct' dc0)   where     dct' = upd dct []@@ -193,7 +193,7 @@   where     [to', frm'] = subAll dct [to, frm] -repeat' :: SubDictionary s => +repeat' :: SubDictionary s =>   String -> String -> [s String] -> PageGen s -> PageGenS s repeat' _  frm [] _  dct  _  = error $ "nothing to repeat for " ++ frm ++                                           "\n" ++ (show $ contents dct)@@ -261,8 +261,8 @@     tmplPath = frm `slash` (template pg)  updateState :: (SubDictionary s) => s String -> Page s -> s String-updateState dct pg = addAll (dictionary pg dct []) -                       [rootPath pth, +updateState dct pg = addAll (dictionary pg dct [])+                       [rootPath pth,                         pathPath pth,                         ([hal, "template"], template pg)]   where
Halipeto/SimpleDB.lhs view
@@ -1,7 +1,7 @@ %-% Halipeto 2.0 -  Haskell static web page generator+% Halipeto -- Haskell static web page generator % Copyright 2004 Andrew Cooke (andrew@acooke.org)-% Copyright 2007 Peter Simons (simons@cryp.to)+% Copyright 2007-2010 Peter Simons (simons@cryp.to) % %     This program is free software; you can redistribute it and/or modify %     it under the terms of the GNU General Public License as published by@@ -58,11 +58,11 @@ import Halipeto.Dictionary import Halipeto.Utilities import Text.Pandoc-import IO-import Directory-import Monad-import List-import Char+import System.IO+import System.Directory+import Control.Monad+import Data.List+import Data.Char \end{code}  \subsection{File Formats}@@ -337,7 +337,7 @@ \begin{code} readMessage :: FilePath -> IO ([(String,String)], String) readMessage fp = do-  (header,body) <- fmap (span (not . List.null) . lines) (readFile fp)+  (header,body) <- fmap (span (not . Data.List.null) . lines) (readFile fp)   let headerLinesWords = map (words . concat) (groupBy (\l r -> isSpace (head r)) header)       headerLines      = map (\wrds -> (fixKeyword (head wrds), unwords (tail wrds))) headerLinesWords       fixKeyword k
Halipeto/Template.lhs view
@@ -1,7 +1,7 @@ %-% Halipeto 2.0 -  Haskell static web page generator+% Halipeto -- Haskell static web page generator % Copyright 2004 Andrew Cooke (andrew@acooke.org)-% Copyright 2007 Peter Simons (simons@cryp.to)+% Copyright 2007-2010 Peter Simons (simons@cryp.to) % %     This program is free software; you can redistribute it and/or modify %     it under the terms of the GNU General Public License as published by@@ -43,10 +43,10 @@ \end{code}  \begin{code}-import Maybe-import Char+import Data.Maybe+import Data.Char import Halipeto.Dictionary-import Text.XML.HaXml.Parse hiding ( reference )+import Text.XML.HaXml.Parse import Text.XML.HaXml.Types \end{code} 
Halipeto/Utilities.lhs view
@@ -1,30 +1,30 @@-%  -% Halipeto 2.0 -  Haskell static web page generator -% Copyright 2004 Andrew Cooke (andrew@acooke.org) -% Copyright 2007 Peter Simons (simons@cryp.to) -%  -%     This program is free software; you can redistribute it and/or modify -%     it under the terms of the GNU General Public License as published by -%     the Free Software Foundation; either version 2 of the License, or -%     (at your option) any later version. -%  -%     This program is distributed in the hope that it will be useful, -%     but WITHOUT ANY WARRANTY; without even the implied warranty of -%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the -%     GNU General Public License for more details. -%  -%     You should have received a copy of the GNU General Public License -%     along with this program; if not, write to the Free Software -%     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA -%  -% EXCEPT -%  -% Files in FromHaxml are from HaXml - http://www.cs.york.ac.uk/HaXml - -% see the COPYRIGHT and LICENSE in that directory.  The files included -% are a subset of the full HaXml distribution and have been modified to -% originate from the FromHaxml module (so that install on Win32 is -% easy). -%  +%+% Halipeto -- Haskell static web page generator+% Copyright 2004 Andrew Cooke (andrew@acooke.org)+% Copyright 2007-2010 Peter Simons (simons@cryp.to)+%+%     This program is free software; you can redistribute it and/or modify+%     it under the terms of the GNU General Public License as published by+%     the Free Software Foundation; either version 2 of the License, or+%     (at your option) any later version.+%+%     This program is distributed in the hope that it will be useful,+%     but WITHOUT ANY WARRANTY; without even the implied warranty of+%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+%     GNU General Public License for more details.+%+%     You should have received a copy of the GNU General Public License+%     along with this program; if not, write to the Free Software+%     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA+%+% EXCEPT+%+% Files in FromHaxml are from HaXml - http://www.cs.york.ac.uk/HaXml -+% see the COPYRIGHT and LICENSE in that directory.  The files included+% are a subset of the full HaXml distribution and have been modified to+% originate from the FromHaxml module (so that install on Win32 is+% easy).+% \section{Utilities}  Various general routines.@@ -36,7 +36,7 @@   thenMaybe ) where -import Char+import Data.Char \end{code}  Concatenation of paths and files.
halipeto.cabal view
@@ -1,10 +1,8 @@ Name:                   halipeto-Version:                2.1+Version:                2.2 Copyright:              (c) 2004-2010 Peter Simons License:                GPL License-File:           COPYING-Copyright:              (c) 2004-2008 Andrew Cooke <andrew@acooke.org>-                        (c) 2007-2010 Peter Simons <simons@cryp.to> Author:                 Andrew Cooke <andrew@acooke.org>, Peter Simons <simons@cryp.to> Maintainer:             Peter Simons <simons@cryp.to> Homepage:               http://gitorious.org/halipeto@@ -27,6 +25,6 @@                         Halipeto.SimpleDB,                         Halipeto.Template,                         Halipeto.Utilities-  Build-Depends:        base >= 2 && < 5, haskell98, HaXml == 1.13.*, directory, pandoc+  Build-Depends:        base >= 3 && < 5, HaXml == 1.13.*, directory, pandoc   Extensions:           MultiParamTypeClasses, FlexibleInstances, FlexibleContexts   Ghc-Options:          -Wall