X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/e910e67424aeaf56c547578af6c98914a7180811..c438458b8a0f1c9ab7a762380e1f0b8b3db6c67d:/ikiwiki
diff --git a/ikiwiki b/ikiwiki
index ea5604365..d1173d399 100755
--- a/ikiwiki
+++ b/ikiwiki
@@ -19,9 +19,9 @@ sub getconfig () { #{{{
if (! exists $ENV{WRAPPED_OPTIONS}) {
%config=(
wiki_file_prune_regexp => qr{((^|/).svn/|\.\.|^\.|\/\.|\.html?$)},
- wiki_link_regexp => qr/\[\[([^\s\]]+)\]\]/,
+ wiki_link_regexp => qr/\[\[(?:([^\s\]\|]+)\|)?([^\s\]]+)\]\]/,
wiki_processor_regexp => qr/\[\[(\w+)\s+([^\]]+)\]\]/,
- wiki_file_regexp => qr/(^[-A-Za-z0-9_.\&;:\/+]+$)/,
+ wiki_file_regexp => qr/(^[-A-Za-z0-9_.:\/+]+$)/,
verbose => 0,
wikiname => "wiki",
default_pageext => ".mdwn",
@@ -34,6 +34,8 @@ sub getconfig () { #{{{
anonok => 0,
rss => 0,
rebuild => 0,
+ refresh => 0,
+ getctime => 0,
wrapper => undef,
wrappermode => undef,
srcdir => undef,
@@ -49,6 +51,8 @@ sub getconfig () { #{{{
"wikiname=s" => \$config{wikiname},
"verbose|v!" => \$config{verbose},
"rebuild!" => \$config{rebuild},
+ "refresh!" => \$config{refresh},
+ "getctime" => \$config{getctime},
"wrappermode=i" => \$config{wrappermode},
"svn!" => \$config{svn},
"anonok!" => \$config{anonok},
@@ -238,7 +242,7 @@ sub bestlink ($$) { #{{{
sub isinlinableimage ($) { #{{{
my $file=shift;
- $file=~/\.(png|gif|jpg|jpeg)$/;
+ $file=~/\.(png|gif|jpg|jpeg)$/i;
} #}}}
sub pagetitle ($) { #{{{
@@ -248,11 +252,25 @@ sub pagetitle ($) { #{{{
return $page;
} #}}}
-sub htmllink ($$;$$) { #{{{
+sub titlepage ($) { #{{{
+ my $title=shift;
+ $title=~y/ /_/;
+ $title=~s/([^-A-Za-z0-9_:+\/.])/"__".ord($1)."__"/eg;
+ return $title;
+} #}}}
+
+sub cgiurl (@) { #{{{
+ my %params=@_;
+
+ return $config{cgiurl}."?".join("&", map "$_=$params{$_}", keys %params);
+} #}}}
+
+sub htmllink ($$;$$$) { #{{{
my $page=shift;
my $link=shift;
my $noimageinline=shift; # don't turn links into inline html images
my $forcesubpage=shift; # force a link to a subpage
+ my $linktext=shift; # set to force the link text to something
my $bestlink;
if (! $forcesubpage) {
@@ -262,7 +280,7 @@ sub htmllink ($$;$$) { #{{{
$bestlink="$page/".lc($link);
}
- my $linktext=pagetitle($link);
+ $linktext=pagetitle(basename($link)) unless defined $linktext;
return $linktext if length $bestlink && $page eq $bestlink;
@@ -274,13 +292,15 @@ sub htmllink ($$;$$) { #{{{
$bestlink=htmlpage($bestlink);
}
if (! grep { $_ eq $bestlink } values %renderedfiles) {
- return "?$linktext"
+ return " "create", page => $link, from =>$page).
+ "\">?$linktext"
}
$bestlink=File::Spec->abs2rel($bestlink, dirname($page));
if (! $noimageinline && isinlinableimage($bestlink)) {
- return "";
+ return "";
}
return "$linktext";
} #}}}
@@ -486,6 +506,7 @@ sub main () { #{{{
loadindex();
require IkiWiki::Render;
rcs_update();
+ rcs_getctime() if $config{getctime};
refresh();
saveindex();
}