Coder Social home page Coder Social logo

brick's People

Contributors

benmorel avatar simpod avatar

Stargazers

 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

brick's Issues

Ideas to improve Html-Tag-objects

Hi there!

I'm currently in a situation where I'd like to generate PHP objects for HTML Tags. I thought „there must be thousands of libraries doing exactly that“ – Nope. All of the projects I could find are unmaintained, broken or poorly documented.

So I was glad to find the files under brick/brick/src/Html which seem like a great start.

Before I start working with that, I wanted to ask if you accept pull requests and if there are any contributing guidelines. If you see this incubator more as a private playground and don't want any outsider interference, I can understand and I'll just write my own Tag library.

These are the ideas I'd like to work on:

  1. Text node (text between opening and closing tag) support: Having a TextNode-class is great, because that way both Tags and TextNodes can implement the same interface (or inherit from the same class, I don't know yet) and methods (e.g. generators for other Tags) can accept "Tags or TextNodes"
  2. A HTML5-Tag-factory/generator that takes a tag name and either returns a SelfClosingTag (for area, base, br, col, command, embed, hr, img, input, keygen, link, meta, param, source, track, wbr) or a ContainerTag (for all other tags); I think I'd even call it "Tag" or something short like that (and maybe rename the current Tag-class?) It would avoid the bloat of having one class for each available Tag while it wouldn't be necessary to change much code in case the HTML spec changes and certain tags become self-closing/container tags
  3. An array of Tags (or TextNodes) as content of a ContainerTag (instead of a string) would be great. That way, tags could be changed/removed before rendering etc. The render()-method could just concatenate the array before returning the string
  4. I don't know how useful it is in a real world use-case, but I'd like to throw Exceptions when passing invalid parameters (non-strings for attributes etc.)

Any thoughts? :)

Yours,
Benedict

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.