|
Cookbook /
SimplifiedAdvancedTableDirectivesSummary: Simplify Advanced Directive Syntax
Version: 2.4
Prerequisites: AdvancedTableDirectives
Status: working but still testing
Maintainer:GNUZoo
Downloads: SimplifiedAdvancedTableDirectives.phpΔ
Questions answered by this recipe
DescriptionThis recipe will make table directives much much easier to use - they will be easier to understand and typing them in will be easier. Another recipe that will enhance SimplifiedAdvancedTableDirectives SourceCodeHorizontalLines. Table Directives code that looks like this: (:table border=1:) (:head align=center:)animal (:head align=center:)food (:cellnr align=center:)cat (:cell align=center:)catfood (:cellnr:)dog (:cell:)dogfood (:cellnr align=right:)bird (:cell align=right:)birdfood (:tableend:) can look like this (this example uses recipe SourceCodeHorizontalLines): ------------------------------------------ ------------------------------------------ [table border=1] --------------------- [row] [!c]animal [!c]food --------------------- [row] [c]cat [c]catfood ------------ [row] []dog []dogfood ------------ [row] [r]bird [r]birdfood --------------------- [tableend] ------------------------------------------ ------------------------------------------ InstallationCopy AdvancedTableDirectives.phpΔ and SimplifiedAdvancedTableDirectives.phpΔ to your cookbook directory. (AdvancedTableDirectives is required to use this recipe). In your config.php enter: include_once("cookbook/AdvancedTableDirectives.php");
include_once("cookbook/SimplifiedAdvancedTableDirectives.php");
or in your farmconfig.php enter: include_once(" $FarmD/cookbook/AdvancedTableDirectives.php");
include_once(" $FarmD/cookbook/SimplifiedAdvancedTableDirectives.php");
NotesAny attributes will work within the SimplifiedAdvancedTableDirectives. Automatic zebra formatting (see FormattingTables) as well as any other table functions will work. Tables
[table] = (:table:) [tableend] = (:tableend:)Caption [caption] = (:caption:) [captionc] = (:caption style="text-align:center:) [captionr] = (:caption style="text-align:right:) [captionl] = (:caption style="text-align:left:)Headers [!] = (:head:) [!c] = (:head align=center:) [!r] = (:head align=right:) [!l] = (:head align=left:)Rows [row] = (:row:)Cells [] = (:cell:)
[ colspan=2] = (:cell colspan=2:) <- notice space before attributes
[c] = (:cell align=center:)
[r] = (:cell align=right:)
[l] = (:cell align=left:)
Cell with row number
[r#] = (:cellr#:) [r#c] = (:cellr# align=center:) [r#r] = (:cellr# align=right:) [r#l] = (:cellr# align=left:)Cell with column number [c#] = (:cellc#:) [c#c] = (:cellc# align=center:) [c#r] = (:cellc# align=right:) [c#l] = (:cellc# align=left:) [#] [#r] [#l] [#c] (these also show a cell with column number)Cell with auto-incrementing number - reset to 1 with new table [i#] = (:celli#:) [i#c] = (:celli# align=center:) [i#r] = (:celli# align=right:) [i#l] = (:celli# align=left:)Cell with auto-incrementing column number - reset to 1 with new row or table [ic#] = (:cellic#:) [ic#c] = (:cellic# align=center:) [ic#r] = (:cellic# align=right:) [ic#l] = (:cellic# align=left:)Cell with auto-incrementing row number - reset to 1 with new table [ir#] = (:cellir#:) [ir#c] = (:cellir# align=center:) [ir#r] = (:cellir# align=right:) [ir#l] = (:cellir# align=left:) Automatic zebra formatting (mostly used for coloring) can be applied as well. In this example the table header row will have a lightblue background and the other table rows will have alternating lightgreen and lightyellow background colors. Put into config.php:
$TableRowIndexMax = 2; $TableRowAttrFmt = "class='row\$TableRowIndex'" ; $TableCellAttrFmt = "class='col\$TableCellCount'"; Put into cascading style sheet:
table th { background-color:#99ccff; }
table tr.row1 { background-color:#ffff99 ; }
table tr.row2 { background-color:#ccffcc; }
table td { line-height: 12px; }
For more information about formatting tables see FormattingTables. Release NotesThis program is free software. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation http://www.fsf.org either version 2 of the License, or (at your option) any later version. Copyright 2007 by GNUZoo (guru@gnuzoo.org) Please donate to the author at url: http://gnuzoo.org/GNUZooPayPal
CommentsHorizontal alignment of numbered rows I will have to fix this. Thanks for finding it! GNUZoo
This has been fixed. This is a design change. It was trying to specify cell attributes from a row. Now they must be done separately. [row#] has been deprecated. Replace it with "[row] and [r#]". For right justification use "[row] [r#r]". GNUZoo
Vertical alignment I will have to look at this further. I was more viewing it as raw tables, not necessarily to be compatible with PMWiki. I might likely do this though. GNUZoo
This has been updated to be compatible with PMWiki. Note that the update was in AdvancedTableDirectives which is a prerequisite for this recipe. There were recently updates to this recipe too. GNUZoo
Some attributes not interpreted A space is needed because it interprets the first "c" meaning to center. I do not know regular expressions well enough to differentiate between "[c" and "[colspan" and "c colspan". The same is true for "[r" and "[l" and "[!c" and "[!r" and "[!l" and "[!". GNUZoo
[row#] has been deprecated but will remain in code for backward compatibility
[rowend] has been deprecated because it is automatic
Additional table tags at end of page I could not duplicate this behavior. I would suggest you update to the latest version of AdvancedTableDirectives and SimplifiedAdvancedTableDirectives. I can see nowhere in the code this could be happening now. If the problem persists please contact me via guru@gnuzoo.org GNUZoo
Updated to newest code and problem is resolved. I should have done that in the first place--I didn't realize that my files were outdated. GNUZoo rules.
Incompatible with MarkupExtensions I will filter for this in the next version of SimplifiedAdvancedTableDirectives which should be out soon. BTW, the "^" character is a regular expression anchor to the beginning of the line, not to the character "^". Thanks GNUZoo
Clashes with use of single square-brackets elsewhere '/(?<!\\[)\\[(table(?:end)?|caption[rlc]?|row#|row(?:end)?|![rlc]?|#[rlc]?|[rci]#[rlc]?|i[cr]#[rlc]?|r|l|c| |\\s+[^\\]]+?)?(\\s.*?)?\\]/ie'
See AlsoContributors |