packages feed

vega-view 0.3.0.3 → 0.3.0.4

raw patch · 3 files changed

+28/−21 lines, 3 files

Files

ChangeLog.md view
@@ -1,5 +1,11 @@ # Changelog for vega-view +## 0.3.0.4++Fixed directory browsing: previously things didn't work out so well if+there were no Vega or Vega-Lite visualizations in the working directory,+but now you can properly recurse into sub-directories.+ ## 0.3.0.3  Oops: chaning from a bytestring to a text during development caused
app/Main.hs view
@@ -396,7 +396,7 @@   -- getFileContents indir = do -  infiles <- sort <$> listDirectory indir+  infiles <- map (indir </>) . sort <$> listDirectory indir   dirFlags <- mapM doesDirectoryExist infiles    let files = zip dirFlags infiles@@ -413,7 +413,7 @@         case mspec of           Just h -> pure (Just (f, h))           _ -> pure Nothing-  +   mspecs <- mapM go otherNames    let specs = catMaybes mspecs@@ -421,22 +421,23 @@   pure (dirNames, specs)  -pageLink :: FilePath -> FilePath -> H.Html-pageLink indir infile =-  let toHref = H.toValue ("/display" </> indir </> infile)+pageLink :: FilePath -> H.Html+pageLink infile =+  let toHref = H.toValue ("/display" </> infile)   in (H.a ! A.href toHref) (H.toHtml infile) -makeLi :: FilePath -> FilePath -> H.Html-makeLi indir infile = H.li (pageLink indir infile)+makeLi :: FilePath -> H.Html+makeLi infile = H.li (pageLink infile) -makeParentLi :: FilePath -> H.Html-makeParentLi indir =+makeParentLink :: FilePath -> H.Html+makeParentLink indir =   let toHref = H.toValue ("/display" </> indir </> "..")-  in H.li ((H.a ! A.href toHref) "parent directory")+  in (H.a ! A.href toHref) "parent directory" -embedLink :: FilePath -> FilePath -> H.Html-embedLink indir infile =-  let toHref = H.toValue ("/embed" </> indir </> infile)++embedLink :: FilePath -> H.Html+embedLink infile =+  let toHref = H.toValue ("/embed" </> infile)       hdlr = mconcat [ "embed('", toHref, "');" ]    in (H.a ! A.href "#" ! A.onclick hdlr) (H.toHtml infile)@@ -464,8 +465,8 @@               then H.p "There is nothing to see in the base directory!"               else do                 H.p (H.toHtml ("Directory: " ++ indir))+                H.p (makeParentLink indir)                 H.p "There is nothing to see here!"-                H.ul (makeParentLi indir)    in html (renderHtml page) @@ -548,13 +549,13 @@             homeLink            (H.div ! A.id "mainbar") $ do-            unless atTop (H.p (H.toHtml ("Directory: " ++ indir)))+            unless atTop $ do+              H.p (H.toHtml ("Directory: " ++ indir))+              H.p (makeParentLink indir)              unless (null subdirs) $ do               H.h2 "Sub-directories"-              H.ul $ do-                unless atTop (makeParentLi indir)-                forM_ subdirs (makeLi indir)+              H.ul (forM_ subdirs makeLi)              -- let's see how this basic setup works             --@@ -573,8 +574,8 @@                   H.tbody $                     forM_ files $ \(f, _) ->                       H.tr $ do-                        H.td (pageLink indir f)-                        H.td (embedLink indir f)+                        H.td (pageLink f)+                        H.td (embedLink f)    in html (renderHtml page) 
vega-view.cabal view
@@ -1,5 +1,5 @@ name:           vega-view-version:        0.3.0.3+version:        0.3.0.4 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