prettyprinter-graphviz 0.1.1.0 → 0.1.1.1
raw patch · 3 files changed
+22/−8 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +9/−1
- prettyprinter-graphviz.cabal +1/−1
- src/Data/Text/Prettyprint/Doc/Render/GraphViz.hs +12/−6
CHANGELOG.md view
@@ -1,5 +1,13 @@ # Revision history for prettyprinter-graphviz -## 0.1.0.0 -- YYYY-mm-dd+## 0.1.0.0 -- 2020-01-16 * First version. Released on an unsuspecting world.++## 0.1.1.0 -- 2020-02-10++* Include safe versions of functions.++## 0.1.1.1 -- 2020-02-22++* Fix bug causing graphviz to fall over if an annotation were applied to an empty string. This could easily occur in the case of a non-indented newline.
prettyprinter-graphviz.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: prettyprinter-graphviz-version: 0.1.1.0+version: 0.1.1.1 synopsis: a prettyprinter backend for graphviz description: Contains utility functions for rendering pretty GraphViz labels. homepage: https://github.com/georgefst/prettyprinter-graphviz
src/Data/Text/Prettyprint/Doc/Render/GraphViz.hs view
@@ -1,9 +1,13 @@+-- | Pretty-print GraphViz labels module Data.Text.Prettyprint.Doc.Render.GraphViz ( -- * Rendering functions render, render', -- * Error handling+ -- The functions in this module can throw errors, given a malformed document stream.+ -- The average user is very unlikely to run into this,+ -- but error handling functionality is provided for completeness. GraphVizRenderError(..), renderSafe, renderSafe',@@ -36,12 +40,11 @@ render' :: SimpleDocStream H.Attribute -> H.Text render' = throwLeft . renderSafe' ---- | The functions in this module can throw errors, given a malformed document stream.--- The average user is very unlikely to run into this,--- but error handling functionality is provided for completeness.+-- | Errors which indicate a malformed 'SimpleDocStream'. data GraphVizRenderError+ -- | The stream ended with 'SFail'. = GVDocStreamFail+ -- | The stream contained more 'SAnnPop's than 'SAnnPush's. | GVEmptyStack deriving (Eq, Ord, Read, Show) instance Exception GraphVizRenderError where@@ -54,7 +57,7 @@ renderSafe :: Doc H.Attribute -> Either GraphVizRenderError Label renderSafe = fmap (HtmlLabel . H.Text) . renderSafe' . layoutPretty defaultLayoutOptions --- | A total version of 'render\''.+-- | A total version of 'render''. -- This can be seen as a generalisation of any of the other functions exported by this module. renderSafe' :: SimpleDocStream H.Attribute -> Either GraphVizRenderError H.Text renderSafe' =@@ -89,4 +92,7 @@ -- | Helper for rendering an individual 'H.TextItem'. renderText :: H.Attributes -> T.Text -> H.TextItem-renderText cs = H.Font cs . pure . H.Str . TL.fromStrict+renderText cs t+ | T.null t = ti -- graphviz doesn't like an empty string between tags+ | otherwise = H.Font cs [ti]+ where ti = H.Str $ TL.fromStrict t