On Mar 27, 2009, at 5:16 AM, Andrew S. Townley wrote: > > I also discovered that output of empty elements doesn't behave as I'd > expect. If you do > > empty_element_ > > you get "<empty_element>" > > rather than "<empty_element/>" this by design. it's a false assumption that one never needs to separate opening and ending tags wrt to scopes (from the samples) <========< samples/d.rb >========> ~ > cat samples/d.rb # # tagz.rb doesn't cramp your style, allowing even invalid html to be # generated. note the use of the 'tagz' method, which can be used both to # capture output and to append content to the top of the stack. # require 'tagz' include Tagz.globally def header tagz{ html_ body_(:class => 'ninja-like', :id => 'giraffe-slayer') ___ "<!-- this is the header -->" div_(:class => 'content') } end def footer tagz{ ___ "<!-- this is the footer -->" _div _body _html } end puts header, footer ~ > ruby samples/d.rb <html><body class="ninja-like" id="giraffe-slayer"> <!-- this is the header --> <div class="content"> <!-- this is the footer --> </div></body></html> however, one can use a bang to indicate a tag should be close even if it has not content cfp:~/src/ruby/tagz/tagz-5.1.0 > ruby -r tagz -e 'puts Tagz{ element_! }' <element/> alternatively you can pass an empty block, which is the style i prefer cfp:~/src/ruby/tagz/tagz-5.1.0 > ruby -r tagz -e 'puts Tagz{ element_{} }' <element/> i'll look into your namespace stuff. cheers. a @ http://codeforpeople.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama