vega-view 0.3.1.6 → 0.3.1.7
raw patch · 3 files changed
+30/−8 lines, 3 filesdep ~aesondep ~scotty
Dependency ranges changed: aeson, scotty
Files
- ChangeLog.md +4/−0
- app/Main.hs +22/−4
- vega-view.cabal +4/−4
ChangeLog.md view
@@ -1,5 +1,9 @@ # Changelog for vega-view +## 0.3.1.7++Bump aeson and scotty dependencies and try Yet-Another-Nix setup.+ ## 0.3.1.6 Update to Vega Lite version 4 and drop the version requirement on
app/Main.hs view
@@ -34,6 +34,7 @@ import qualified Data.HashMap.Strict as HM import qualified Data.Text as T import qualified Data.Text.Lazy as LT+import qualified Data.Text.Lazy.IO as LT import qualified Text.Blaze as B import qualified Text.Blaze.Html5 as H import qualified Text.Blaze.Html5.Attributes as A@@ -44,7 +45,7 @@ import Data.Aeson (Value(String, Object), Object , (.=) , eitherDecode', encode, object)-import Data.List (sort)+import Data.List (isSuffixOf, sort) import Data.Maybe (catMaybes) import Data.Version (showVersion) import Network.HTTP.Types (status404)@@ -830,8 +831,8 @@ ] -showPage :: FilePath -> ActionM ()-showPage infile = do+showSpec :: FilePath -> ActionM ()+showSpec infile = do espec <- liftIO (readSpec infile) case espec of Left emsg -> do@@ -864,12 +865,20 @@ in html (renderHtml page) +-- This was originally only going to serve Vega-Lite specifications,+-- but we need it to also support data files (for testing purposes,+-- when we haven't made the data file available on GitHub). This+-- is done in a rather hacky way: assuming the specifications+-- always end in .vg.json.+-- displayPage :: FilePath -> ActionM () displayPage infile = do isDir <- liftIO (doesDirectoryExist infile) if isDir then dirPage infile- else showPage infile+ else if ".vg.json" `isSuffixOf` infile+ then showSpec infile+ else copyContents infile -- Return data needed to display this file.@@ -883,6 +892,15 @@ , "infile" .= filename ]) _ -> errorStatus+++-- Not streaming, and no error handling ...+--+copyContents :: FilePath -> ActionM ()+copyContents infile = do+ cts <- liftIO $ LT.readFile infile+ text cts+ -- embed https://commons.wikimedia.org/wiki/File:Curved_Arrow.svg
vega-view.cabal view
@@ -1,5 +1,5 @@ name: vega-view-version: 0.3.1.6+version: 0.3.1.7 synopsis: Easily view Vega or Vega-Lite visualizations. description: A web server that is used to view all the Vega and Vega-Lite specifications in a directory, or sub-directory. It is similar@@ -12,7 +12,7 @@ bug-reports: https://github.com/DougBurke/vega-view/issues author: Douglas Burke maintainer: dburke.gw@gmail.com-copyright: 2019, 2020 Douglas Burke+copyright: 2019, 2020, 2021 Douglas Burke license: BSD3 license-file: LICENSE build-type: Simple@@ -35,7 +35,7 @@ app ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N build-depends:- aeson >= 1.1 && < 1.5+ aeson >= 1.1 && < 1.6 , base >= 4.9 && <5 , blaze-html >= 0.7 && < 0.10 , blaze-markup >= 0.6 && < 0.9@@ -43,7 +43,7 @@ , directory >= 1.2.5.0 && < 1.4 , filepath >= 1.4 && < 1.5 , http-types >= 0.9 && < 0.13- , scotty >= 0.11 && < 0.12+ , scotty >= 0.11 && < 0.13 , text >= 1.2 && < 1.3 , unordered-containers >= 0.2 && < 0.3