HTML YAML Builder

Is anyone interested in a YAML Builder for HTML?

Some trivial YAML that could be converted to HTML:

html:

  • head:
    • title: My title
  • body:
    • p:
      • {!id: someId, !class: class1 class2}
      • Hello
      • img: {!src: someurl.gif}
      • hr:
    • ul: [{!id: someId}, {li: hello}, {li: goodbye}]
    • ul:
      • {!style: “height: 30px”}
      • li: [{!id: first}, First]
      • li: Second

And the HTML:

My title

Hello


  • Hello
  • Goodbye
  • First
  • Second

Just a trivial example.

A YAML Builder would support ERB, and potentially serve as an
alternative for RHTML (or perhaps just a way to create partials that
could be loaded with render :yaml => “partial” or render_yaml
“partial”). I would create a .to_html extension for hashes that would
take the hash returned by YAML.load and convert it to HTML.

Note that I used YAML’s “!” to indicate attributes. Also note that the
particulars of the implementation are not set in stone yet. I’ve been
searching for the best YAML constructs to map HTML onto, and this is the
best I’ve come up with thus far. If anyone has a better idea, by all
means let me know.

So, is there any interest?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs