X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/657bf7846d129b2ff0ab0d2264610c689d4ecd02..42c91cab61f3881dc758180ace5b7627809728ed:/IkiWiki/Plugin/table.pm diff --git a/IkiWiki/Plugin/table.pm b/IkiWiki/Plugin/table.pm index 55d78a3e1..479f3d745 100644 --- a/IkiWiki/Plugin/table.pm +++ b/IkiWiki/Plugin/table.pm @@ -4,22 +4,22 @@ package IkiWiki::Plugin::table; use warnings; use strict; use Encode; -use IkiWiki 2.00; +use IkiWiki 3.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "table", call => \&getsetup); hook(type => "preprocess", id => "table", call => \&preprocess); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} -sub preprocess (@) { #{{{ +sub preprocess (@) { my %params =( format => 'auto', header => 'row', @@ -74,7 +74,7 @@ sub preprocess (@) { #{{{ } my $header; - if (lc($params{header}) eq "row" || lc($params{header}) eq "yes") { + if (lc($params{header}) eq "row" || IkiWiki::yesno($params{header})) { $header=shift @data; } if (! @data) { @@ -102,16 +102,16 @@ sub preprocess (@) { #{{{ else { return $html; } -} #}}} +} -sub is_dsv_data ($) { #{{{ +sub is_dsv_data ($) { my $text = shift; my ($line) = split(/\n/, $text); return $line =~ m{.+\|}; } -sub split_csv ($$) { #{{{ +sub split_csv ($$) { my @text_lines = split(/\n/, shift); my $delimiter = shift; @@ -137,9 +137,9 @@ sub split_csv ($$) { #{{{ } return @data; -} #}}} +} -sub split_dsv ($$) { #{{{ +sub split_dsv ($$) { my @text_lines = split(/\n/, shift); my $delimiter = shift; $delimiter="|" unless defined $delimiter; @@ -150,9 +150,9 @@ sub split_dsv ($$) { #{{{ } return @data; -} #}}} +} -sub genrow ($@) { #{{{ +sub genrow ($@) { my %params=%{shift()}; my $elt = shift; my @data = @_; @@ -190,6 +190,6 @@ sub genrow ($@) { #{{{ push @ret, "\t\t"; return @ret; -} #}}} +} 1