svg-icons 0.4.0.3 → 1.0.0.0
raw patch · 4 files changed
+49/−4 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- src/Core/Utils.hs +2/−0
- src/Images.hs +1/−1
- src/Main.hs +45/−2
- svg-icons.cabal +1/−1
src/Core/Utils.hs view
@@ -103,6 +103,8 @@ and returns a path with a very thin stroke which connects all consecutive corners of the viewbox and also connects opposite middle points of the sides of the viewbox. + + -} frame :: Float -> Float -> Float -> Float -> S.Svg frame x y w h =
src/Images.hs view
@@ -4,7 +4,7 @@ This module is only for re-exports and documentation. Unlike icons, all svg from Images modules are already -already wrapped with @\<svg\>@ tag, with the appropriate viewbox. +wrapped with @\<svg\>@ tag, with the appropriate viewbox. This means that they are not composible, but you don't have to prepare the images yourself.
src/Main.hs view
@@ -1,3 +1,10 @@+ + +{- | +The main purpose of this module is +generating the images found within the haddock documentation +of this package. +-} module Main where import System.Directory @@ -25,12 +32,25 @@ - +{- | +prop> main = renderAll "./svg" +-} main :: IO () main = renderAll "./svg" +{- | +Renders all icons and images from this package into +the target directory. This is used to generate the +example SVGs found in this documentation. +The directory is created if it does not exist, and +some subdirectories are created to distinguish between +icons or images. + +__WARNING:__ this function __deletes the target directory__ +and then creates it again. Be careful. +-} renderAll :: FilePath -> IO () renderAll svgFolder = do createDirectoryIfMissing False svgFolder @@ -43,7 +63,10 @@ putStrLn "Svg files compiled correctly" - +{- | +Renders the examples from `Icons` module +into the targeted directory. +-} renderExamples :: FilePath -> IO () renderExamples path = do createDirectory path @@ -51,6 +74,17 @@ +{- | +Renders all icons into the +targeted directory. + +All icons are rendered in a @viewbox "-1 -1 2 2" and +with 3 style variants: + + * Black fill and no stroke + * Black stroke and no fill + * Silver fill and black stroke +-} renderIcons :: FilePath -> IO () renderIcons path = do @@ -108,6 +142,9 @@ +{- | +Renders all images into the targeted directory. +-} renderImages :: FilePath -> IO () renderImages path = do createDirectory path @@ -121,6 +158,12 @@ +{- | +Takes an icon as second argument and renders it with all +3 styles (fill, full and stroke) into the targeted directory. + +The `frame` function is used for testing purposes. +-} renderTest :: FilePath -> Svg -> IO () renderTest path svgTest = do createDirectory path
svg-icons.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: svg-icons -version: 0.4.0.3 +version: 1.0.0.0 homepage: https://github.com/RamiroPastor/SvgIcons license: BSD-3-Clause license-file: LICENSE