html-table 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +3 -1
- data.tar.gz.sig +0 -0
- data/CHANGES +159 -155
- data/MANIFEST +59 -59
- data/README +132 -132
- data/certs/djberg96_pub.pem +22 -17
- data/doc/attributes.rdoc +143 -143
- data/doc/table.rdoc +158 -158
- data/doc/table_body.rdoc +9 -9
- data/doc/table_caption.rdoc +9 -9
- data/doc/table_colgroup.rdoc +8 -8
- data/doc/table_colgroup_col.rdoc +9 -9
- data/doc/table_content.rdoc +15 -15
- data/doc/table_foot.rdoc +8 -8
- data/doc/table_head.rdoc +11 -11
- data/doc/table_row.rdoc +105 -105
- data/doc/table_row_data.rdoc +92 -92
- data/doc/table_row_header.rdoc +7 -7
- data/examples/advanced.rb +128 -128
- data/examples/intermediate1.rb +72 -72
- data/examples/intermediate2.rb +62 -62
- data/examples/intermediate3.rb +46 -46
- data/examples/simple1.rb +39 -39
- data/examples/simple2.rb +47 -47
- data/examples/simple3.rb +41 -41
- data/html-table.gemspec +28 -28
- data/lib/html-table.rb +1 -1
- data/lib/html/attribute_handler.rb +403 -403
- data/lib/html/body.rb +37 -37
- data/lib/html/caption.rb +49 -49
- data/lib/html/col.rb +41 -41
- data/lib/html/colgroup.rb +113 -113
- data/lib/html/content.rb +18 -18
- data/lib/html/data.rb +69 -69
- data/lib/html/foot.rb +49 -49
- data/lib/html/head.rb +49 -49
- data/lib/html/header.rb +65 -65
- data/lib/html/html_handler.rb +120 -120
- data/lib/html/row.rb +188 -188
- data/lib/html/table.rb +323 -323
- data/lib/html/tablesection.rb +48 -48
- data/lib/html/tag_handler.rb +121 -121
- data/test/test_attribute_handler.rb +361 -361
- data/test/test_body.rb +87 -87
- data/test/test_caption.rb +80 -80
- data/test/test_col.rb +40 -40
- data/test/test_colgroup.rb +89 -89
- data/test/test_data.rb +77 -77
- data/test/test_foot.rb +111 -111
- data/test/test_head.rb +104 -104
- data/test/test_header.rb +77 -77
- data/test/test_html_handler.rb +37 -37
- data/test/test_row.rb +141 -141
- data/test/test_table.rb +159 -158
- data/test/test_tablesection.rb +42 -42
- data/test/test_tag_handler.rb +90 -90
- metadata +25 -20
- metadata.gz.sig +0 -0
    
        data/examples/intermediate1.rb
    CHANGED
    
    | @@ -1,72 +1,72 @@ | |
| 1 | 
            -
            ##############################################################################
         | 
| 2 | 
            -
            # intermediate1.rb
         | 
| 3 | 
            -
            #
         | 
| 4 | 
            -
            # A slightly more advanced HTML Table.  This time we'll add some attributes,
         | 
| 5 | 
            -
            # add a few rows both implicitly and explicitly, then configure it
         | 
| 6 | 
            -
            # after-the-fact.
         | 
| 7 | 
            -
            #
         | 
| 8 | 
            -
            # You can run this via the "example:intermediate1" rake task.
         | 
| 9 | 
            -
            ##############################################################################
         | 
| 10 | 
            -
            require 'html/table'
         | 
| 11 | 
            -
            include HTML
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            # Create a table, add two rows implicitly
         | 
| 14 | 
            -
            table = Table.new{ |t|
         | 
| 15 | 
            -
               t.border  = 1
         | 
| 16 | 
            -
               t.align   = "left"
         | 
| 17 | 
            -
               t.content = [
         | 
| 18 | 
            -
                  ["foo","bar","baz"],
         | 
| 19 | 
            -
                  [1,2]
         | 
| 20 | 
            -
               ]
         | 
| 21 | 
            -
            }
         | 
| 22 | 
            -
             | 
| 23 | 
            -
            # Create a Table::Row object with one Data object added implicitly
         | 
