GithubHelp home page GithubHelp logo

Comments (7)

nojaf avatar nojaf commented on July 23, 2024 1

Ok, I'll try to create a pul request and check with Suave for copyright.
I want to use this in a hobby project.
Another reason I'm found of this way of working is that it is similar to how Elm creates html.

view : Model -> Html Msg
view model =
  div []
    [ input [ type_ "text", placeholder "Name", onInput Name ] []
    , input [ type_ "password", placeholder "Password", onInput Password ] []
    , input [ type_ "password", placeholder "Re-enter Password", onInput PasswordAgain ] []
    , viewValidation model
    ]

from giraffe.

dustinmoris avatar dustinmoris commented on July 23, 2024

Hi, that is an interesting alternative indeed. I wonder how useful this is in its current form beyond a hello-world example. Looks like Suave was working on it but deemed it experimental. Is this something you need personally for your projects?

When I look at the currently supported html tags and attributes then there's still lots of gaps. If we want to include this into Giraffe, then there needs to be an easy way for people to extend this without much difficulty, because I doubt we will ever be able to satisfy everyone's needs. My understanding is that I can easily create more tags outside the library and it will work, but am I correct that a tag can only have one attribute with this engine at the moment?

EDIT:
Oh, just seen that it already accepts an array of attributes: type Element = string * Attribute[]

Hmm.. yeah that looks really interesting...

from giraffe.

dustinmoris avatar dustinmoris commented on July 23, 2024

It's kind of cool.. and yeah it looks that it would be easily extendable. If you want to prepare a pull request for it then go for it!

Could you please make sure that we don't violate any copyright on Suave though and probably should let them know that we would like to borrow their code or at least heavily attribute it to the original author and give them credit!

from giraffe.

dustinmoris avatar dustinmoris commented on July 23, 2024

Hey, I wanted to let you know I've made the following changes:

  • Named it Giraffe.HtmlEngine
  • Renamed Text to EncodedText
  • Renamed WhiteSpace to RawText
  • Also renamed textContent to encodedText and added another function called rawText

I think encodedText and rawText are more representative of what they are doing and also WhiteSpace was really more something like RawText as it wasn't limited to just white space and I can see how someone would need both (generating encoded content but also maybe embedding an already generated HTML string with rawText).

Apart from that I made a few minor semantic changes and named the HttpHandler renderHtml.

What do you think?

from giraffe.

nojaf avatar nojaf commented on July 23, 2024

Thanks for letting me know. It all makes sense to me. WhiteSpace was indeed a bit misleading.
Looks like it's ready to merged.

from giraffe.

dustinmoris avatar dustinmoris commented on July 23, 2024

@nojaf Hey I just wanted to let you know that I've made a few improvements to the functional engine in the last two releases. Apart from the name change to reflect better that it can be used beyond just HTML I have also made a few changes so it can be used for rendering XML and other content like SVG for example. I started using this engine in another side project now and as I was using it more I was hitting issues that led me to making those changes. Let me know if you encounter any issues with the latest version or if you have any other questions!

from giraffe.

nojaf avatar nojaf commented on July 23, 2024

Hi Dustin, thanks for the heads up. It's on my bucket list to update my projects to the latest Giraffe. I'll let you know if there are any issues,

from giraffe.

Related Issues (20)

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.