Giter Site home page Giter Site logo

lucid-svg's Introduction

lucid-svg Hackage

Simple DSL for writing SVG, based on lucid

Example

{-# LANGUAGE OverloadedStrings #-}

import Lucid.Svg
 
svg :: Svg () -> Svg ()
svg content = do
  doctype_
  with (svg11_ content) [width_ "300" , height_ "200"]

contents :: Svg ()
contents = do
  rect_   [width_ "100%", height_ "100%", fill_ "red"]
  circle_ [cx_ "150", cy_ "100", r_ "80", fill_ "green"]
  text_   [x_ "150", y_ "125", font_size_ "60", text_anchor_ "middle", fill_ "white"] "SVG"


main :: IO ()
main = do
  print $ svg contents

SVG

lucid-svg's People

Contributors

bergey avatar bgamari avatar eriknstevenson avatar jeffreyrosenbluth avatar maxigit avatar nvmd avatar tristancacqueray avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

lucid-svg's Issues

title and desc elements take [Attribute] but no Text

In all example SVGs I have seen, I have seen <title> and <desc> used like so (or very similarly):

<svg…
    <symbol…
        <title>What this thing is called</title>
        <desc>A short description of what it is</desc>
        …
    </symbol>
</svg>

(cf. the MDN SVG reference)

However, title_ and desc_ only take a [Attribute] and no Text argument. So, I can clearly add attributes to the elements, but I cannot add the text inside. Was this intentional? If so, what was the motivation? If not, would a PR be accepted to allow for this?

Compatibility with base 4.9

Now that ghc 8.0 has dropped with the new base package, I find myself in a situation where lucid-svg claims to not be compatible, and so I can no longer build my package. I am aware that I could just downgrade ghc/cabal, but since lucid is not affected by any compatibility issues (it claims to be compatible with base<5), I was wondering if this might be a simple fix by just changing the .cabal file to relax the constraint.

Elements that should/shouldn't have children

I found a few more elements that have incorrect child/childlessness is this library. Rather than create an issue every time I find one of these, I'll just keep a running list here and put up a PR in a week or two. I've got a list of a few more on my other laptop at home, but the one I stumbled across most recently is line_.

Elements to fix:

  • line_
  • filter_
  • style_
  • feGaussianBlur_ (actually, maybe not)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.