Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
[ANN] tagz-5.0.0
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="ara.t.howard, post: 4635122"] 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 @ [URL]http://codeforpeople.com/[/URL] [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
[ANN] tagz-5.0.0
Top