| 24 | 
            -
            row1 = Table::Row.new{ |r|
         | 
| 25 | 
            -
               r.bgcolor = "red"
         | 
| 26 | 
            -
               r.nowrap = true
         | 
| 27 | 
            -
               r.content = "test"
         | 
| 28 | 
            -
            }
         | 
| 29 | 
            -
             | 
| 30 | 
            -
            # Create a Table::Row object, add a Data object explicitly (with some
         | 
| 31 | 
            -
            # configuration to boot)
         | 
| 32 | 
            -
            row2 = Table::Row.new{ |r|
         | 
| 33 | 
            -
               r.bgcolor = "blue"
         | 
| 34 | 
            -
               r.align = "right"
         | 
| 35 | 
            -
               r.content = Table::Row::Data.new{ |d|
         | 
| 36 | 
            -
                  d.content = "hello world!"
         | 
| 37 | 
            -
                  d.abbr = "test abbr"
         | 
| 38 | 
            -
               }
         | 
| 39 | 
            -
            }
         | 
| 40 | 
            -
             | 
| 41 | 
            -
            # Add the rows explicitly to the table
         | 
| 42 | 
            -
            table.push row1, row2
         | 
| 43 | 
            -
             | 
| 44 | 
            -
            # Let's configure the row that contains "foo","bar","baz"
         | 
| 45 | 
            -
            # Remember, row and column counts start at 0, not 1
         | 
| 46 | 
            -
            table.configure(0){ |r|
         | 
| 47 | 
            -
               r.bgcolor = "green"
         | 
| 48 | 
            -
               r.align   = "right"
         | 
| 49 | 
            -
            }
         | 
| 50 | 
            -
             | 
| 51 | 
            -
            puts table.html
         | 
| 52 | 
            -
             | 
| 53 | 
            -
            =begin
         | 
| 54 | 
            -
            ### OUTPUT ###
         | 
| 55 | 
            -
            <table border=1 align='left'>
         | 
| 56 | 
            -
               <tr bgcolor='green' align='right'>
         | 
| 57 | 
            -
                  <td>foo</td>
         | 
| 58 | 
            -
                  <td>bar</td>
         | 
| 59 | 
            -
                  <td>baz</td>
         | 
| 60 | 
            -
               </tr>
         | 
| 61 | 
            -
               <tr>
         | 
| 62 | 
            -
                  <td>1</td>
         | 
| 63 | 
            -
                  <td>2</td>
         | 
| 64 | 
            -
               </tr>
         | 
| 65 | 
            -
               <tr bgcolor='red' nowrap>
         | 
| 66 | 
            -
                  <td>test</td>
         | 
| 67 | 
            -
               </tr>
         | 
| 68 | 
            -
               <tr bgcolor='blue' align='right'>
         | 
| 69 | 
            -
                  <td abbr='test abbr'>hello world!</td>
         | 
| 70 | 
            -
               </tr>
         | 
| 71 | 
            -
            </table>
         | 
| 72 | 
            -
            =end
         | 
| 1 | 
            +
            ##############################################################################
         | 
| 2 | 
            +
            # intermediate1.rb
         | 
| 3 | 
            +
            #
         | 
| 4 | 
            +
            # A slightly more advanced HTML Table.  This time we'll add some attributes,
         | 
| 5 | 
            +
            # add a few rows both implicitly and explicitly, then configure it
         | 
| 6 | 
            +
            # after-the-fact.
         | 
| 7 | 
            +
            #
         | 
| 8 | 
            +
            # You can run this via the "example:intermediate1" rake task.
         | 
| 9 | 
            +
            ##############################################################################
         | 
| 10 | 
            +
            require 'html/table'
         | 
| 11 | 
            +
            include HTML
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            # Create a table, add two rows implicitly
         | 
| 14 | 
            +
            table = Table.new{ |t|
         | 
| 15 | 
            +
               t.border  = 1
         | 
| 16 | 
            +
               t.align   = "left"
         | 
| 17 | 
            +
               t.content = [
         | 
| 18 | 
            +
                  ["foo","bar","baz"],
         | 
| 19 | 
            +
                  [1,2]
         | 
| 20 | 
            +
               ]
         | 
| 21 | 
            +
            }
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            # Create a Table::Row object with one Data object added implicitly
         | 
| 24 | 
            +
            row1 = Table::Row.new{ |r|
         | 
| 25 | 
            +
               r.bgcolor = "red"
         | 
| 26 | 
            +
               r.nowrap = true
         | 
| 27 | 
            +
               r.content = "test"
         | 
| 28 | 
            +
            }
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            # Create a Table::Row object, add a Data object explicitly (with some
         | 
| 31 | 
            +
            # configuration to boot)
         | 
| 32 | 
            +
            row2 = Table::Row.new{ |r|
         | 
| 33 | 
            +
               r.bgcolor = "blue"
         | 
| 34 | 
            +
               r.align = "right"
         | 
| 35 | 
            +
               r.content = Table::Row::Data.new{ |d|
         | 
| 36 | 
            +
                  d.content = "hello world!"
         | 
| 37 | 
            +
                  d.abbr = "test abbr"
         | 
| 38 | 
            +
               }
         | 
| 39 | 
            +
            }
         | 
| 40 | 
            +
             | 
| 41 | 
            +
            # Add the rows explicitly to the table
         | 
| 42 | 
            +
            table.push row1, row2
         | 
| 43 | 
            +
             | 
| 44 | 
            +
            # Let's configure the row that contains "foo","bar","baz"
         | 
| 45 | 
            +
            # Remember, row and column counts start at 0, not 1
         | 
| 46 | 
            +
            table.configure(0){ |r|
         | 
| 47 | 
            +
               r.bgcolor = "green"
         | 
| 48 | 
            +
               r.align   = "right"
         | 
| 49 | 
            +
            }
         | 
| 50 | 
            +
             | 
| 51 | 
            +
            puts table.html
         | 
| 52 | 
            +
             | 
| 53 | 
            +
            =begin
         | 
| 54 | 
            +
            ### OUTPUT ###
         | 
| 55 | 
            +
            <table border=1 align='left'>
         | 
| 56 | 
            +
               <tr bgcolor='green' align='right'>
         | 
| 57 | 
            +
                  <td>foo</td>
         | 
| 58 | 
            +
                  <td>bar</td>
         | 
| 59 | 
            +
                  <td>baz</td>
         | 
| 60 | 
            +
               </tr>
         | 
| 61 | 
            +
               <tr>
         | 
| 62 | 
            +
                  <td>1</td>
         | 
| 63 | 
            +
                  <td>2</td>
         | 
| 64 | 
            +
               </tr>
         | 
| 65 | 
            +
               <tr bgcolor='red' nowrap>
         | 
| 66 | 
            +
                  <td>test</td>
         | 
| 67 | 
            +
               </tr>
         | 
| 68 | 
            +
               <tr bgcolor='blue' align='right'>
         | 
| 69 | 
            +
                  <td abbr='test abbr'>hello world!</td>
         | 
| 70 | 
            +
               </tr>
         | 
| 71 | 
            +
            </table>
         | 
| 72 | 
            +
            =end
         | 
    
        data/examples/intermediate2.rb
    CHANGED
    
    | @@ -1,62 +1,62 @@ | |
| 1 | 
            -
            ##############################################################################
         | 
| 2 | 
            -
            # intermediate2.rb
         | 
| 3 | 
            -
            #
         | 
| 4 | 
            -
            # A slightly more advanced HTML Table.  This time we'll add some attributes,
         | 
| 5 | 
            -
            # add a few rows both implicitly and explicitly, then configure it
         | 
| 6 | 
            -
            # after-the-fact.  We'll also play with Captions and Headers and generally
         | 
| 7 | 
            -
            # do things slightly different that intermdiate1.rb.
         | 
| 8 | 
            -
            #
         | 
| 9 | 
            -
            # You can run this via the "example:intermediate2" rake task.
         | 
| 10 | 
            -
            ##############################################################################
         | 
| 11 | 
            -
            require 'html/table'
         | 
| 12 | 
            -
            include HTML
         | 
| 13 | 
            -
             | 
| 14 | 
            -
            table = Table.new
         | 
| 15 | 
            -
            table.border = 1
         | 
| 16 | 
            -
            table.cellpadding = 5
         | 
| 17 | 
            -
             | 
| 18 | 
            -
            caption = Table::Caption.new
         | 
| 19 | 
            -
            caption.content = "This is a caption!"
         | 
| 20 | 
            -
             | 
| 21 | 
            -
            row1 = Table::Row.new
         | 
| 22 | 
            -
            row2 = Table::Row.new
         | 
| 23 | 
            -
             | 
| 24 | 
            -
            row1.bgcolor = "red"
         | 
| 25 | 
            -
            row2.bgcolor = "blue"
         | 
| 26 | 
            -
             | 
| 27 | 
            -
            d1 = Table::Row::Data.new{ |d| d.content = "foo" }
         | 
| 28 | 
            -
            d2 = Table::Row::Data.new{ |d| d.content = "bar" }
         | 
| 29 | 
            -
            d3 = Table::Row::Data.new{ |d| d.content = "baz" }
         | 
| 30 | 
            -
             | 
| 31 | 
            -
            row1[0..2] = d1, d2, d3
         | 
| 32 | 
            -
             | 
| 33 | 
            -
            d4 = Table::Row::Data.new{ |d| d.content = "hello" }
         | 
| 34 | 
            -
            d5 = Table::Row::Data.new{ |d| d.content = "world" }
         | 
| 35 | 
            -
             | 
| 36 | 
            -
            h1 = Table::Row::Header.new
         | 
| 37 | 
            -
            h1.content = "This is a header"
         | 
| 38 | 
            -
            h1.colspan = 2
         | 
| 39 | 
            -
             | 
| 40 | 
            -
            row2.unshift h1
         | 
| 41 | 
            -
            row2.push d4, d5
         | 
| 42 | 
            -
             | 
| 43 | 
            -
            table.push row1, row2
         | 
| 44 | 
            -
            table.push caption # automatically bumped to row 0
         | 
| 45 | 
            -
             | 
| 46 | 
            -
            puts table.html
         | 
| 47 | 
            -
             | 
| 48 | 
            -
            =begin
         | 
| 49 | 
            -
            <table border=1 cellpadding=5>
         | 
| 50 | 
            -
               <caption>This is a caption!</caption>
         | 
| 51 | 
            -
               <tr bgcolor='red'>
         | 
| 52 | 
            -
                  <td>foo</td>
         | 
| 53 | 
            -
                  <td>bar</td>
         | 
| 54 | 
            -
                  <td>baz</td>
         | 
| 55 | 
            -
               </tr>
         | 
| 56 | 
            -
               <tr bgcolor='blue'>
         | 
| 57 | 
            -
                  <th colspan=2>This is a header</th>
         | 
| 58 | 
            -
                  <td>hello</td>
         | 
| 59 | 
            -
                  <td>world</td>
         | 
| 60 | 
            -
               </tr>
         | 
| 61 | 
            -
            </table>
         | 
| 62 | 
            -
            =end
         | 
| 1 | 
            +
            ##############################################################################
         | 
| 2 | 
            +
            # intermediate2.rb
         | 
| 3 | 
            +
            #
         | 
| 4 | 
            +
            # A slightly more advanced HTML Table.  This time we'll add some attributes,
         | 
| 5 | 
            +
            # add a few rows both implicitly and explicitly, then configure it
         | 
| 6 | 
            +
            # after-the-fact.  We'll also play with Captions and Headers and generally
         | 
| 7 | 
            +
            # do things slightly different that intermdiate1.rb.
         | 
| 8 | 
            +
            #
         | 
| 9 | 
            +
            # You can run this via the "example:intermediate2" rake task.
         | 
| 10 | 
            +
            ##############################################################################
         | 
| 11 | 
            +
            require 'html/table'
         | 
| 12 | 
            +
            include HTML
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            table = Table.new
         | 
| 15 | 
            +
            table.border = 1
         | 
| 16 | 
            +
            table.cellpadding = 5
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            caption = Table::Caption.new
         | 
| 19 | 
            +
            caption.content = "This is a caption!"
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            row1 = Table::Row.new
         | 
| 22 | 
            +
            row2 = Table::Row.new
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            row1.bgcolor = "red"
         | 
| 25 | 
            +
            row2.bgcolor = "blue"
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            d1 = Table::Row::Data.new{ |d| d.content = "foo" }
         | 
