packages feed

hp2pretty 0.2 → 0.3

raw patch · 4 files changed

+22/−4 lines, 4 files

Files

NEWS view
@@ -1,3 +1,11 @@+v0.3	2010-11-02	special characters++Fixes a bug where broken SVG was generated when label names+contained XML-special characters.++Source code statistics: 484 lines, 2888 words, 17261 chars.++ v0.2	2010-07-30	leaner and meaner  Memory usage and speed have both been improved, in part by
+ THANKS view
@@ -0,0 +1,1 @@+Ian Lynagh (label text XML escaping bugfix patch)
hp2pretty.cabal view
@@ -1,5 +1,5 @@ Name:                hp2pretty-Version:             0.2+Version:             0.3 Synopsis:            generate pretty graphs from heap profiles Description:         hp2pretty is a rewrite of hp2ps, implemented in Haskell, with                      the aims of being maintainable, with more flexible output, and@@ -17,7 +17,7 @@ Copyright:           (C) 2010  Claude Heiland-Allen Category:            Development Build-type:          Simple-Extra-source-files:  NEWS README+Extra-source-files:  NEWS README THANKS Cabal-version:       >=1.6  Executable hp2pretty@@ -42,4 +42,4 @@ Source-repository this   type:                git   location:            git://gitorious.org/hp2pretty/hp2pretty.git-  tag:                 v0.2+  tag:                 v0.3
src/SVG.hs view
@@ -2,6 +2,7 @@ module SVG (svg) where  import Data.ByteString.Char8 (ByteString, pack)+import qualified Data.ByteString.Char8 as BS import Numeric (showHex, showFFloat)  import Graphics (Graphics(Graphics), Point, Size, Angle, FontSize, Anchor(..), StrokeWidth, Opacity, RGB(..))@@ -26,7 +27,15 @@       showAnchor Start = "start"       showAnchor Middle = "middle"       showAnchor End = "end"-  in  ["<text "] ++ coords ++ [" font-size='", showF s, "' text-anchor='", showAnchor a, "'>"] ++ inner ++ ["</text>\n"]+  in  ["<text "] ++ coords ++ [" font-size='", showF s, "' text-anchor='", showAnchor a, "'>"] ++ map escape inner ++ ["</text>\n"]++escape :: ByteString -> ByteString+escape = BS.concatMap escapeChar+  where+    escapeChar '<' = "&lt;"+    escapeChar '>' = "&gt;"+    escapeChar '&' = "&amp;"+    escapeChar c   = BS.singleton c  rect :: Point -> Size -> [ByteString] rect (x,y) (w,h) = ["<rect x='", showF x, "' y='", showF y, "' width='" , showF w , "' height='" , showF h , "' />\n"]