X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/fd458422b16312fd396fa47560a58a8da7083692..d9b1e10d7217d6f9e1738cdc33c4e08cdc709d22:/doc/todo/support_multi-row_table_headers.mdwn diff --git a/doc/todo/support_multi-row_table_headers.mdwn b/doc/todo/support_multi-row_table_headers.mdwn index 86c6e9d70..6f13bbb23 100644 --- a/doc/todo/support_multi-row_table_headers.mdwn +++ b/doc/todo/support_multi-row_table_headers.mdwn @@ -1,4 +1,4 @@ -[[!template id=gitbranch branch=jmtd/table_headerblock author="[[Jon]]"]] +[[!template id=gitbranch branch=jon/table_headerblock author="[[Jon]]"]] It would be great if it were possible to support multi-row table headers in the [[plugins/table]] plugin, so you could do e.g. \[[!table header=""" @@ -11,3 +11,69 @@ It would be great if it were possible to support multi-row table headers in the -- [[Jon]] [[!tag wishlist patch]] + +> This seems like weird overloading of the header parameter - it's +> table data, except when it isn't. + +> > My first cut (now rebased out of existence I think) introduced a +> > new "headerblock" parameter, but trying to clearly document the +> > interaction of data/headerblock/header parameters was too awkward. -- [[Jon]] + +> Perhaps +> something like this would be easier to use in practice? +> (and also more featureful :-) ) +> +> \[[!table header="2 rows 1 column" data=""" +> Name | Platform || +> | Windows | Mac | Linux +> ikiwiki | no | yes | yes +> Starcraft | yes | yes | via Wine +> """]] + +> > Thanks for your prompt feedback! +> > +> > This would probably be good, yes, and having mixed row/column headers is +> > definitely a nice-to-have. I don't relish the prospect of writing the parser +> > but I see you've made a stab already... +> > +> > One thing you'd lose, but it's debatable whether this is valuable, would be +> > to have the header defined in the directive, and the remaining table data +> > declared in an external CSV. -- [[Jon]] + +> intended to be rendered like +> +> +> +> +> +> +>
NamePlatform
WindowsMacLinux
ikiwikinoyesyes
Starcraftyesyesvia Wine
+> +> (Deliberately switching to plain-text to make it more obvious +> what's a `` and what's ``.) +> +> Vague pseudocode for parsing `headers` +> (possibly even valid Perl, I'm not sure): +> +> my ($header_rows, $header_cols); +> while ($header =~ s/(\d*)\W*(\w+)//) { +> my $n = ($1 or 0); +> my $what = $2; +> if ($what =~ m/rows?/) { +> $header_rows = $n; +> } +> elif ($what =~ m/col(?:umn)?s?/) { +> $header_cols = $n; +> } +> } +> +> and it would even be fairly easy to extend to support +> `(first|last|)\W*(\d*)\W*(\w+)` later, e.g. +> `header="1 row, first 2 cols, last column"`. +> +> --[[smcv]] + +> > To be clear I think your suggestion is a good one, but my hack has +> > addressed my immediate need so it's the one I'm deploying at $ork for the +> > time being. I'm unlikely to have time to implement this solution in the +> > near future. -- [[Jon]]