X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/db3b72c4822cf9057460d47654c35f0a5115139e..e0832eefeaf790bc2bfc2b98c24413c4514557b4:/IkiWiki.pm diff --git a/IkiWiki.pm b/IkiWiki.pm index a6869d454..15f7bcec0 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -30,6 +30,7 @@ sub defaultconfig () { #{{{ wiki_file_prune_regexp => qr{((^|/).svn/|\.\.|^\.|\/\.|\.x?html?$|\.rss$|\.atom$|.arch-ids/|{arch}/)}, wiki_link_regexp => qr/\[\[(?:([^\]\|]+)\|)?([^\s\]]+)\]\]/, wiki_file_regexp => qr/(^[-[:alnum:]_.:\/+]+$)/, + web_commit_regexp => qr/^web commit (by (.*?(?=: |$))|from (\d+\.\d+\.\d+\.\d+)):?(.*)/, verbose => 0, syslog => 0, wikiname => "wiki", @@ -76,12 +77,14 @@ sub checkconfig () { #{{{ } if (defined $config{locale}) { eval q{use POSIX}; + error($@) if $@; $ENV{LANG} = $config{locale} if POSIX::setlocale(&POSIX::LC_TIME, $config{locale}); } if ($config{w3mmode}) { eval q{use Cwd q{abs_path}}; + error($@) if $@; $config{srcdir}=possibly_foolish_untaint(abs_path($config{srcdir})); $config{destdir}=possibly_foolish_untaint(abs_path($config{destdir})); $config{cgiurl}="file:///\$LIB/ikiwiki-w3m.cgi/".$config{cgiurl} @@ -360,6 +363,7 @@ sub displaytime ($) { #{{{ my $time=shift; eval q{use POSIX}; + error($@) if $@; # strftime doesn't know about encodings, so make sure # its output is properly treated as utf8 return decode_utf8(POSIX::strftime( @@ -509,7 +513,7 @@ sub preprocess ($$$;$) { #{{{ return $content; } #}}} -sub filter ($$) { +sub filter ($$) { #{{{ my $page=shift; my $content=shift; @@ -518,7 +522,7 @@ sub filter ($$) { }); return $content; -} +} #}}} sub indexlink () { #{{{ return "$config{wikiname}"; @@ -593,7 +597,8 @@ sub saveindex () { #{{{ "ctime=$pagectime{$page} ". "src=$pagesources{$page}"; $line.=" dest=$_" foreach @{$renderedfiles{$page}}; - $line.=" link=$_" foreach @{$links{$page}}; + my %count; + $line.=" link=$_" foreach grep { ++$count{$_} == 1 } @{$links{$page}}; if (exists $depends{$page}) { $line.=" depends=".encode_entities($depends{$page}, " \t\n"); }