Comments (7)
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.
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.
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.
Hey, I wanted to let you know I've made the following changes:
- Named it
Giraffe.HtmlEngine
- Renamed
Text
toEncodedText
- Renamed
WhiteSpace
toRawText
- Also renamed
textContent
toencodedText
and added another function calledrawText
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.
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.
@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.
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)
- Migrate to System.Text.Json HOT 1
- Participate on hacktoberfest 2023? HOT 1
- Never decalre reader with `use` on `ctx.Request.Body` HOT 4
- Upgrade to .NET 8 HOT 6
- LinkGenerator doesn't work with routef HOT 1
- Giraffe 6.2 is breaks against Microsoft.IO.RecyclableMemoryStream 3.0.0 HOT 11
- Returning streams, either with WriteStreamAsync or WriteFileStreamAsync or their handler equivalents, is extremely slow HOT 4
- Question: How to approach outside in testing of a micro service? HOT 2
- Guid pattern in endpoint router matches invalid values, throws System.FormatException HOT 6
- Follow-up from "Minor code optimisation #567"
- Update SECURITY.md
- Start using fantomas to validate code submissions with CI HOT 6
- [README] Suggestion for "Getting Started"'s "Doing it manually" HOT 2
- [question] Would it be possible to make `Giraffe.EndpointRouting` case-sensitive? HOT 3
- Remove NuGet API key from the repository HOT 3
- 6.4.0 release references PR for updating to .NET 7 instead of .NET 8 HOT 1
- EndpointRouting - Create endpoint for multiple http verbs
- Request/discussion: WriteStreamAsync buffer size autotuning and/or increase default buffer size HOT 1
- Update `.vscode` debug configuration to point to existent projects
- Returning 406 when mustAccept fails HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from giraffe.