hoodle-builder 0.1.0 → 0.1.1
raw patch · 3 files changed
+23/−6 lines, 3 filesdep ~hoodle-typesdep ~lensPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: hoodle-types, lens
API changes (from Hackage documentation)
+ Text.Hoodle.Builder: buildSVG :: SVG -> Builder
Files
- LICENSE +1/−1
- hoodle-builder.cabal +3/−3
- src/Text/Hoodle/Builder.hs +19/−2
LICENSE view
@@ -1,7 +1,7 @@ The following license covers this documentation, and the source code, except where otherwise indicated. -Copyright 2011, Ian-Woo Kim. All rights reserved.+Copyright 2011-2013, Ian-Woo Kim. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
hoodle-builder.cabal view
@@ -1,5 +1,5 @@ Name: hoodle-builder-Version: 0.1.0+Version: 0.1.1 Synopsis: text builder for hoodle file format Description: This library builds text xoj format file from hoodle data structure License: BSD3@@ -20,8 +20,8 @@ ghc-prof-options: -caf-all -auto-all Build-Depends: base == 4.*,- hoodle-types >= 0.1.0,- lens >= 2.4,+ hoodle-types >= 0.1.1,+ lens >= 2.5, blaze-builder == 0.3.*, strict == 0.3.*, bytestring >= 0.9
src/Text/Hoodle/Builder.hs view
@@ -49,7 +49,7 @@ -- | buildHoodle :: Hoodle -> Builder -buildHoodle hdl = fromByteString "<?xml version=\"1.0\" standalone=\"no\"?>\n<hoodle version=\"0.1\">\n"+buildHoodle hdl = fromByteString "<?xml version=\"1.0\" standalone=\"no\"?>\n<hoodle version=\"0.1.1\">\n" <> (buildTitle . view title) hdl <> (mconcat . map buildPage . view pages) hdl <> fromByteString "</hoodle>\n"@@ -108,6 +108,7 @@ buildItem :: Item -> Builder buildItem (ItemStroke strk) = buildStroke strk buildItem (ItemImage img) = buildImage img+buildItem (ItemSVG svg) = buildSVG svg -- | buildStroke :: Stroke -> Builder@@ -146,7 +147,23 @@ <> fromByteString (toFixed 2 h) <> fromByteString "\" />\n" -+buildSVG :: SVG -> Builder +buildSVG (SVG mtxt mcmd rdr (x,y) (Dim w h)) =+ fromByteString "<svgobject x=\"" + <> fromByteString (toFixed 2 x)+ <> fromByteString "\" y=\""+ <> fromByteString (toFixed 2 y)+ <> fromByteString "\" width=\""+ <> fromByteString (toFixed 2 w)+ <> fromByteString "\" height=\""+ <> fromByteString (toFixed 2 h)+ <> fromByteString "\" >\n"+ <> maybe mempty (\txt->fromByteString "<text><![CDATA[" <> fromByteString txt <> fromByteString "]]></text>") mtxt + <> maybe mempty (\cmd->fromByteString "<command><![CDATA[" <> fromByteString cmd <> fromByteString "]]></command>") mcmd + <> fromByteString "<render><![CDATA[" + <> fromByteString rdr + <> fromByteString "]]></render>"+ <> fromByteString "</svgobject>" -- | build2D :: Pair Double Double -> Builder