* table plugin: Actually specify the delimiter.

master
joey 2007-09-16 19:18:02 +00:00
parent 2ab0fdeffc
commit 6bcc3339d9
3 changed files with 17 additions and 4 deletions

View File

@ -40,10 +40,12 @@ sub preprocess (@) { #{{{
my @data;
if (lc $params{format} eq 'csv') {
@data=split_csv($params{data}, $params{delimiter});
@data=split_csv($params{data},
defined $params{delimiter} ? $params{delimiter} : ",",);
}
elsif (lc $params{format} eq 'dsv') {
@data=split_dsv($params{data}, $params{delimiter});
@data=split_dsv($params{data},
defined $params{delimiter} ? $params{delimiter} : "|",);
}
else {
return "[[table ".gettext("unknown data format")."]]";
@ -95,7 +97,7 @@ sub split_csv ($$) { #{{{
eval q{use Text::CSV};
error($@) if $@;
my $csv = Text::CSV->new({
sep_char => defined $delimiter ? $delimiter : ",",
sep_char => $delimiter,
binary => 1,
allow_loose_quotes => 1,
}) || error("could not create a Text::CSV object");

3
debian/changelog vendored
View File

@ -8,8 +8,9 @@ ikiwiki (2.8) UNRELEASED; urgency=low
be shown in the page footer. HTML will also be inserted that should
support the rel=license microformat as well as the HTML spec's
rel=copyright.
* table plugin: Actually specify the delimiter.
-- Joey Hess <joeyh@debian.org> Fri, 14 Sep 2007 13:05:22 -0400
-- Joey Hess <joeyh@debian.org> Sun, 16 Sep 2007 15:07:35 -0400
ikiwiki (2.7) unstable; urgency=low

View File

@ -6,6 +6,16 @@ or DSV (delimiter-separated values) format.
It needs the perl module [[cpan Text::CSV]] for the CSV data.
[[table data="""
"foo",[[joey]],"bar"
"bar",[[joeyno]], foo"
"""]]
[[table data="""
foo|[[joey]]|bar
bar|[[joeyno]]|foo
"""]]
## examples
\[[table data="""