textile / python-textile

A Python port of Textile, A humane web text generator
Other
68 stars 23 forks source link

Tables don't output thead #31

Closed jimktrains closed 8 years ago

jimktrains commented 8 years ago

Table headers are not wrapped in a thead tag. Libraries such as DataTables.net require a thead section. Additionally, it is a more proper and semantic way of formatting a table.

>>> import textile
 >>> a = """
 ... |_. header|
 ... |row 1|
 ... """
 >>> print(textile.textile(a))
    <table>
        <tr>
            <th>header</th>
        </tr>
        <tr>
            <td>row 1</td>
        </tr>
    </table>

expected output would be:

    <table>
        <thead>
            <tr>
                <th>header</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>row 1</td>
            </tr>
        <tbody>
    </table>

version

 % pip3 show textile
 ---
 Metadata-Version: 2.0
 Name: textile
 Version: 2.3.3
ikirudennis commented 8 years ago

Hi, there's actually a special syntax for this functionality. I believe the following should get you what you're looking for:

|^.
|_. header|
|-.
|row 1|

It produces:

<table>
    <thead>
        <tr>
            <th>header</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>row 1</td>
        </tr>
    </tbody>
</table>

Does that fit your use case?

jimktrains commented 8 years ago

Yes it does! Somehow I've never seen the |^ in the docs! Thanks!

On Thu, Jul 21, 2016 at 9:50 AM, Dennis Burke notifications@github.com wrote:

Hi, there's actually a special syntax https://txstyle.org/doc/15/tables for this functionality. I believe the following should get you what you're looking for:

|^. |_. header| |-. |row 1|

It produces:

header
row 1

Does that fit your use case?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/textile/python-textile/issues/31#issuecomment-234258877, or mute the thread https://github.com/notifications/unsubscribe-auth/AACfkl0y20LujgrHTLNxawe5c3ksP_xiks5qX3kdgaJpZM4JRfUZ .