| 28 | 
            +
            d2 = Table::Row::Data.new{ |d| d.content = "bar" }
         | 
| 29 | 
            +
            d3 = Table::Row::Data.new{ |d| d.content = "baz" }
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            row1[0..2] = d1, d2, d3
         | 
| 32 | 
            +
             | 
| 33 | 
            +
            d4 = Table::Row::Data.new{ |d| d.content = "hello" }
         | 
| 34 | 
            +
            d5 = Table::Row::Data.new{ |d| d.content = "world" }
         | 
| 35 | 
            +
             | 
| 36 | 
            +
            h1 = Table::Row::Header.new
         | 
| 37 | 
            +
            h1.content = "This is a header"
         | 
| 38 | 
            +
            h1.colspan = 2
         | 
| 39 | 
            +
             | 
| 40 | 
            +
            row2.unshift h1
         | 
| 41 | 
            +
            row2.push d4, d5
         | 
| 42 | 
            +
             | 
| 43 | 
            +
            table.push row1, row2
         | 
| 44 | 
            +
            table.push caption # automatically bumped to row 0
         | 
| 45 | 
            +
             | 
| 46 | 
            +
            puts table.html
         | 
| 47 | 
            +
             | 
| 48 | 
            +
            =begin
         | 
| 49 | 
            +
            <table border=1 cellpadding=5>
         | 
| 50 | 
            +
               <caption>This is a caption!</caption>
         | 
| 51 | 
            +
               <tr bgcolor='red'>
         | 
| 52 | 
            +
                  <td>foo</td>
         | 
| 53 | 
            +
                  <td>bar</td>
         | 
| 54 | 
            +
                  <td>baz</td>
         | 
| 55 | 
            +
               </tr>
         | 
| 56 | 
            +
               <tr bgcolor='blue'>
         | 
| 57 | 
            +
                  <th colspan=2>This is a header</th>
         | 
| 58 | 
            +
                  <td>hello</td>
         | 
| 59 | 
            +
                  <td>world</td>
         | 
| 60 | 
            +
               </tr>
         | 
| 61 | 
            +
            </table>
         | 
| 62 | 
            +
            =end
         | 
    
        data/examples/intermediate3.rb
    CHANGED
    
    | @@ -1,46 +1,46 @@ | |
| 1 | 
            -
            #######################################################################
         | 
| 2 | 
            -
            # intermediate3.rb
         | 
| 3 | 
            -
            #
         | 
| 4 | 
            -
            # This example demonstrates some intermediate features, including the
         | 
| 5 | 
            -
            # DSL style syntax and physical tag handling.
         | 
| 6 | 
            -
            #
         | 
| 7 | 
            -
            # You can run this example via the "example:intermediate3" rake task.
         | 
| 8 | 
            -
            #######################################################################
         | 
| 9 | 
            -
            require 'html/table'
         | 
| 10 | 
            -
            include HTML
         | 
| 11 | 
            -
             | 
| 12 | 
            -
            # You can set physical tags inline using block syntax...
         | 
| 13 | 
            -
            table = Table.new do
         | 
| 14 | 
            -
               align    'left'
         | 
| 15 | 
            -
               bgcolor  'red'
         | 
| 16 | 
            -
               header   [['header1', 'header2']]
         | 
| 17 | 
            -
               content  [['foo', 'bar']]
         | 
| 18 | 
            -
               content  [['baz', 'blah']] do
         | 
| 19 | 
            -
                  underline true
         | 
| 20 | 
            -
                  tt        true
         | 
| 21 | 
            -
               end
         | 
| 22 | 
            -
            end
         | 
| 23 | 
            -
             | 
| 24 | 
            -
            # Or you can do it this way
         | 
| 25 | 
            -
            table[1][0].content.bold   = true
         | 
| 26 | 
            -
            table[1][1].content.italic = true
         | 
| 27 | 
            -
             | 
| 28 | 
            -
            puts table.html
         | 
| 29 | 
            -
             | 
| 30 | 
            -
            =begin
         | 
| 31 | 
            -
            ### OUTPUT ###
         | 
| 32 | 
            -
            <table align='left' bgcolor='red'>
         | 
| 33 | 
            -
               <tr>
         | 
| 34 | 
            -
                  <th>header1</th>
         | 
| 35 | 
            -
                  <th>header2</th>
         | 
| 36 | 
            -
               </tr>
         | 
| 37 | 
            -
               <tr>
         | 
| 38 | 
            -
                  <td><b>foo</b></td>
         | 
| 39 | 
            -
                  <td><i>bar</i></td>
         | 
| 40 | 
            -
               </tr>
         | 
| 41 | 
            -
               <tr>
         | 
| 42 | 
            -
                  <td><tt><u>baz</u></tt></td>
         | 
| 43 | 
            -
                  <td><tt><u>blah</u></tt></td>
         | 
| 44 | 
            -
               </tr>
         | 
| 45 | 
            -
            </table>
         | 
| 46 | 
            -
            =end
         | 
| 1 | 
            +
            #######################################################################
         | 
| 2 | 
            +
            # intermediate3.rb
         | 
| 3 | 
            +
            #
         | 
| 4 | 
            +
            # This example demonstrates some intermediate features, including the
         | 
| 5 | 
            +
            # DSL style syntax and physical tag handling.
         | 
| 6 | 
            +
            #
         | 
| 7 | 
            +
            # You can run this example via the "example:intermediate3" rake task.
         | 
| 8 | 
            +
            #######################################################################
         | 
| 9 | 
            +
            require 'html/table'
         | 
| 10 | 
            +
            include HTML
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            # You can set physical tags inline using block syntax...
         | 
| 13 | 
            +
            table = Table.new do
         | 
| 14 | 
            +
               align    'left'
         | 
| 15 | 
            +
               bgcolor  'red'
         | 
| 16 | 
            +
               header   [['header1', 'header2']]
         | 
| 17 | 
            +
               content  [['foo', 'bar']]
         | 
| 18 | 
            +
               content  [['baz', 'blah']] do
         | 
| 19 | 
            +
                  underline true
         | 
| 20 | 
            +
                  tt        true
         | 
| 21 | 
            +
               end
         | 
| 22 | 
            +
            end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            # Or you can do it this way
         | 
| 25 | 
            +
            table[1][0].content.bold   = true
         | 
| 26 | 
            +
            table[1][1].content.italic = true
         | 
| 27 | 
            +
             | 
| 28 | 
            +
            puts table.html
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            =begin
         | 
| 31 | 
            +
            ### OUTPUT ###
         | 
| 32 | 
            +
            <table align='left' bgcolor='red'>
         | 
| 33 | 
            +
               <tr>
         | 
| 34 | 
            +
                  <th>header1</th>
         | 
| 35 | 
            +
                  <th>header2</th>
         | 
| 36 | 
            +
               </tr>
         | 
| 37 | 
            +
               <tr>
         | 
| 38 | 
            +
                  <td><b>foo</b></td>
         | 
| 39 | 
            +
                  <td><i>bar</i></td>
         | 
| 40 | 
            +
               </tr>
         | 
| 41 | 
            +
               <tr>
         | 
| 42 | 
            +
                  <td><tt><u>baz</u></tt></td>
         | 
| 43 | 
            +
                  <td><tt><u>blah</u></tt></td>
         | 
| 44 | 
            +
               </tr>
         | 
| 45 | 
            +
            </table>
         | 
| 46 | 
            +
            =end
         | 
    
        data/examples/simple1.rb
    CHANGED
    
    | @@ -1,39 +1,39 @@ | |
| 1 | 
            -
            #######################################################################
         | 
| 2 | 
            -
            # simple1.rb
         | 
| 3 | 
            -
            #
         | 
| 4 | 
            -
            # Very plain HTML Table with rows and data implicitly created.
         | 
| 5 | 
            -
            #
         | 
| 6 | 
            -
            # You can run this example via the "example:sample1" rake task.
         | 
| 7 | 
            -
            #######################################################################
         | 
| 8 | 
            -
            require 'html/table'
         | 
| 9 | 
            -
            include HTML
         | 
| 10 | 
            -
             | 
| 11 | 
            -
            table = Table.new{ |t|
         | 
| 12 | 
            -
               t.content = [
         | 
| 13 | 
            -
                  %w/foo bar baz/,
         | 
| 14 | 
            -
                  %w/1 2 3/,
         | 
| 15 | 
            -
                  %w/hello world/
         | 
| 16 | 
            -
               ]
         | 
| 17 | 
            -
            }
         | 
