Giter Site home page Giter Site logo

giraffe-fsharp / giraffe.viewengine Goto Github PK

View Code? Open in Web Editor NEW
44.0 44.0 13.0 141 KB

An F# view engine for Giraffe and other ASP.NET Core web applications.

License: Apache License 2.0

F# 100.00%
framework fsharp giraffe html mvvm svg ui view-engine web xml

giraffe.viewengine's People

Contributors

bradder555 avatar dharmatech avatar dustinmoris avatar forki avatar kmutagene avatar kostya9 avatar tarmil avatar viktorvan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

giraffe.viewengine's Issues

Is there a HTML to function-style view tool ?

I am converting a HTML hard coded website to Giraffe (for layout, data templating...). It is quite boring to transform HTML to function-style view. I thought a tool could help, an XSLT stylesheet would do the job, any ideas about that ? existing tool in other equiv framework ?

Feliz style addition to html templating

just a proposal/suggestion: Feliz Synthax is way more straight forward for HTML templating,
https://github.com/Zaid-Ajaj/Feliz

instead of writing (or as an alternative, e.g. ViewEngine.FelizStyle?)

div [ ] [
    div [ ] [ text "hello" ]
]

we could write

Html.div [
    prop.children [
        Html.div "hello"
    ]
]

but maybe is very complex to implement

The function strf is incorrect

The function strf is implemented incorrectly and can't actually take format arguments. It needs to use kprintf to work.

Allow Html indentation

RenderView.AsString.htmlDocument does not permit to render formatted html documents.

It would be good to be able to read generated result.

Fragments or null elements

Sometimes I want a partial that returns more than one HTML element, so it returns a list. But, if I want to use that as a child node along with other elements, it's not possible because a list can only hold values of the same type.

Is it possible to make a fragment (as it's called in react), that will not render any unnecessary markup, that one could wrap a list of elements in?

Sure, I could do this by concatenating lists, but that would make the code a bit more unreadable.

let textField name =
     label [_for name] [ste "My label"]
     input [_type "text" _name name ]

let myForm = form [_method "post" _action "/endpoint"][
                  textField "name"
                 button [_type "submit" ][str "send"]
           ]

This will obviously not work, and I would rather not have to wrap textField in an unnecessary div, or concatenate.

Is it possible to make an empty tag, that will not actually produce any markup to get around this?

let textField name =
  fragment [] [
        label [_for name] [ste "My label"]
        input [_type "text" _name name ]
  ]
let myForm = form [_method "post" _action "/endpoint"][
                  textField "name"
                 button [_type "submit" ][str "send"]
           ]

Possibility to adopt strong naming?

Hi there,

I know its legacy stuff and maybe much to ask, but is there the possibility of adopting a strong name for this package?

I maintain a graphing library, Plotly.NET, which is a strong named DLL. I forgot about that legacy stuff when updating my html generation backend to use this package, and now people on netfx face these problems: plotly/Plotly.NET#371

Another solution would be copying the two source files of Giraffe.ViewEngine into our project. That would have the advantage of not asking you to do anything, but the disadvantage of not attributing any package downloads. Would that be something you'd allow (IANAL but i think your license allows this, i think it would still be better to ask as well)?

thanks

@Krzysztof-Cieslak @dustinmoris @bradder555 Just to say this is great and thanks for getting this to 1.0, it's an important reusable component.

(If you ever want to rename it into FSharp.Web.ViewEngine or something I'd support that as I consider it pretty much canonical in the F# universe, at least server-side, though I'm not particularly asking for that)

Missing HtmlElement iframe

<iframe /> appears to be missing from the available HTML elements. Is it in there and I am missing it? Is there a way to add custom elements?

Is str supposed to escape HTML entitites?

When I do str "&raquo;" (or if I generally am passing a string with HTML entities), the rendered HTML (as viewed in the browser) does not contain », but &raquo;. Is that how it's supposed to work? Do I have to expand HTML entities everywhere myself, or at least define an alias of str that does that? Are there security reasons for this, perhaps?

Gitter + Backlog

If we have a backlog / kanban of some sort myself and others can assist with bug fixes, features, etc...

Would be nice to have a gitter/slack/discord... for contributors to discuss features & decisions.

would netstandard2.0 support be possible for this library?

Hi there, awesome library! I am using it in various projects.

Would it be possible to support netstandard2.0 as well? I would love to use the html DSL for generation of the file scaffold for rendering plots in Plotly.NET, it would make that part of the library way easier to customize and adapt. We plan to move to .net5 eventually, but so far we are stuck on netstandard2.0 and it would be awesome if you would consider supporting it if there are no major blockers. Cheers!

Add sourcelink support

When you have a moment, a version with the Microsoft.SourceLink.Github PackageReference would be great :) Giraffe proper is sourcelinked, I think it just got lost in the shuffle here.

Code Review

Thanks @dustinmoris for all the work you've put in since my contribution in May.

It's looking very slick and polished now.

It'll be nice to see a cleaner commit history (most of which can be achieved with git rebase squash etc). This will help if we're ever going through the history to work out why a decision was made.

I'm happy to volunteer as a reviewer; I think you'll get more engagement from me this way too.

Since the whole github pipeline has been configured, do you think it's worth incorporating LGTM?
https://github.com/lgtmco/lgtm

Regards
Brad

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.