]> sipb.mit.edu Git - ikiwiki.git/commitdiff
* table plugin: Actually specify the delimiter.
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sun, 16 Sep 2007 19:18:02 +0000 (19:18 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sun, 16 Sep 2007 19:18:02 +0000 (19:18 +0000)
IkiWiki/Plugin/table.pm
debian/changelog
doc/plugins/table.mdwn

index 01ba5e5042360d218d422e56296a6161552ff8fe..be97137ededae7e099906cad459f26a41c1eb395 100644 (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");
index 66eb8af27c5dee1a7a832f0afabe8fbf0974ce60..8913d37cc4cecf28fde795e44669705344da78bd 100644 (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
 
index 6920c8f8080e53175afc9ccb5ab3c70519564a72..89bec987c4b0ae42c2342c45b5291ebca5c817da 100644 (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="""