From: Micki K. <mic...@co...> - 2003-12-03 15:18:22
|
Hi phpwiki folks. After basing our documentation project (covering 1000s of pages) on the wiki, we're seeing amazing results. I'm available to discuss, etc., should anyone want to know more about how we use this awesome wiki. One thing I've been looking for is a way to associate a 'title' or 'caption' with a table (either OldStyle or NewStyle), so that the title obeys the proper 'keep-with', etc., when the title is printed in our pdf workflow. I'd like a modification that allows: - one extra parameter within the table plugin called 'caption', like <?plugin OldStyleTable caption="Caption Text" - which renders its contents as ...<table> '<caption>Caption Text</caption>' <tr>... at the beginning of the table, before the first <tr> tag. This is valid html, and it will allow seriously cool functionality in our printed workflow - titles will remain with tables, automatically generate 'list of tables' at the top of each doc, etc. Real MSWord-kiiling stuff. Anyone have any ideas, or willing to help? This will be the first hardcore mod of our system that we'd have to carry forward, and logically I'd much prefer for this useful if obscure mod to be in the core code if folks find value to it. If no one would like to work on it, I'll begin the process of figuring it out and will offer it back to the code base once we're done. Thanks to all for making phpwiki continue to rock. Micki At 8:04 PM -0800 12/2/03, php...@li... wrote: >Send Phpwiki-talk mailing list submissions to > php...@li... > >To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/phpwiki-talk >or, via email, send a message with subject or body 'help' to > php...@li... > >You can reach the person managing the list at > php...@li... > >When replying, please edit your Subject line so it is more specific >than "Re: Contents of Phpwiki-talk digest..." > > >Today's Topics: > > 1. PhpWiki at phpwiki.sf.net upgraded to 1.3.6+ (Carsten Klapp) > >--__--__-- > >Message: 1 >Date: Tue, 2 Dec 2003 21:39:01 -0500 >Cc: Steve Wainstead <sw...@pa...> >To: php...@li... >From: Carsten Klapp <car...@us...> >Subject: [Phpwiki-talk] PhpWiki at phpwiki.sf.net upgraded to 1.3.6+ > >Hi All, > >After a few days of online testing I'm satisfied that the latest >preview version of PhpWiki is working quite well on the Sourceforge >server, so I have upgraded the wiki there to 1.3.7pre: > >http://phpwiki.sourceforge.net/phpwiki/ > >The old PhpWiki version 1.3.2 is still accessible at the following URL: >http://phpwiki.sourceforge.net/phpwiki-wiki(1.3)/ > >If anyone encounters any serious problems with the new version of >PhpWiki running at SF or has any questions or concerns about the >transition/upgrade there, please drop me a line. > >Note that page alterations made under the old PhpWiki at the old (1.3) >URL will likely not be immediately visible when viewed with the new >version of PhpWiki, due to the new internal HTML caching scheme. > >:) >Carsten Klapp > > > > >--__--__-- > >_______________________________________________ >Phpwiki-talk mailing list >Php...@li... >https://lists.sourceforge.net/lists/listinfo/phpwiki-talk > > >End of Phpwiki-talk Digest -- Micki mailto:mic...@co... |
From: Carsten K. <car...@us...> - 2003-12-04 03:15:47
|
On Wednesday, December 3, 2003, at 10:18 am, Micki Kaufman wrote: > Hi phpwiki folks. > > After basing our documentation project (covering 1000s of pages) on > the wiki, we're seeing amazing results. I'm available to discuss, > etc., should anyone want to know more about how we use this awesome > wiki. > > One thing I've been looking for is a way to associate a 'title' or > 'caption' with a table (either OldStyle or NewStyle), so that the > title obeys the proper 'keep-with', etc., when the title is printed in > our pdf workflow. > > I'd like a modification that allows: > - one extra parameter within the table plugin called 'caption', like > > <?plugin OldStyleTable caption="Caption Text" > > - which renders its contents as > ...<table> > '<caption>Caption Text</caption>' > <tr>... > at the beginning of the table, before the first <tr> tag. > > This is valid html, and it will allow seriously cool functionality in > our printed workflow - titles will remain with tables, automatically > generate 'list of tables' at the top of each doc, etc. Real > MSWord-kiiling stuff. > > Anyone have any ideas, or willing to help? This will be the first > hardcore mod of our system that we'd have to carry forward, and > logically I'd much prefer for this useful if obscure mod to be in the > core code if folks find value to it. > > If no one would like to work on it, I'll begin the process of figuring > it out and will offer it back to the code base once we're done. > > Thanks to all for making phpwiki continue to rock. > > Micki Hi Micki, User-definable table captions sound like an awesome feature, I'm all for it! I'm not sure that this is something I can write, so if you or anyone else figures out how to do it (add table captions and/or table summary attribute) send me a patch and I'll gladly check it into the PhpWiki CVS for everyone to have. Table captions are already defined in lib/HtmlElement.php, so I hope it isn't too hard to add something to InlineParser or whatever else needs to be modified. Carsten Ref.: http://www.w3.org/TR/1999/REC-html401-19991224/struct/tables.html#h- 11.2.2 |
From: Micki K. <mic...@en...> - 2003-12-04 04:07:59
|
I'm looking at OldStyleTable and although I would hardly qualify as a phpwiki-savvy programmer, I think we can create a 'caption' attribute for OldStyleTable 's by straightforward, minimal mods to the OldStyleTable plugin. Not yet sure about NewStyleTables... one step at a time! Indeed, perhaps someone more savvy with the system can help enable those... do I hear rublings of the return of dairiki? :) Thanks, Micki At 10:15 PM -0500 12/3/03, Carsten Klapp wrote: >On Wednesday, December 3, 2003, at 10:18 am, Micki Kaufman wrote: > >>Hi phpwiki folks. >> >>After basing our documentation project (covering 1000s of pages) on >>the wiki, we're seeing amazing results. I'm available to discuss, >>etc., should anyone want to know more about how we use this awesome >>wiki. >> >>One thing I've been looking for is a way to associate a 'title' or >>'caption' with a table (either OldStyle or NewStyle), so that the >>title obeys the proper 'keep-with', etc., when the title is printed >>in our pdf workflow. >> >>I'd like a modification that allows: >>- one extra parameter within the table plugin called 'caption', like >> >> <?plugin OldStyleTable caption="Caption Text" >> >>- which renders its contents as >> ...<table> >> '<caption>Caption Text</caption>' >> <tr>... >> at the beginning of the table, before the first <tr> tag. >> >>This is valid html, and it will allow seriously cool functionality >>in our printed workflow - titles will remain with tables, >>automatically generate 'list of tables' at the top of each doc, >>etc. Real MSWord-kiiling stuff. >> >>Anyone have any ideas, or willing to help? This will be the first >>hardcore mod of our system that we'd have to carry forward, and >>logically I'd much prefer for this useful if obscure mod to be in >>the core code if folks find value to it. >> >>If no one would like to work on it, I'll begin the process of >>figuring it out and will offer it back to the code base once we're >>done. >> >>Thanks to all for making phpwiki continue to rock. >> >>Micki > > >Hi Micki, > >User-definable table captions sound like an awesome feature, I'm all for it! > >I'm not sure that this is something I can write, so if you or anyone >else figures out how to do it (add table captions and/or table >summary attribute) send me a patch and I'll gladly check it into the >PhpWiki CVS for everyone to have. > >Table captions are already defined in lib/HtmlElement.php, so I hope >it isn't too hard to add something to InlineParser or whatever else >needs to be modified. > >Carsten > >Ref.: >http://www.w3.org/TR/1999/REC-html401-19991224/struct/tables.html#h-11.2.2 -- Micki Kaufman Senior Project Manager Encoda Systems, Inc. mic...@en... phone: 212 303 4275 cell: 917 450-9137 http://www.encodasystems.com |
From: Reini U. <ru...@x-...> - 2003-12-04 14:08:21
|
That's IMHO the easiest way to do this. This patch supports some table arguments: cellspacing, cellpadding, border and caption. One could also use handle_plugin_args_cruft() to do the dirty work in the $lines loop. Please test this, I'm still a little bit rusty and don't dare yet to commit this. $ cvs diff lib/plugin/OldStyleTable.php Index: lib/plugin/OldStyleTable.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/plugin/OldStyleTable.php,v retrieving revision 1.7 diff -u -b -r1.7 OldStyleTable.php --- lib/plugin/OldStyleTable.php 21 Feb 2003 23:00:35 -0000 1.7 +++ lib/plugin/OldStyleTable.php 4 Dec 2003 14:05:10 -0000 @@ -59,21 +59,43 @@ } function getDefaultArguments() { - return array(); + return array( + 'caption' => '', + 'cellpadding' => '1', + 'cellspacing' => '1', + 'border' => '1', + ); + } + + function handle_plugin_args_cruft($argstr, $args) { + return; } function run($dbi, $argstr, $request, $basepage) { global $Theme; include_once('lib/InlineParser.php'); + $args = $this->getArgs($argstr, $request); + $default = $this->getDefaultArguments(); + foreach (array('cellpadding','cellspacing','border') as $arg) { + if (!is_numeric($args[$arg])) { + $args[$arg] = $default[$arg]; + } + } $lines = preg_split('/\s*?\n\s*/', $argstr); - $table = HTML::table(array('cellpadding' => 1, - 'cellspacing' => 1, - 'border' => 1)); - + $table = HTML::table(array('cellpadding' => $args['cellpadding'], + 'cellspacing' => $args['cellspacing'], + 'caption' => $args['caption'], + 'border' => $args['border'])); + $default_args = array_keys($default); foreach ($lines as $line) { if (!$line) continue; + if (strstr($line,"=")) { + $tmp = explode("=",$line); + if (in_array(trim($tmp[0]),$default_args)) + continue; + } if ($line[0] != '|') return $this->error(fmt("Line does not begin with a '|'.")); $table->pushContent($this->_parse_row($line, $basepage)); Carsten Klapp schrieb: > On Wednesday, December 3, 2003, at 10:18 am, Micki Kaufman wrote: > >> Hi phpwiki folks. >> >> After basing our documentation project (covering 1000s of pages) on >> the wiki, we're seeing amazing results. I'm available to discuss, >> etc., should anyone want to know more about how we use this awesome >> wiki. >> >> One thing I've been looking for is a way to associate a 'title' or >> 'caption' with a table (either OldStyle or NewStyle), so that the >> title obeys the proper 'keep-with', etc., when the title is printed >> in our pdf workflow. >> >> I'd like a modification that allows: >> - one extra parameter within the table plugin called 'caption', like >> >> <?plugin OldStyleTable caption="Caption Text" >> >> - which renders its contents as >> ...<table> >> '<caption>Caption Text</caption>' >> <tr>... >> at the beginning of the table, before the first <tr> tag. >> >> This is valid html, and it will allow seriously cool functionality in >> our printed workflow - titles will remain with tables, automatically >> generate 'list of tables' at the top of each doc, etc. Real >> MSWord-kiiling stuff. >> >> Anyone have any ideas, or willing to help? This will be the first >> hardcore mod of our system that we'd have to carry forward, and >> logically I'd much prefer for this useful if obscure mod to be in the >> core code if folks find value to it. >> >> If no one would like to work on it, I'll begin the process of >> figuring it out and will offer it back to the code base once we're done. >> >> Thanks to all for making phpwiki continue to rock. >> >> Micki > > > > Hi Micki, > > User-definable table captions sound like an awesome feature, I'm all > for it! > > I'm not sure that this is something I can write, so if you or anyone > else figures out how to do it (add table captions and/or table summary > attribute) send me a patch and I'll gladly check it into the PhpWiki > CVS for everyone to have. > > Table captions are already defined in lib/HtmlElement.php, so I hope it > isn't too hard to add something to InlineParser or whatever else needs > to be modified. > > Carsten > > Ref.: > http://www.w3.org/TR/1999/REC-html401-19991224/struct/tables.html#h- 11.2.2 -- Reini Urban http://xarch.tu-graz.ac.at/home/rurban/ |
From: Reini U. <ru...@x-...> - 2003-12-04 14:25:23
Attachments:
OldStyleTable.diff
|
The attached diff is better. It supports summary also, has no linebreaks and it also includes the new pgsrc of the description page. Reini Urban schrieb: > That's IMHO the easiest way to do this. > This patch supports some table arguments: cellspacing, cellpadding, > border and caption. > > One could also use handle_plugin_args_cruft() to do the dirty work in > the $lines loop. > Please test this, I'm still a little bit rusty and don't dare yet to > commit this. -- Reini Urban http://xarch.tu-graz.ac.at/home/rurban/ |
From: Carsten K. <car...@us...> - 2003-12-05 20:41:47
|
On Thursday, December 4, 2003, at 09:25 am, Reini Urban wrote: > The attached diff is better. > It supports summary also, has no linebreaks and > it also includes the new pgsrc of the description page. Hi, Thanks you two, for working on this! I applied the second patch to htdocs/phpwiki2/lib/plugin/OldStyleTable.php for testing. Only one problem, the caption does not show. :/ http://phpwiki.sourceforge.net/phpwiki/OldStyleTablePlugin I found the bug: caption is not an attribute of <table>, rather it must be the first sub-element (if present). So it should be like this: <table summary="summary"> <caption>Table caption</caption> <tr><td>first row</td></tr> http://www.w3.org/TR/1999/REC-html401-19991224/struct/tables.html Cheers, Carsten Here's the updated patch: (some of it is text reformatting) Index: OldStyleTable.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/plugin/OldStyleTable.php,v retrieving revision 1.7 diff -U2 -r1.7 OldStyleTable.php --- OldStyleTable.php 21 Feb 2003 23:00:35 -0000 1.7 +++ OldStyleTable.php 5 Dec 2003 20:37:28 -0000 @@ -1,4 +1,5 @@ <?php // -*-php-*- rcs_id('$Id: OldStyleTable.php,v 1.7 2003/02/21 23:00:35 dairiki Exp $'); + /** Copyright 1999, 2000, 2001, 2002 $ThePhpWikiProgrammingTeam @@ -26,5 +27,5 @@ * Usage: * <pre> - * <?plugin OldStyleTable + * <?plugin OldStyleTable border||=0 summary="" * || __Name__ |v __Cost__ |v __Notes__ * | __First__ | __Last__ @@ -51,5 +52,5 @@ function getDescription() { - return _("Layout tables using the old markup style."); + return _("Layout tables using the old markup style."); } @@ -60,5 +61,15 @@ function getDefaultArguments() { - return array(); + return array( + 'caption' => '', + 'cellpadding' => '1', + 'cellspacing' => '1', + 'border' => '1', + 'summary' => '', + ); + } + + function handle_plugin_args_cruft($argstr, $args) { + return; } @@ -67,12 +78,33 @@ include_once('lib/InlineParser.php'); + $args = $this->getArgs($argstr, $request); + $default = $this->getDefaultArguments(); + foreach (array('cellpadding', 'cellspacing', 'border') as $arg) { + if (!is_numeric($args[$arg])) { + $args[$arg] = $default[$arg]; + } + } $lines = preg_split('/\s*?\n\s*/', $argstr); - $table = HTML::table(array('cellpadding' => 1, - 'cellspacing' => 1, - 'border' => 1)); + $table_args = array(); + $default_args = array_keys($default); + foreach ($default_args as $arg) { + if ($args[$arg] == '' and $default[$arg] == '') + continue; // ignore '' arguments + $table_args[$arg] = $args[$arg]; + } + unset($table_args['caption']); + $table = HTML::table($table_args); + if ($caption = $args['caption']) { + $table->pushContent(HTML::caption(array('align'=>'top'), $caption)); + } foreach ($lines as $line) { if (!$line) continue; + if (strstr($line, "=")) { + $tmp = explode("=", $line); + if (in_array(trim($tmp[0]), $default_args)) + continue; + } if ($line[0] != '|') return $this->error(fmt("Line does not begin with a '|'.")); @@ -85,6 +117,5 @@ function _parse_row ($line, $basepage) { $brkt_link = "\\[ .*? [^]\s] .*? \\]"; - $cell_content = "(?: [^[] | ".ESCAPE_CHAR."\\[ | $brkt_link )*?"; - + $cell_content = "(?: [^[] | " . ESCAPE_CHAR . "\\[ | $brkt_link )*?"; preg_match_all("/(\\|+) (v*) ([<>^]?) \s* ($cell_content) \s* (?=\\||\$)/x", $line, $matches, PREG_SET_ORDER); @@ -116,4 +147,8 @@ } }; + +// Caption & summary patch from [phpwiki-talk] by MickiKaufman and +// ReiniUrban 2003-12-04. Not yet checked into CVS. + // $Log: OldStyleTable.php,v $ |