From 23df5cacd7e73e61ece11259ddc89b82ad23ac2f Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Tue, 20 Apr 2010 23:07:16 +0200 Subject: [PATCH] Whitespace cleanup --- IkiWiki.pm | 90 +++++++++++++++++++++---------------------- IkiWiki/Plugin/tag.pm | 6 +-- 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/IkiWiki.pm b/IkiWiki.pm index b37b1f344..40717b5c2 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -329,7 +329,7 @@ sub getsetup () { rebuild => 0, }, ENV => { - type => "string", + type => "string", default => {}, description => "environment variables", safe => 0, # paranoia @@ -505,7 +505,7 @@ sub checkconfig () { define_gettext(); } } - + if (! defined $config{wiki_file_regexp}) { $config{wiki_file_regexp}=qr/(^[$config{wiki_file_chars}]+$)/; } @@ -529,7 +529,7 @@ sub checkconfig () { if ($config{cgi} && ! length $config{url}) { error(gettext("Must specify url to wiki with --url when using --cgi")); } - + $config{wikistatedir}="$config{srcdir}/.ikiwiki" unless exists $config{wikistatedir} && defined $config{wikistatedir}; @@ -570,7 +570,7 @@ sub loadplugins () { foreach my $plugin (@{$config{default_plugins}}, @{$config{add_plugins}}) { loadplugin($plugin); } - + if ($config{rcs}) { if (exists $hooks{rcs}) { error(gettext("cannot use multiple rcs plugins")); @@ -685,7 +685,7 @@ sub isinternal ($) { sub pagetype ($) { my $file=shift; - + if ($file =~ /\.([^.]+)$/) { return $1 if exists $hooks{htmlize}{$1}; } @@ -735,7 +735,7 @@ sub targetpage ($$;$) { my $page=shift; my $ext=shift; my $filename=shift; - + if (defined $filename) { return $page."/".$filename.".".$ext; } @@ -749,7 +749,7 @@ sub targetpage ($$;$) { sub htmlpage ($) { my $page=shift; - + return targetpage($page, $config{htmlext}); } @@ -791,7 +791,7 @@ sub readfile ($;$$) { if (-l $file) { error("cannot read a symlink ($file)"); } - + local $/=undef; open (my $in, "<", $file) || error("failed to read $file: $!"); binmode($in) if ($binary); @@ -808,7 +808,7 @@ sub readfile ($;$$) { sub prep_writefile ($$) { my $file=shift; my $destdir=shift; - + my $test=$file; while (length $test) { if (-l "$destdir/$test") { @@ -837,14 +837,14 @@ sub writefile ($$$;$$) { my $content=shift; my $binary=shift; my $writer=shift; - + prep_writefile($file, $destdir); - + my $newfile="$destdir/$file.ikiwiki-new"; if (-l $newfile) { error("cannot write to a symlink ($newfile)"); } - + my $cleanup = sub { unlink($newfile) }; open (my $out, '>', $newfile) || error("failed to write $newfile: $!", $cleanup); binmode($out) if ($binary); @@ -855,7 +855,7 @@ sub writefile ($$$;$$) { print $out $content or error("failed writing to $newfile: $!", $cleanup); } close $out || error("failed saving $newfile: $!", $cleanup); - rename($newfile, "$destdir/$file") || + rename($newfile, "$destdir/$file") || error("failed renaming $newfile to $destdir/$file: $!", $cleanup); return 1; @@ -891,7 +891,7 @@ sub will_render ($$;$) { sub bestlink ($$) { my $page=shift; my $link=shift; - + my $cwd=$page; if ($link=~s/^\/+//) { # absolute links @@ -928,7 +928,7 @@ sub bestlink ($$) { sub isinlinableimage ($) { my $file=shift; - + return $file =~ /\.(png|gif|jpg|jpeg)$/i; } @@ -977,7 +977,7 @@ sub baseurl (;$) { my $page=shift; return "$config{url}/" if ! defined $page; - + $page=htmlpage($page); $page=~s/[^\/]+$//; $page=~s/[^\/]+\//..\//g; @@ -1036,7 +1036,7 @@ sub urlto ($$;$) { my $to=shift; my $from=shift; my $absolute=shift; - + if (! length $to) { return beautify_urlpath(baseurl($from)."index.$config{htmlext}"); } @@ -1077,11 +1077,11 @@ sub htmllink ($$$;@) { else { $linktext=pagetitle(basename($link)); } - + return "$linktext" if length $bestlink && $page eq $bestlink && ! defined $opts{anchor}; - + if (! $destsources{$bestlink}) { $bestlink=htmlpage($bestlink); @@ -1096,10 +1096,10 @@ sub htmllink ($$$;@) { "\" rel=\"nofollow\">?$linktext" } } - + $bestlink=abs2rel($bestlink, dirname(htmlpage($page))); $bestlink=beautify_urlpath($bestlink); - + if (! $opts{noimageinline} && isinlinableimage($bestlink)) { return "\"$linktext\""; } @@ -1162,9 +1162,9 @@ sub htmlize ($$$$) { my $destpage=shift; my $type=shift; my $content=shift; - + my $oneline = $content !~ /\n/; - + if (exists $hooks{htmlize}{$type}) { $content=$hooks{htmlize}{$type}{call}->( page => $page, @@ -1182,7 +1182,7 @@ sub htmlize ($$$$) { content => $content, ); }); - + if ($oneline) { # hack to get rid of enclosing junk added by markdown # and other htmlizers/sanitizers @@ -1205,7 +1205,7 @@ sub linkify ($$$) { content => $content, ); }); - + return $content; } @@ -1314,7 +1314,7 @@ sub preprocess ($$$;$$) { return "[[$prefix$command $params]]"; } }; - + my $regex; if ($config{prefix_directives}) { $regex = qr{ @@ -1373,7 +1373,7 @@ sub filter ($$$) { my $content=shift; run_hooks(filter => sub { - $content=shift->(page => $page, destpage => $destpage, + $content=shift->(page => $page, destpage => $destpage, content => $content); }); @@ -1389,7 +1389,7 @@ sub check_canedit ($$$;$) { my $q=shift; my $session=shift; my $nonfatal=shift; - + my $canedit; run_hooks(canedit => sub { return if defined $canedit; @@ -1413,7 +1413,7 @@ sub check_canedit ($$$;$) { sub check_content (@) { my %params=@_; - + return 1 if ! exists $hooks{checkcontent}; # optimisation if (exists $pagesources{$params{page}}) { @@ -1644,14 +1644,14 @@ sub saveindex () { $index{state}{$id}{$key}=$wikistate{$id}{$key}; } } - + $index{version}="3"; my $ret=Storable::nstore_fd(\%index, $out); return if ! defined $ret || ! $ret; close $out || error("failed saving to $newfile: $!", $cleanup); rename($newfile, "$config{wikistatedir}/indexdb") || error("failed renaming $newfile to $config{wikistatedir}/indexdb", $cleanup); - + return 1; } @@ -1694,7 +1694,7 @@ sub template ($;@) { sub misctemplate ($$;@) { my $title=shift; my $pagebody=shift; - + my $template=template("misc.tmpl"); $template->param( title => $title, @@ -1712,13 +1712,13 @@ sub misctemplate ($$;@) { sub hook (@) { my %param=@_; - + if (! exists $param{type} || ! ref $param{call} || ! exists $param{id}) { error 'hook requires type, call, and id parameters'; } return if $param{no_override} && exists $hooks{$param{type}}{$param{id}}; - + $hooks{$param{type}}{$param{id}}=\%param; return 1; } @@ -1832,7 +1832,7 @@ sub deptype (@) { if ($type eq 'presence') { $deptype |= $DEPEND_PRESENCE; } - elsif ($type eq 'links') { + elsif ($type eq 'links') { $deptype |= $DEPEND_LINKS; } elsif ($type eq 'content') { @@ -2120,19 +2120,19 @@ sub pagespec_match_list ($$;@) { ? grep { ! $params{filter}->($_) } keys %pagesources : keys %pagesources; } - + # clear params, remainder is passed to pagespec $depends{$page}{$pagespec} |= ($params{deptype} || $DEPEND_CONTENT); my $num=$params{num}; delete @params{qw{num deptype reverse sort filter list}}; - + # when only the top matches will be returned, it's efficient to # sort before matching to pagespec, if (defined $num && defined $sort) { @candidates=IkiWiki::SortSpec::sort_pages( $sort, @candidates); } - + my @matches; my $firstfail; my $count=0; @@ -2260,7 +2260,7 @@ sub match_glob ($$;@) { my $page=shift; my $glob=shift; my %params=@_; - + $glob=derel($glob, $params{location}); my $regexp=IkiWiki::glob2re($glob); @@ -2328,7 +2328,7 @@ sub match_created_before ($$;@) { my $page=shift; my $testpage=shift; my %params=@_; - + $testpage=derel($testpage, $params{location}); if (exists $IkiWiki::pagectime{$testpage}) { @@ -2348,7 +2348,7 @@ sub match_created_after ($$;@) { my $page=shift; my $testpage=shift; my %params=@_; - + $testpage=derel($testpage, $params{location}); if (exists $IkiWiki::pagectime{$testpage}) { @@ -2395,9 +2395,9 @@ sub match_user ($$;@) { shift; my $user=shift; my %params=@_; - + my $regexp=IkiWiki::glob2re($user); - + if (! exists $params{user}) { return IkiWiki::ErrorReason->new("no user specified"); } @@ -2417,7 +2417,7 @@ sub match_admin ($$;@) { shift; shift; my %params=@_; - + if (! exists $params{user}) { return IkiWiki::ErrorReason->new("no user specified"); } @@ -2437,7 +2437,7 @@ sub match_ip ($$;@) { shift; my $ip=shift; my %params=@_; - + if (! exists $params{ip}) { return IkiWiki::ErrorReason->new("no IP specified"); } diff --git a/IkiWiki/Plugin/tag.pm b/IkiWiki/Plugin/tag.pm index e5e9e08ec..6df852638 100644 --- a/IkiWiki/Plugin/tag.pm +++ b/IkiWiki/Plugin/tag.pm @@ -63,7 +63,7 @@ sub checkconfig() { sub tagpage ($$) { my $tag=shift; my $type=shift; - + if (defined $type && $type ne "tag") { $tag="/$type/$tag"; } elsif ($tag !~ m{^\.?/} && @@ -102,7 +102,7 @@ sub preprocess_tag (@) { # hidden WikiLink add_link($page, tagpage($tag, $tagtype), $tagtype); } - + return ""; } @@ -160,7 +160,7 @@ sub pagetemplate (@) { # custom tagtypes have a separate treatment for a number of reasons, including the fact that # their template parameter name is different from the tag/link type ('tags' vs 'tag') - # notice the use of rel => $tagtype + # notice the use of rel => $tagtype foreach my $tagtype (tagtypes()) { $tags = $typedlinks{$page}{$tagtype}; if (defined $tags && %$tags) { -- 2.32.0.93.g670b81a890