From: joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Date: Sun, 16 Sep 2007 19:18:02 +0000 (+0000)
Subject: * table plugin: Actually specify the delimiter.
X-Git-Tag: 2.8~2
X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/6bcc3339d911cd6c0095a3ed3eacf8560c458d01

* table plugin: Actually specify the delimiter.
---

diff --git a/IkiWiki/Plugin/table.pm b/IkiWiki/Plugin/table.pm
index 01ba5e504..be97137ed 100644
--- a/IkiWiki/Plugin/table.pm
+++ b/IkiWiki/Plugin/table.pm
@@ -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");
diff --git a/debian/changelog b/debian/changelog
index 66eb8af27..8913d37cc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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
 
diff --git a/doc/plugins/table.mdwn b/doc/plugins/table.mdwn
index 6920c8f80..89bec987c 100644
--- a/doc/plugins/table.mdwn
+++ b/doc/plugins/table.mdwn
@@ -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="""