Sha256: a89219276735e5ff43f31091fbdb1cdcb87b7632a5f6f27d3fa7150792077170

Contents?: true

Size: 777 Bytes

Versions: 5

Compression:

Stored size: 777 Bytes

Contents

#
# tagz.rb mixes quite easily with your favourite templating engine, avoiding
# the need for '<% rows.each do |row| %> ... <% row.each do |cell| %> '
# madness and other types of logic to be coded in the templating language,
# leaving templating to template engines and logic and looping to ruby -
# unencumbered by extra funky syntax
#

require 'tagz'
include Tagz.globally

require 'erb'

rows = %w( a b c ), %w( 1 2 3 )

template = ERB.new <<-ERB
  <html>
    <body>
      <%=

        if rows

          table_{
            rows.each do |row|
              tr_{
                row.each do |cell|
                  td_{ cell }
                end
              }
            end
          }

        end

      %>
    </body>
  </html>
ERB

puts template.result(binding)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tagz-4.3.0 samples/b.rb
tagz-4.4.0 samples/b.rb
tagz-4.2.0 samples/b.rb
tagz-4.6.0 samples/b.rb
tagz-4.5.0 samples/b.rb