creating tables with internal borders with RedCloth

Discussion in 'Ruby' started by Stefano Crocco, Jun 30, 2008.

  1. I'm having a problem using RedCloth. I know this question is more suited for a
    RedCloth mailing list, but the only one I found (the one on the RedCloth page
    on rubyforge) is for people who wants to contribute to it, not for those
    asking for help. If someone knows of another mailing list, please let me know.

    My problem is quite simple: I want to use RedCloth and Textile to create a
    table with borders around the it and between all cells, as the one produced by
    specifying the rules="all" attribute to the html table tag:

    <table rules="all" style="border:1px solid black">
    ...
    </table>

    I can't find out how to obtain this. The standard Textile syntax for tables
    produce a borderless table, while specifying the border style for the whole
    table, as shown in the Textile reference (http://hobix.com/textile/) only puts
    the border around the whole table.

    I know I can insert the table using html, but before doing so, I'd like to be
    sure there isn't a better alternative.

    Any ideas?

    Thanks in advance

    Stefano
    Stefano Crocco, Jun 30, 2008
    #1
    1. Advertising

  2. Stefano Crocco wrote:
    > I'm having a problem using RedCloth. I know this question is more suited for a
    > RedCloth mailing list, but the only one I found (the one on the RedCloth page
    > on rubyforge) is for people who wants to contribute to it, not for those
    > asking for help. If someone knows of another mailing list, please let me know.
    >
    > My problem is quite simple: I want to use RedCloth and Textile to create a
    > table with borders around the it and between all cells, as the one produced by
    > specifying the rules="all" attribute to the html table tag:
    >
    > <table rules="all" style="border:1px solid black">
    > ...
    > </table>
    >
    > I can't find out how to obtain this. The standard Textile syntax for tables
    > produce a borderless table, while specifying the border style for the whole
    > table, as shown in the Textile reference (http://hobix.com/textile/) only puts
    > the border around the whole table.
    >
    > I know I can insert the table using html, but before doing so, I'd like to be
    > sure there isn't a better alternative.
    >
    > Any ideas?
    >
    > Thanks in advance
    >
    > Stefano
    >


    You want a border around every cell? If so, try something like this.

    table(mytable).
    |10|20|30|40|

    Then your CSS could look something like this:

    table.mytable td {
    border: 1px solid black;
    }

    --
    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
    Michael Morin, Jun 30, 2008
    #2
    1. Advertising

  3. On Monday 30 June 2008, Michael Morin wrote:
    > Stefano Crocco wrote:
    > > I'm having a problem using RedCloth. I know this question is more suited
    > > for a RedCloth mailing list, but the only one I found (the one on the
    > > RedCloth page on rubyforge) is for people who wants to contribute to it,
    > > not for those asking for help. If someone knows of another mailing list,
    > > please let me know.
    > >
    > > My problem is quite simple: I want to use RedCloth and Textile to create
    > > a table with borders around the it and between all cells, as the one
    > > produced by specifying the rules="all" attribute to the html table tag:
    > >
    > > <table rules="all" style="border:1px solid black">
    > > ...
    > > </table>
    > >
    > > I can't find out how to obtain this. The standard Textile syntax for
    > > tables produce a borderless table, while specifying the border style for
    > > the whole table, as shown in the Textile reference
    > > (http://hobix.com/textile/) only puts the border around the whole table.
    > >
    > > I know I can insert the table using html, but before doing so, I'd like
    > > to be sure there isn't a better alternative.
    > >
    > > Any ideas?
    > >
    > > Thanks in advance
    > >
    > > Stefano

    >
    > You want a border around every cell? If so, try something like this.
    >
    > table(mytable).
    >
    > |10|20|30|40|
    >
    > Then your CSS could look something like this:
    >
    > table.mytable td {
    > border: 1px solid black;
    > }


    Thanks for your answer, but this is not what I need. It seems I wasn't very
    clear in explaining my problem. I need a table with a grid separating rows and
    columns, something like this:
    _ _ _
    |_|_|_|
    |_|_|_|
    |_|_|_|

    What you suggested puts a border around each cell, but a border which is
    separated from the border around the neighbour cells (re-reading my original
    post, I must admit that I seemed to be asking for this. I apologize for having
    been so confusing.)

    Stefano
    Stefano Crocco, Jun 30, 2008
    #3
  4. Stefano Crocco wrote:
    > On Monday 30 June 2008, Michael Morin wrote:
    >> Stefano Crocco wrote:
    >>> I'm having a problem using RedCloth. I know this question is more suited
    >>> for a RedCloth mailing list, but the only one I found (the one on the
    >>> RedCloth page on rubyforge) is for people who wants to contribute to it,
    >>> not for those asking for help. If someone knows of another mailing list,
    >>> please let me know.
    >>>
    >>> My problem is quite simple: I want to use RedCloth and Textile to create
    >>> a table with borders around the it and between all cells, as the one
    >>> produced by specifying the rules="all" attribute to the html table tag:
    >>>
    >>> <table rules="all" style="border:1px solid black">
    >>> ...
    >>> </table>
    >>>
    >>> I can't find out how to obtain this. The standard Textile syntax for
    >>> tables produce a borderless table, while specifying the border style for
    >>> the whole table, as shown in the Textile reference
    >>> (http://hobix.com/textile/) only puts the border around the whole table.
    >>>
    >>> I know I can insert the table using html, but before doing so, I'd like
    >>> to be sure there isn't a better alternative.
    >>>
    >>> Any ideas?
    >>>
    >>> Thanks in advance
    >>>
    >>> Stefano

    >> You want a border around every cell? If so, try something like this.
    >>
    >> table(mytable).
    >>
    >> |10|20|30|40|
    >>
    >> Then your CSS could look something like this:
    >>
    >> table.mytable td {
    >> border: 1px solid black;
    >> }

    >
    > Thanks for your answer, but this is not what I need. It seems I wasn't very
    > clear in explaining my problem. I need a table with a grid separating rows and
    > columns, something like this:
    > _ _ _
    > |_|_|_|
    > |_|_|_|
    > |_|_|_|
    >
    > What you suggested puts a border around each cell, but a border which is
    > separated from the border around the neighbour cells (re-reading my original
    > post, I must admit that I seemed to be asking for this. I apologize for having
    > been so confusing.)
    >
    > Stefano
    >
    >


    The same can be used with some minor tweaks. Play with the padding and
    spacing of the td tags as well as which edges the borders go on.

    --
    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
    Michael Morin, Jun 30, 2008
    #4
  5. > What you suggested puts a border around each cell, but a border which is
    > separated from the border around the neighbour cells (re-reading my original
    > post, I must admit that I seemed to be asking for this. I apologize for having
    > been so confusing.)


    Just add this to your CSS (change table.mytable as needed)

    table.mytable {
    border-collapse:collapse;
    }


    Regards,
    Rimantas
    --
    http://rimantas.com/
    Rimantas Liubertas, Jun 30, 2008
    #5
  6. On Monday 30 June 2008, Rimantas Liubertas wrote:
    > > What you suggested puts a border around each cell, but a border which is
    > > separated from the border around the neighbour cells (re-reading my
    > > original post, I must admit that I seemed to be asking for this. I
    > > apologize for having been so confusing.)

    >
    > Just add this to your CSS (change table.mytable as needed)
    >
    > table.mytable {
    > border-collapse:collapse;
    > }
    >
    >
    > Regards,
    > Rimantas
    > --
    > http://rimantas.com/


    Thanks, but this only puts a border around the whole table (unless I
    misunderstand you). What I'd like is to obtain the following html output from
    RedCloth:

    <table rules="all">
    <tr>
    <td>a</td><td>b</td><td>c</td>
    </tr>
    <tr>
    <td>d</td><td>e</td><td>f</td>
    </tr>
    </table>

    I'm not an expert of html, but I think the key is the rules="all" attribute,
    which I can't set from RedCloth (at least as far as I know) and which can't be
    set using CSS.

    Stefano
    Stefano Crocco, Jun 30, 2008
    #6
  7. On Mon, Jun 30, 2008 at 4:06 AM, Stefano Crocco <> wrote:

    > What you suggested puts a border around each cell, but a border which is
    > separated from the border around the neighbour cells


    If you're going to do web work, you need to learn CSS. In this case,
    reading <http://www.w3.org/TR/CSS21/tables.html>, particularly
    section 17.6 Borders, should help.

    FWIW,
    --
    Hassan Schroeder ------------------------
    Hassan Schroeder, Jun 30, 2008
    #7
  8. On Monday 30 June 2008, Hassan Schroeder wrote:
    > On Mon, Jun 30, 2008 at 4:06 AM, Stefano Crocco <>

    wrote:
    > > What you suggested puts a border around each cell, but a border which is
    > > separated from the border around the neighbour cells

    >
    > If you're going to do web work, you need to learn CSS. In this case,
    > reading <http://www.w3.org/TR/CSS21/tables.html>, particularly
    > section 17.6 Borders, should help.
    >
    > FWIW,


    I read that document before sending the first post, but not well enough, it
    seems. Having seen the expression "separated borders model", and the figure
    which goes with it, I too quickly assumed it wasn't what I was looking for (I
    wanted united borders, not separated ones). At any rate, reading some of the
    previous answers, I looked back at it and, before my last post, decided to try
    changing the border-spacing attribute, but by mistake changed it in the td
    element instead of the table, and so it didn't work.

    At any rate, setting the border-spacing attribute to 0 for the table solved
    the problem.

    Thanks

    Stefano
    Stefano Crocco, Jun 30, 2008
    #8
    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. Mark Rae

    <asp:Panels, borders and HTML tables

    Mark Rae, Oct 6, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    5,024
    Mark Rae
    Oct 6, 2004
  2. Michael Wilcox

    Tables with solid black borders?

    Michael Wilcox, Jul 7, 2003, in forum: HTML
    Replies:
    3
    Views:
    23,665
    Michael Wilcox
    Jul 7, 2003
  3. Hostile17

    Borders For Tables Hack

    Hostile17, Sep 2, 2003, in forum: HTML
    Replies:
    2
    Views:
    520
    Philipp Lenssen
    Sep 2, 2003
  4. George
    Replies:
    9
    Views:
    4,900
    George
    Oct 25, 2004
  5. Jon

    Tables and borders

    Jon, May 17, 2005, in forum: HTML
    Replies:
    6
    Views:
    509
    Safalra
    May 20, 2005
Loading...

Share This Page