| 18 | 
            -
             | 
| 19 | 
            -
            puts table.html
         | 
| 20 | 
            -
             | 
| 21 | 
            -
            =begin
         | 
| 22 | 
            -
            ### OUTPUT ###
         | 
| 23 | 
            -
            <table>
         | 
| 24 | 
            -
               <tr>
         | 
| 25 | 
            -
                  <td>foo</td>
         | 
| 26 | 
            -
                  <td>bar</td>
         | 
| 27 | 
            -
                  <td>baz</td>
         | 
| 28 | 
            -
               </tr>
         | 
| 29 | 
            -
               <tr>
         | 
| 30 | 
            -
                  <td>1</td>
         | 
| 31 | 
            -
                  <td>2</td>
         | 
| 32 | 
            -
                  <td>3</td>
         | 
| 33 | 
            -
               </tr>
         | 
| 34 | 
            -
               <tr>
         | 
| 35 | 
            -
                  <td>hello</td>
         | 
| 36 | 
            -
                  <td>world</td>
         | 
| 37 | 
            -
               </tr>
         | 
| 38 | 
            -
            </table>
         | 
| 39 | 
            -
            =end
         | 
| 1 | 
            +
            #######################################################################
         | 
| 2 | 
            +
            # simple1.rb
         | 
| 3 | 
            +
            #
         | 
| 4 | 
            +
            # Very plain HTML Table with rows and data implicitly created.
         | 
| 5 | 
            +
            #
         | 
| 6 | 
            +
            # You can run this example via the "example:sample1" rake task.
         | 
| 7 | 
            +
            #######################################################################
         | 
| 8 | 
            +
            require 'html/table'
         | 
| 9 | 
            +
            include HTML
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            table = Table.new{ |t|
         | 
| 12 | 
            +
               t.content = [
         | 
| 13 | 
            +
                  %w/foo bar baz/,
         | 
| 14 | 
            +
                  %w/1 2 3/,
         | 
| 15 | 
            +
                  %w/hello world/
         | 
| 16 | 
            +
               ]
         | 
| 17 | 
            +
            }
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            puts table.html
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            =begin
         | 
| 22 | 
            +
            ### OUTPUT ###
         | 
| 23 | 
            +
            <table>
         | 
| 24 | 
            +
               <tr>
         | 
| 25 | 
            +
                  <td>foo</td>
         | 
| 26 | 
            +
                  <td>bar</td>
         | 
| 27 | 
            +
                  <td>baz</td>
         | 
| 28 | 
            +
               </tr>
         | 
| 29 | 
            +
               <tr>
         | 
| 30 | 
            +
                  <td>1</td>
         | 
| 31 | 
            +
                  <td>2</td>
         | 
| 32 | 
            +
                  <td>3</td>
         | 
| 33 | 
            +
               </tr>
         | 
| 34 | 
            +
               <tr>
         | 
| 35 | 
            +
                  <td>hello</td>
         | 
| 36 | 
            +
                  <td>world</td>
         | 
| 37 | 
            +
               </tr>
         | 
| 38 | 
            +
            </table>
         | 
| 39 | 
            +
            =end
         | 
    
        data/examples/simple2.rb
    CHANGED
    
    | @@ -1,47 +1,47 @@ | |
| 1 | 
            -
            #######################################################################
         | 
| 2 | 
            -
            # simple2.rb
         | 
| 3 | 
            -
            #
         | 
| 4 | 
            -
            # Very plain HTML Table with rows explicitly created and data
         | 
| 5 | 
            -
            # elements implicitly created. We also remove the end tags
         | 
| 6 | 
            -
            # and capitalize the HTML tags and attributes.
         | 
| 7 | 
            -
            #
         | 
| 8 | 
            -
            # You can run this sample via the "example:simple2" rake task.
         | 
| 9 | 
            -
            #######################################################################
         | 
| 10 | 
            -
            require 'html/table'
         | 
| 11 | 
            -
            include HTML
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            Table.html_case = "upper"
         | 
| 14 | 
            -
            Table::Row.end_tags = false
         | 
| 15 | 
            -
            Table::Row::Data.end_tags = false
         | 
