According to the
TablePlugin docs:
The type of data in the cell is determined automatically:
- date if format is:
- dd MMM YYYY - hh:mm (MMM is Jan, Feb, etc.)
- dd-MMM-YY or dd-MMM-YYYY (can be / or space in place of -) (MMM is Jan, Feb, etc)
- number is digits, with optional decimal point
- otherwise treated as text
However, the following data is not sorted correctly.
%TABLE{sort="on" initsort="1"}%
| *number* |
| 1 |
| 10.1 |
| 9.99 |
| 2 |
| 2.0 |
| 20 |
--
TWiki:Main/VickiBrown
- 08 Mar 2010
Fixed, in SVN trunk and 4.3 branch. Patch:
Index: lib/TWiki/Plugins/TablePlugin/Core.pm
===================================================================
--- lib/TWiki/Plugins/TablePlugin/Core.pm (revision 18367)
+++ lib/TWiki/Plugins/TablePlugin/Core.pm (working copy)
@@ -1,7 +1,7 @@
# Plugin for TWiki Enterprise Collaboration Platform, http://TWiki.org/
#
# Copyright (C) 2001-2003 John Talintyre, jet@cheerful.com
-# Copyright (C) 2001-2004 Peter Thoeny, peter@thoeny.org
+# Copyright (C) 2001-2010 Peter Thoeny, peter@thoeny.org
# Copyright (C) 2005-2006 TWiki Contributors
#
# This program is free software; you can redistribute it and/or
@@ -533,19 +533,13 @@
$year += 2000 if ( length($year) == 2 );
$date = timegm( 0, 0, 0, $1, $mon2num{$2}, $year - 1900 );
}
- elsif ( $text =~ /^\s*([0-9]+)(\.([0-9]))*(.?)*$/ ) {
+ elsif ( $text =~ /^\s*(([0-9]+)(\.([0-9]))?).*$/ ) {
# for example for attachment sizes: 1.1 K
# but also for other strings that start with a number
- my $num1 = $1 || 0;
- my $num2 = $2 || 0;
- $num = scalar("$num1$num2");
+ $num = $1;
}
- elsif ( $text =~ /^\s*[0-9]+(\.[0-9]+)?\s*$/ ) {
- $num = $text;
- }
-
return ( $num, $date );
}
--
TWiki:Main.PeterThoeny
- 09 Mar 2010
Also updated plugin package at
TWiki:Plugins/TablePlugin
--
TWiki:Main.PeterThoeny
- 09 Mar 2010