Modify

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#13597 closed enhancement (fixed)

Accept rows with missing columns

Reported by: anonymous Owned by: jonny
Priority: normal Component: TablePlugin
Severity: normal Keywords:
Cc: Trac Release: 1.3

Description

I made a small hack to make TablePlugin accept rows that don't contain all columns.

This is a correct syntax, without my fix:

{{{
#!styledtable
@table (@default)

@column task
@column details
@column status

#! Header row
@task: Task
@details: Details
@status: Status

#! Rows
@task: Task 1
@details: Details of Task 1.
@status: Complete

@task: Task 2
@details: Details of Task 2.
@status: Complete
}}}

However, if one were to leave out (by mistake or choice) a column somewhere, an unclear error message would show instead.

So I adjusted the code to allow for missing columns, which makes the missing cell just show up as empty. To make this work one needs to add @endrow to end of row. If one doesn't do that, the plugin works just as before, it's backward compatible. This means that if one have a lot of columns, where many cells in rows are empty, it will be drastically shorter to work with the syntax for it.

With my adjustment, this is working just fine:

{{{
#!styledtable
@table (@default)

@column task
@column details
@column status

#! Header row
@task: Task
@details: Details
@status: Status

#! Rows
@task: Task 1
@details: Details of Task 1.
@status: Complete

@task: Task 2
@endrow
}}}

I haven't got the first clue on how to use SVN, I hope it's ok to just attach my modified code to this ticket and hopefully @rjollos will consider and possibly act on it.

(Sidenote: I'm using this with Trac 1.3.6 so I can confirm that this version (and the one already published) works fine.)

Attachments (1)

table.py (16.2 KB) - added by anonymous 5 years ago.
Updated table.py

Download all attachments as: .zip

Change History (5)

Changed 5 years ago by anonymous

Attachment: table.py added

Updated table.py

comment:1 in reply to:  description Changed 5 years ago by Ryan J Ollos

Replying to anonymous:

I haven't got the first clue on how to use SVN,

See TracDev/SubmittingPatches.

$ svn co ...
$ ed ...
$ svn diff > patch

comment:2 Changed 5 years ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

In 17473:

Interpolate row with empty cells when @endrow encountered

Fixes #13597.

comment:3 Changed 5 years ago by Ryan J Ollos

Please document on the TablePlugin page.

comment:4 Changed 5 years ago by anonymous

Please document on the TablePlugin page.

Done. And thank you for acting on this...


See ​TracDev/SubmittingPatches.

...and thank you for showing that page, I had completely missed it.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain jonny.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.