packages feed

Graphalyze 0.7.0.0 → 0.8.0.0

raw patch · 3 files changed

+38/−10 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Data.Graph.Analysis.Reporting: Definition :: DocInline -> DocElement -> DocElement
+ Data.Graph.Analysis.Reporting: Definitions :: [(DocInline, DocInline)] -> DocElement
+ Data.Graph.Analysis.Reporting: addLegend :: FilePath -> FilePath -> Document -> IO Document
+ Data.Graph.Analysis.Reporting: legend :: Document -> [(DocGraph, DocInline)]
- Data.Graph.Analysis.Reporting: Doc :: FilePath -> String -> FilePath -> DocInline -> String -> String -> [DocElement] -> Document
+ Data.Graph.Analysis.Reporting: Doc :: FilePath -> String -> FilePath -> DocInline -> String -> String -> [(DocGraph, DocInline)] -> [DocElement] -> Document

Files

Data/Graph/Analysis/Reporting.hs view
@@ -19,6 +19,7 @@       DocGraph,       -- * Helper functions       -- $utilities+      addLegend,       today,       tryCreateDirectory,       createGraph,@@ -29,7 +30,7 @@ import Data.Graph.Inductive(Node) import Data.GraphViz -import Data.Maybe(isJust, fromJust)+import Data.Maybe(isJust, fromJust, catMaybes) import Data.Time(getZonedTime, zonedTimeToLocalTime, formatTime) import Control.Exception.Extensible(SomeException(..), tryJust) import System.Directory(createDirectoryIfMissing)@@ -61,6 +62,7 @@                       author         :: String,                       date           :: String,                       -- | Main-matter+                      legend         :: [(DocGraph, DocInline)],                       content        :: [DocElement]                     } @@ -85,7 +87,7 @@                 | Paragraph [DocInline]                 | Enumeration [DocElement]                 | Itemized [DocElement]-                | Definition DocInline DocElement+                | Definitions [(DocInline, DocInline)]                 | GraphImage DocGraph  -- | Inline elements of a document.@@ -108,6 +110,31 @@    Utility functions to help with document creation.  -} +-- | Create the legend section and add it to the document proper.+addLegend       :: FilePath -> FilePath -> Document -> IO Document+addLegend fp gfp d = do mLg <- legendToElement fp gfp $ legend d+                        let es = content d+                            es' = maybe es (flip (:) es) mLg+                        return $ d { legend  = []+                                   , content = es'+                                   }++legendToElement           :: FilePath -> FilePath -> [(DocGraph, DocInline)]+                             -> IO (Maybe DocElement)+legendToElement _  _   [] = return Nothing+legendToElement fp gfp ls = do mDefs <- mapM (uncurry (legToDef fp gfp)) ls+                               let defs = catMaybes mDefs+                                   df   = Definitions defs+                                   sec  = Section (Text "Legend") [df]+                               return $ Just sec++legToDef               :: FilePath -> FilePath -> DocGraph -> DocInline+                          -> IO (Maybe (DocInline, DocInline))+legToDef fp gfp dg def = fmap (fmap (flip (,) def)) img+    where+      img = graphImage fp gfp DefaultSize Png "png" DocImage dg++ -- | Return today's date as a string, e.g. \"Monday 1 January, 2000\". --   This arbitrary format is chosen as there doesn't seem to be a way --   of determining the correct format as per the user's locale settings.@@ -184,7 +211,7 @@ setSize (GivenSize p) g = g { graphStatements = stmts' }     where       stmts = graphStatements g-      stmts' = stmts { attrStmts = a : (attrStmts stmts) }+      stmts' = stmts { attrStmts = a : attrStmts stmts }       a = GraphAttrs [s]       s = Size p 
Data/Graph/Analysis/Reporting/Pandoc.hs view
@@ -32,6 +32,7 @@  import Data.List(intersperse) import Data.Maybe(isNothing, fromJust)+import Control.Arrow((***)) import Control.Exception.Extensible(SomeException, try) import System.Directory(removeDirectoryRecursive) import System.FilePath((</>), (<.>))@@ -140,7 +141,8 @@                       tryCreateDirectory $ dir </> gdir                       if not created                          then failDoc-                         else do elems <- multiElems pp (content d)+                         else do d' <- addLegend dir gdir d+                                 elems <- multiElems pp $ content d'                                  case elems of                                    Just es -> do let es' = htmlAuthDt : es                                                      pnd = Pandoc meta es'@@ -233,10 +235,9 @@ elements p (Itemized elems)    = do elems' <- multiElems' p elems                                     return (fmap (return . BulletList) elems') -elements p (Definition x def)  = do def' <- elements p def-                                    let x' = inlines x-                                        xdef = fmap (return . (,) x') def'-                                    return (fmap (return . DefinitionList) xdef)+elements _ (Definitions defs)  = return . Just . return . DefinitionList+                                 $ map (inlines *** (return . Plain . inlines))+                                       defs  elements p (GraphImage dg)     = do el <- createGraph (filedir p)                                                       (graphdir p)
Graphalyze.cabal view
@@ -1,9 +1,9 @@ Name:                Graphalyze-Version:             0.7.0.0+Version:             0.8.0.0 Synopsis:            Graph-Theoretic Analysis library. Description:         A library to use graph theory to analyse the relationships                         inherent in discrete data.-Category:            Algorithms+Category:            Graphs, Algorithms License:             OtherLicense License-File:        LICENSE Copyright:           (c) Ivan Lazar Miljenovic