GithubHelp home page GithubHelp logo

madelyneriksen / dashml Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 50 KB

Composable Python functions to generate HTML

Home Page: https://dashml.readthedocs.io/en/latest/

License: MIT License

Makefile 3.38% Python 96.62%
components functional-programming python template-engine templates

dashml's People

Contributors

madelyneriksen avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

dashml's Issues

Cleanup Code

Overview

Most things are stuffed into dashml.core and exposed through the __all__ special object. This is fine, but I can split things out from core into files so it's slightly neater.

Rendering for non-string types.

Overview

DashML should be able to render non-string types.

How

  • Most classes should probably be cast to a string, as a form of "least surprise".
  • Boolean attributes should obey HTML5 boolean rules, which means true should keep the attribute and false should remove it.

This will be implemented in core.swap_attributes.

Create documentation

Overview

It would be great to have some docs for DashML. The API is really, really simple, but I could get into a lot more detail than I can in just the README.

Stub out types for lxml

Overview

The lxml library doesn't have type definitions, so creating a stub for those would be really helpful. DashML would be completely typed with that addition.

Integrate DashML with Python Web Frameworks

Overview

Right now, DashML provides a render method that outputs a unicode string. This is really portable, but I can make it easier to use DashML in projects by providing "shortcuts" for different frameworks.

We would add a shortcuts module to DashML that contains functions to transform DashML functions into framework-specific HTTP response objects (or whatever the framework uses). Like a render for any given framework.

Potential Features

  • Django render helper.
    • Django could even have Django-specific generic views.
  • Sanic response.html functions.
  • Flask Markup objects for returning HTML.
  • Starlette HTMLResponse helper.

Add an `unsafe_from_string` method

Overview

There's no "escape hatch" for DashML- all code goes through the sanitizer so you can't inject html. A solution for this would be an unsafe_from_string method, that converts a string representation of an element into a DashML component.

This is basically going to be a wrapper of lxml.html.fromstring, but in DashML with a scary name to discourage use.

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.