From: ara.t.howard@... Date: 2007-02-17T04:06:52+09:00 Subject: Re: xx-2.0.0 On Sat, 17 Feb 2007, Trans wrote: >> >> So simple! The XML namespace example should have clued me in -- need >> more coffee. >> >> As Tim Becker mentioned, this is a lot like Markaby, but it fixes some >> of Markaby's shortcomings -- mainly support for valid XML tag >> characters not currently allowed in method_missing and/or symbols. > > markaby has #tag! which is same as #_ however (AFAICT) markaby does > html, not xml. > > the builder pattern is pretty common now. Facets has a class one can > use to build any kind you'd like called BuildingBlock. you simply > apply a helper object for specially defined "tags" and the method to > use as the default. Very basic example: > > require 'facets/more/buildingblock' > > module BasicXMLMarkup > extend self > > def element( tag, body=nil, atts={} ) > atts = atts.collect{ |k,v| %{ #{k}="#{v}"} }.join('') > if body > "<#{tag}#{atts}>#{body}#{tag}>" > else > "<#{tag}#{atts} />" > end > end > end > > builder = BuildingBlock.new(BasicXMLMarkup, :element) > > builder.html do > h1 "Hello World", :class=>"big" > end > > produces > > "