RedCloth: table with empty value

Discussion in 'Ruby' started by Rodrigo Bermejo, Jun 28, 2008.

  1. Hello List /.

    I am trying to build a html table from a string using RedCloth.
    My table should show some empty values
    <code>

    require 'redcloth'
    table = RedCloth.new("|a|b|c|d|\n|A||c|d|").to_html
    puts table
    </code>
    produces:
    <table>
    <tr>
    <td>a</td>
    <td>b</td>
    <td>c</td>
    <td>d</td>
    </tr>
    <tr>
    <td>A</td>
    <td>c</td>
    <td>d</td>
    </tr>
    </table>

    Do you know how can I represent an empty value in a table ?
    Thank you /.
    --
    Posted via http://www.ruby-forum.com/.
     
    Rodrigo Bermejo, Jun 28, 2008
    #1
    1. Advertising

  2. Rodrigo Bermejo

    Guest

    On Jun 27, 7:31 pm, Rodrigo Bermejo <> wrote:
    > Hello List /.
    >
    > I am trying to build a html table from a string using RedCloth.
    > My table should show some empty values
    > <code>
    >
    > require 'redcloth'
    > table = RedCloth.new("|a|b|c|d|\n|A||c|d|").to_html
    > puts table
    > </code>
    > produces:
    > <table>
    >                 <tr>
    >                         <td>a</td>
    >                         <td>b</td>
    >                         <td>c</td>
    >                         <td>d</td>
    >                 </tr>
    >                 <tr>
    >                         <td>A</td>
    >                         <td>c</td>
    >                         <td>d</td>
    >                 </tr>
    > </table>
    >
    > Do you know how can I represent an empty value in a table ?
    > Thank you /.
    > --
    > Posted viahttp://www.ruby-forum.com/.


    Force empty cells to span 1 column with \1. In my test the cell
    contains a space, if that's "empty" enough.

    puts RedCloth.new("|a|b|c|d|\1|A||c|d|").to_html

    --
    Michael Morin
    Guide to Ruby
    http://ruby.about.com/
    Become an About.com Guide: beaguide.about.com
    About.com is part of the New York Times Company
     
    , Jun 28, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John

    empty/non-empty element

    John, Jul 15, 2003, in forum: XML
    Replies:
    1
    Views:
    1,053
    Klaus Johannes Rusch
    Jul 16, 2003
  2. Michael Ahlers
    Replies:
    1
    Views:
    5,743
    Martin Honnen
    Jul 12, 2004
  3. Lukas
    Replies:
    3
    Views:
    850
    spiff
    Nov 10, 2005
  4. Marcia Hon

    Check if a directory is empty and empty it

    Marcia Hon, Feb 8, 2004, in forum: C Programming
    Replies:
    8
    Views:
    600
    Dave Thompson
    Feb 14, 2004
  5. Brian Roberts

    empty lists vs empty generators

    Brian Roberts, May 3, 2005, in forum: Python
    Replies:
    12
    Views:
    676
    Jeremy Bowers
    May 4, 2005
Loading...

Share This Page