I haven't looked too closely at your API, just at your output -- but i definitely think a majority of this should be done with CSS ... the value adds you can provide are:
- generating the xhtml tables from the raw data
- providing a rule based interface to add a CSS class to rows/columns/cells based on coderefs or regexes
- automaticaly sorting the data as specified
...i would leave the concrete specifics of how the rows/columns/cells look to a user supplied CSS. That way if i decide i want all the negative numbers to be in red instead of bold, i can just change my (possibly site global) CSS file, instead of editing the script that calls your module.
Your mechanism for prioritizing rules is interesting ... but i would avoid naming them red/ylw/grn ... it's too easy for people to assume those are color specific and not realize they relate to precedence. I would just have a precedence argument that is numeric, higher number wins (or lower, your choice) .. the interesting cases are:
- multiple rules have the same precedence? ... in that case i would just use all the CSS classes for that rule (it's legal to have multiple class names separated by space, the browser applies them all)
- should cell rules override row rules override column rules? .. i would say not necessarily, you can allow undef as a precedence and use that to indicate that it's applied no matter what other rules are picked based on their precedence (ie: it's equal to whatever the highest value found is). ... perhaps an optional method could be called by the client specifying an uber-precedence of row/col/cell (if this method is never used, their rules are all equal)
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|