]> sipb.mit.edu Git - ikiwiki.git/commitdiff
* table plugin: Actually specify the delimiter when parsing CSV.
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sun, 16 Sep 2007 19:35:16 +0000 (19:35 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sun, 16 Sep 2007 19:35:16 +0000 (19:35 +0000)
* table plugin: The previous version broke WikiLinks inside quoted values.
  Fix this by linkifying CSV data after parsing it, while DSV data is still
  linkified before parsing.

IkiWiki/Plugin/table.pm
debian/changelog
doc/plugins/table.mdwn

index be97137ededae7e099906cad459f26a41c1eb395..e8df174871b7bde8383fd3f93131958b9e2a9e25 100644 (file)
@@ -23,10 +23,6 @@ sub preprocess (@) { #{{{
                }
                $params{data} = readfile(srcfile($params{file}));
        }
-       else {
-               $params{data} = IkiWiki::linkify($params{page},
-                       $params{destpage}, $params{data});
-       }
 
        if (lc $params{format} eq 'auto') {
                # first try the more simple format
@@ -42,8 +38,24 @@ sub preprocess (@) { #{{{
        if (lc $params{format} eq 'csv') {
                @data=split_csv($params{data},
                        defined $params{delimiter} ? $params{delimiter} : ",",);
+               # linkify after parsing since html link quoting can
+               # confuse CSV parsing
+               if (! exists $params{file}) {
+                       @data=map {
+                               [ map {
+                                       IkiWiki::linkify($params{page},
+                                               $params{destpage}, $_);
+                               } @$_ ]
+                       } @data;
+               }
        }
        elsif (lc $params{format} eq 'dsv') {
+               # linkify before parsing since wikilinks can contain the
+               # delimiter
+               if (! exists $params{file}) {
+                       $params{data} = IkiWiki::linkify($params{page},
+                               $params{destpage}, $params{data});
+               }
                @data=split_dsv($params{data},
                        defined $params{delimiter} ? $params{delimiter} : "|",);
        }
index 8913d37cc4cecf28fde795e44669705344da78bd..e55419f9120373895cf96bcf9e0a071221256a88 100644 (file)
@@ -8,9 +8,12 @@ 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.
+  * table plugin: Actually specify the delimiter when parsing CSV.
+  * table plugin: The previous version broke WikiLinks inside quoted values.
+    Fix this by linkifying CSV data after parsing it, while DSV data is still
+    linkified before parsing.
 
- -- Joey Hess <joeyh@debian.org>  Sun, 16 Sep 2007 15:07:35 -0400
+ -- Joey Hess <joeyh@debian.org>  Sun, 16 Sep 2007 15:34:17 -0400
 
 ikiwiki (2.7) unstable; urgency=low
 
index 89bec987c4b0ae42c2342c45b5291ebca5c817da..6920c8f8080e53175afc9ccb5ab3c70519564a72 100644 (file)
@@ -6,16 +6,6 @@ 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="""