use lib '.'; # For use without installation, removed by Makefile.
use vars qw{%config %links %oldlinks %oldpagemtime %pagectime
- %renderedfiles %pagesources};
+ %renderedfiles %pagesources %inlinepages};
sub usage () { #{{{
die "usage: ikiwiki [options] source dest\n";
%config=(
wiki_file_prune_regexp => qr{((^|/).svn/|\.\.|^\.|\/\.|\.html?$)},
wiki_link_regexp => qr/\[\[([^\s\]]+)\]\]/,
- wiki_file_regexp => qr/(^[-A-Za-z0-9_.\&;:\/+]+$)/,
+ wiki_processor_regexp => qr/\[\[(\w+)\s+([^\]]+)\]\]/,
+ wiki_file_regexp => qr/(^[-A-Za-z0-9_.:\/+]+$)/,
verbose => 0,
wikiname => "wiki",
default_pageext => ".mdwn",
anonok => 0,
rss => 0,
rebuild => 0,
+ getctime => 0,
wrapper => undef,
wrappermode => undef,
srcdir => undef,
"wikiname=s" => \$config{wikiname},
"verbose|v!" => \$config{verbose},
"rebuild!" => \$config{rebuild},
+ "getctime" => \$config{getctime},
"wrappermode=i" => \$config{wrappermode},
"svn!" => \$config{svn},
"anonok!" => \$config{anonok},
$bestlink="$page/".lc($link);
}
- my $linktext=pagetitle($link);
+ my $linktext=pagetitle(basename($link));
return $linktext if length $bestlink && $page eq $bestlink;
$bestlink=htmlpage($bestlink);
}
if (! grep { $_ eq $bestlink } values %renderedfiles) {
- return "<a href=\"$config{cgiurl}?do=create&page=$link&from=$page\">?</a>$linktext"
+ return "<span><a href=\"$config{cgiurl}?do=create&page=$link&from=$page\">?</a>$linktext</span>"
}
$bestlink=File::Spec->abs2rel($bestlink, dirname($page));
$oldpagemtime{$page}=$items{mtime}[0];
$oldlinks{$page}=[@{$items{link}}];
$links{$page}=[@{$items{link}}];
+ $inlinepages{$page}=join(" ", @{$items{inlinepage}})
+ if exists $items{inlinepage};
$renderedfiles{$page}=$items{dest}[0];
}
$pagectime{$page}=$items{ctime}[0];
open (OUT, ">$config{wikistatedir}/index") ||
error("cannot write to $config{wikistatedir}/index: $!");
foreach my $page (keys %oldpagemtime) {
+ next unless $oldpagemtime{$page};
my $line="mtime=$oldpagemtime{$page} ".
"ctime=$pagectime{$page} ".
"src=$pagesources{$page} ".
"dest=$renderedfiles{$page}";
- if ($oldpagemtime{$page}) {
- $line.=" link=$_" foreach @{$links{$page}};
+ $line.=" link=$_" foreach @{$links{$page}};
+ if (exists $inlinepages{$page}) {
+ $line.=" inlinepage=$_" foreach split " ", $inlinepages{$page};
}
print OUT $line."\n";
}
sub main () { #{{{
getconfig();
- if ($config{setup}) {
+ if ($config{cgi}) {
+ lockwiki();
+ loadindex();
+ require IkiWiki::CGI;
+ cgi();
+ }
+ elsif ($config{setup}) {
require IkiWiki::Setup;
setup();
}
require IkiWiki::Wrapper;
gen_wrapper();
}
- elsif ($config{cgi}) {
- lockwiki();
- require IkiWiki::CGI;
- cgi();
- }
else {
lockwiki();
loadindex();
require IkiWiki::Render;
rcs_update();
+ rcs_getctime() if $config{getctime};
refresh();
saveindex();
}