0.0
No commit activity in last 3 years
No release in over 3 years
Just another HTML tag generator for ruby.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.3
>= 0
 Project Readme

HTML-AutoTag (ruby)

Just another HTML tag generator for ruby. Gem Version Build Status

Description

Generate HTML tags with ease (HTML4, HTML5, XHTML and SVG).

Synopsis

require 'HTML/AutoTag'
auto = HTML::AutoTag.new( 'indent' => '    ' )

puts auto.tag( 'tag' => 'hr' )
puts auto.tag( 'tag' => 'h1', 'cdata' => 'heading' )
puts auto.tag( 'tag' => 'p', 'cdata' => 'paragraph', 'attr' => { 'class' => 'para' } )

attr = { 'style' => { 'color' => %w{ odd even } } }
puts auto.tag(
    'tag'   => 'ol',
    'attr'  => { 'reversed' => 'reversed' },
    'cdata' => %w{ 1 2 3 4 5 }.map{ |d| { 'tag' => 'li', 'attr' => attr, 'cdata' => d } }
)

tr_attr = { 'class' => %w{ odd even } }
puts auto.tag(
    'tag'   => 'table',
    'attr'  => { 'class' => 'spreadsheet' },
    'cdata' => Array[
        {
            'tag'   => 'tr',
            'attr'  => tr_attr,
            'cdata' => {
                'tag'  => 'th',
                'attr' => { 'style' => { 'color' => %w{ red green } } },
                'cdata' => %w{ one two three },
            },
        },
        {
            'tag'   => 'tr',
            'attr'  => tr_attr,
            'cdata' => {
                'tag'  => 'td',
                'attr' => { 'style' => { 'color' => %w{ green blue } } },
                'cdata' => %w{ four five six },
            },
        },
        {
            'tag'   => 'tr',
            'attr'  => tr_attr,
            'cdata' => {
                'tag'  => 'td',
                'attr' => { 'style' => { 'color' => %w{ red green } } },
                'cdata' => %w{ seven eight nine },
            },
        },
    ]
)

Also includes HTML::AutoAttr which provides rotating attributes:

require 'HTML/AutoAttr'

attr = HTML::AutoAttr.new( { 'foo' => ['bar','baz','qux'] } )

4.times { puts attr.to_s }

More documentation at rubydoc.info

Installation

gem install HTML-AutoTag

License and Copyright

See License.