| 16 | 
            -
             | 
| 17 | 
            -
            table = Table.new
         | 
| 18 | 
            -
            tr1 = Table::Row.new
         | 
| 19 | 
            -
            tr2 = Table::Row.new
         | 
| 20 | 
            -
            tr3 = Table::Row.new
         | 
| 21 | 
            -
             | 
| 22 | 
            -
            tr1.content = "foo", "bar", "baz"
         | 
| 23 | 
            -
            tr2.content = 1,2,3
         | 
| 24 | 
            -
            tr3.content = %w/hello world/
         | 
| 25 | 
            -
             | 
| 26 | 
            -
            table.push(tr1,tr2,tr3)
         | 
| 27 | 
            -
             | 
| 28 | 
            -
            table[0][1].align = "left"
         | 
| 29 | 
            -
             | 
| 30 | 
            -
            puts table.html
         | 
| 31 | 
            -
             | 
| 32 | 
            -
            =begin
         | 
| 33 | 
            -
            ### OUTPUT ###
         | 
| 34 | 
            -
            <TABLE>
         | 
| 35 | 
            -
               <TR>
         | 
| 36 | 
            -
                  <TD>foo
         | 
| 37 | 
            -
                  <TD ALIGN='LEFT'>bar
         | 
| 38 | 
            -
                  <TD>baz
         | 
| 39 | 
            -
               <TR>
         | 
| 40 | 
            -
                  <TD>1
         | 
| 41 | 
            -
                  <TD>2
         | 
| 42 | 
            -
                  <TD>3
         | 
| 43 | 
            -
               <TR>
         | 
| 44 | 
            -
                  <TD>hello
         | 
| 45 | 
            -
                  <TD>world
         | 
| 46 | 
            -
            </TABLE>
         | 
| 47 | 
            -
            =end
         | 
| 1 | 
            +
            #######################################################################
         | 
| 2 | 
            +
            # simple2.rb
         | 
| 3 | 
            +
            #
         | 
| 4 | 
            +
            # Very plain HTML Table with rows explicitly created and data
         | 
| 5 | 
            +
            # elements implicitly created. We also remove the end tags
         | 
| 6 | 
            +
            # and capitalize the HTML tags and attributes.
         | 
| 7 | 
            +
            #
         | 
| 8 | 
            +
            # You can run this sample via the "example:simple2" rake task.
         | 
| 9 | 
            +
            #######################################################################
         | 
| 10 | 
            +
            require 'html/table'
         | 
| 11 | 
            +
            include HTML
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            Table.html_case = "upper"
         | 
| 14 | 
            +
            Table::Row.end_tags = false
         | 
| 15 | 
            +
            Table::Row::Data.end_tags = false
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            table = Table.new
         | 
| 18 | 
            +
            tr1 = Table::Row.new
         | 
| 19 | 
            +
            tr2 = Table::Row.new
         | 
| 20 | 
            +
            tr3 = Table::Row.new
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            tr1.content = "foo", "bar", "baz"
         | 
| 23 | 
            +
            tr2.content = 1,2,3
         | 
| 24 | 
            +
            tr3.content = %w/hello world/
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            table.push(tr1,tr2,tr3)
         | 
| 27 | 
            +
             | 
| 28 | 
            +
            table[0][1].align = "left"
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            puts table.html
         | 
| 31 | 
            +
             | 
| 32 | 
            +
            =begin
         | 
| 33 | 
            +
            ### OUTPUT ###
         | 
| 34 | 
            +
            <TABLE>
         | 
| 35 | 
            +
               <TR>
         | 
| 36 | 
            +
                  <TD>foo
         | 
| 37 | 
            +
                  <TD ALIGN='LEFT'>bar
         | 
| 38 | 
            +
                  <TD>baz
         | 
| 39 | 
            +
               <TR>
         | 
| 40 | 
            +
                  <TD>1
         | 
| 41 | 
            +
                  <TD>2
         | 
| 42 | 
            +
                  <TD>3
         | 
| 43 | 
            +
               <TR>
         | 
| 44 | 
            +
                  <TD>hello
         | 
| 45 | 
            +
                  <TD>world
         | 
| 46 | 
            +
            </TABLE>
         | 
| 47 | 
            +
            =end
         |