[pmwiki-users] tabtable patch to insert ! in header rows
Russ Fink
russfink at hotmail.com
Tue Jan 23 11:36:07 CST 2007
Hello,
I'm enclosing a patch to the latest version of tabtable.zip (see Excel Paste
cookbook recipe). It puts the "!" in the first row of the pasted output,
whereas the existing tabtable script did not.
Once you make this patch, the first row will always be formatted with
"||!foo" instead of "||foo". If you don't want this for a given table, you
can always insert a new row of dummy entries above your intended first row
in your source spreadsheet, and make sure that gets copied in. After you
excel-paste, then you can delete the dummy row.
To install this patch, cd into the cookbook area and execute "patch <
THEPATCH" where you put in this code below into a file called THEPATCH.
I'm posting this hopefully so Patrick can review it and consider including
it in tabtable. There may be reasons why this wasn't in there, but I think
it is a useful feature to have. (Also, you can modify the tabtable css
classes and make the headers look just the same as the data, if you don't
want this feature to appear to do anything.)
--- tabtable.php 2005-02-25 10:30:23.000000000 -0700
+++ tabtable-raf.php 2007-01-23 10:21:41.000000000 -0700
@@ -50,15 +50,17 @@
while ($row && count(end($row))==0) { array_pop($row); $x = "\n".$x; }
if ($row) {
$y[] = "||class='tabtable'";
+ $_first = '!'; /* RAF * first pass use heading formats */
while ($row) {
$col = array_shift($row);
$r = '||';
for($i=0; $i<count($wid); $i++) {
$m = preg_match('/^\\s*\\(?-?[\\d,]+\\.?\\d*\\)?\\s*$/',
@$col[$i])
- ? " %{$wid[$i]}s||" : "%-{$wid[$i]}s ||";
+ ? "$_first %{$wid[$i]}s||" : "$_first%-{$wid[$i]}s ||"; /*
RAF */
$r .= sprintf($m,@$col[$i]);
}
$y[] = $r;
+ $_first = ''; /* RAF */
}
$row = array(); $wid = array();
}
The lines with RAF have changed.
PS: This is a personal communication from an account that has keyword-based
spam filtering enabled. Please preserve the original subject line when
replying. (Adding "Re:" is okay.)
_________________________________________________________________
FREE online classifieds from Windows Live Expo buy and sell with people
you know
http://clk.atdmt.com/MSN/go/msnnkwex0010000001msn/direct/01/?href=http://expo.live.com?s_cid=Hotmail_tagline_12/06
More information about the pmwiki-users
mailing list