Jaml: An HTML builder a la Haml

In: web resources

21 Jan 2010

There have been a few HTML builder APIs out there, but Ed Spencer (new lead of Ext JS) has put together something that looks and feels similar to Haml from the Ruby side.

Jaml lets you write HTML like this:

JAVASCRIPT:

  1.  
  2. div(
  3.   h1(“Some title”),
  4.   p(“Some exciting paragraph text”),
  5.  
  6.   br(),
  7.  
  8.   ul(
  9.     li(“First item”),
  10.     li(“Second item”),
  11.     li(“Third item”)
  12.   )
  13. );
  14.  

You can also use templates like this:

JAVASCRIPT:

  1.  
  2. Jaml.register(‘product’, function(product) {
  3.   div({cls: ‘product’},
  4.     h1(product.title),
  5.  
  6.     p(product.description),
  7.  
  8.     img({src: product.thumbUrl}),
  9.     a({href: product.imageUrl}, ‘View larger image’),
  10.  
  11.     form(
  12.       label({‘for’: ‘quantity’}, “Quantity”),
  13.       input({type: ‘text’, name: ‘quantity’, id: ‘quantity’, value: 1}),
  14.  
  15.       input({type: ‘submit’, value: ‘Add to Cart’})
  16.     )
  17.   );
  18. });
  19.  

Check it all out on his Github repo.

Go to Source

3 Responses to Jaml: An HTML builder a la Haml

Avatar

mr yooka

March 18th, 2010 at 6:27 pm

http://www.goldpuma.com is the lowest cost service which is full-featured and really works for you ($3.99 /month). They accept monthly payments.

They also offer "Free Site Builder" that helps you build your web pages without difficulty if you are not skilled in using any website creating program (WYSIWYG: What You See Is What You Get). You can use this service optionally.

Avatar

ffung898

March 20th, 2010 at 8:25 am

The method posted above will set a default value, but when you click on the box, the value will remain there and the user will need to delete the text, which can be quite annoying.

This may be of help– it is an example of how to do a default value and delete it when the user clicks in the box, so they can just begin entering their information.

http://www.bradino.com/javascript/clear-textfield-default-value-onclick/

Avatar

keylimeprecision

March 20th, 2010 at 9:14 pm

1. Let T = 21,250.
GM = 34X, where x = 300

So: 10,200 bucks is spent for GM stock

T – GM = net left over = 11,050

net divided by share price = total shares that can be bough

11,050 / 8.50 = 1,300

Comment Form

About this blog

This blog delivers stylish and dynamic news for designers and web-developers on all subjects of design, ranging from: CSS, Ajax, Javascript, web design, graphics, typography, advertising & much more. Our goal is to help you communicate effectively on the web with an engaging website or functional interface.