diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-03-23 19:25:08 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-03-23 19:25:08 +0000 |
commit | a223f4540fee2d0c49523343a422315377bc0025 (patch) | |
tree | d6c52e405efb5baf245c99d1f4dd5f5dc9ecc25b /ikiwiki | |
parent | f5a5df14b7daeb032137c293c4db288e84429dfa (diff) | |
download | ikiwiki-a223f4540fee2d0c49523343a422315377bc0025.tar ikiwiki-a223f4540fee2d0c49523343a422315377bc0025.tar.gz |
support arbitrary characters in page titles, via some ugly use of unicode
character numbers
Diffstat (limited to 'ikiwiki')
-rwxr-xr-x | ikiwiki | 21 |
1 files changed, 15 insertions, 6 deletions
@@ -19,7 +19,7 @@ sub getconfig () { #{{{ %config=( wiki_file_prune_regexp => qr{((^|/).svn/|\.\.|^\.|\/\.|\.html?$)}, wiki_link_regexp => qr/\[\[([^\s\]]+)\]\]/, - wiki_file_regexp => qr/(^[-A-Za-z0-9_.:\/+]+$)/, + wiki_file_regexp => qr/(^[-A-Za-z0-9_.\&;:\/+]+$)/, verbose => 0, wikiname => "wiki", default_pageext => ".mdwn", @@ -92,11 +92,11 @@ sub checkconfig () { #{{{ unless exists $config{wikistatedir}; if ($config{svn}) { - require IkiWiki::RCS::SVN; + require IkiWiki::Rcs::SVN; $config{rcs}=1; } else { - require IkiWiki::RCS::Stub; + require IkiWiki::Rcs::Stub; $config{rcs}=0; } } #}}} @@ -234,6 +234,13 @@ sub isinlinableimage ($) { #{{{ $file=~/\.(png|gif|jpg|jpeg)$/; } #}}} +sub pagetitle ($) { #{{{ + my $page=shift; + $page=~s/__(\d+)__/&#$1;/g; + $page=~y/_/ /; + return $page; +} #}}} + sub htmllink ($$;$$) { #{{{ my $page=shift; my $link=shift; @@ -248,7 +255,9 @@ sub htmllink ($$;$$) { #{{{ $bestlink="$page/".lc($link); } - return $link if length $bestlink && $page eq $bestlink; + my $linktext=pagetitle($link); + + 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 @@ -258,7 +267,7 @@ sub htmllink ($$;$$) { #{{{ $bestlink=htmlpage($bestlink); } if (! grep { $_ eq $bestlink } values %renderedfiles) { - return "<a href=\"$config{cgiurl}?do=create&page=$link&from=$page\">?</a>$link" + return "<a href=\"$config{cgiurl}?do=create&page=$link&from=$page\">?</a>$linktext" } $bestlink=File::Spec->abs2rel($bestlink, dirname($page)); @@ -266,7 +275,7 @@ sub htmllink ($$;$$) { #{{{ if (! $noimageinline && isinlinableimage($bestlink)) { return "<img src=\"$bestlink\">"; } - return "<a href=\"$bestlink\">$link</a>"; + return "<a href=\"$bestlink\">$linktext</a>"; } #}}} sub indexlink () { #{{{ |