X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/24fcf2b97d86debeb27ab4ab46a6bc0a2f23f2b2..609f48c93cc9017031c11da942a00975c3e7656a:/IkiWiki.pm diff --git a/IkiWiki.pm b/IkiWiki.pm index 4fc37110b..b6e160ab6 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -15,10 +15,11 @@ memoize("pagespec_translate"); use vars qw{%config %links %oldlinks %oldpagemtime %pagectime %pagecase %renderedfiles %pagesources %depends %hooks %forcerebuild}; +my $installdir=''; # INSTALLDIR_AUTOREPLACE done by Makefile, DNE + sub defaultconfig () { #{{{ wiki_file_prune_regexp => qr{((^|/).svn/|\.\.|^\.|\/\.|\.x?html?$|\.rss$)}, wiki_link_regexp => qr/\[\[(?:([^\]\|]+)\|)?([^\s\]]+)\]\]/, - wiki_processor_regexp => qr/\[\[(\w+)\s+([^\]]*)\]\]/, wiki_file_regexp => qr/(^[-[:alnum:]_.:\/+]+$)/, verbose => 0, syslog => 0, @@ -45,8 +46,8 @@ sub defaultconfig () { #{{{ srcdir => undef, destdir => undef, pingurl => [], - templatedir => "/usr/share/ikiwiki/templates", - underlaydir => "/usr/share/ikiwiki/basewiki", + templatedir => "$installdir/share/ikiwiki/templates", + underlaydir => "$installdir/share/ikiwiki/basewiki", setup => undef, adminuser => undef, adminemail => undef, @@ -304,14 +305,14 @@ sub cgiurl (@) { #{{{ return $config{cgiurl}."?".join("&", map "$_=$params{$_}", keys %params); } #}}} -sub styleurl (;$) { #{{{ +sub baseurl (;$) { #{{{ my $page=shift; - return "$config{url}/style.css" if ! defined $page; + return "$config{url}/" if ! defined $page; $page=~s/[^\/]+$//; $page=~s/[^\/]+\//..\//g; - return $page."style.css"; + return $page; } #}}} sub abs2rel ($$) { #{{{ @@ -345,7 +346,8 @@ sub htmllink ($$$;$$$) { #{{{ $linktext=pagetitle(basename($link)) unless defined $linktext; - return $linktext if length $bestlink && $page eq $bestlink; + return "$linktext" + if length $bestlink && $page eq $bestlink; # TODO BUG: %renderedfiles may not have it, if the linked to page # was also added and isn't yet rendered! Note that this bug is @@ -475,8 +477,7 @@ sub misctemplate ($$) { #{{{ indexlink => indexlink(), wikiname => $config{wikiname}, pagebody => $pagebody, - styleurl => styleurl(), - baseurl => "$config{url}/", + baseurl => baseurl(), ); return $template->output; }#}}} @@ -545,6 +546,8 @@ sub pagespec_merge ($$) { #{{{ my $a=shift; my $b=shift; + return $a if $a eq $b; + # Support for old-style GlobLists. if (is_globlist($a)) { $a=globlist_to_pagespec($a);