* The last release accidentially installed ikiwiki as ikiwiki.pl, now fixed.
* Add --version. * Man page format fixups. * Add a %pagecase which maps lower-case page names to the actual case used in the filename. Use this in bestlinks calculation instead of forcing the link to lowercase. * Also use %pagecase in various other places that want to check if a page with a given name exists. * This means that links to pages with mixed case names will now work, even if the link is in some other case mixture, and mixed case pages should be fully supported throughout ikiwiki. * Recommend rebuilding wikis on upgrade to this version.master
parent
85ecbc6c4e
commit
4b36dee35a
13
IkiWiki.pm
13
IkiWiki.pm
|
@ -12,7 +12,7 @@ use Memoize;
|
|||
memoize("abs2rel");
|
||||
memoize("pagespec_translate");
|
||||
|
||||
use vars qw{%config %links %oldlinks %oldpagemtime %pagectime
|
||||
use vars qw{%config %links %oldlinks %oldpagemtime %pagectime %pagecase
|
||||
%renderedfiles %pagesources %depends %hooks %forcerebuild};
|
||||
|
||||
sub defaultconfig () { #{{{
|
||||
|
@ -238,7 +238,7 @@ sub bestlink ($$) { #{{{
|
|||
# goes down the directory tree to the base looking for matching
|
||||
# pages.
|
||||
my $page=shift;
|
||||
my $link=lc(shift);
|
||||
my $link=shift;
|
||||
|
||||
my $cwd=$page;
|
||||
do {
|
||||
|
@ -247,9 +247,11 @@ sub bestlink ($$) { #{{{
|
|||
$l.=$link;
|
||||
|
||||
if (exists $links{$l}) {
|
||||
#debug("for $page, \"$link\", use $l");
|
||||
return $l;
|
||||
}
|
||||
elsif (exists $pagecase{lc $l}) {
|
||||
return $pagecase{lc $l};
|
||||
}
|
||||
} while $cwd=~s!/?[^/]+$!!;
|
||||
|
||||
#print STDERR "warning: page $page, broken link: $link\n";
|
||||
|
@ -333,7 +335,7 @@ sub htmllink ($$$;$$$) { #{{{
|
|||
}
|
||||
if (! grep { $_ eq $bestlink } values %renderedfiles) {
|
||||
return "<span><a href=\"".
|
||||
cgiurl(do => "create", page => $link, from => $page).
|
||||
cgiurl(do => "create", page => lc($link), from => $page).
|
||||
"\">?</a>$linktext</span>"
|
||||
}
|
||||
|
||||
|
@ -395,6 +397,7 @@ sub loadindex () { #{{{
|
|||
$links{$page}=[@{$items{link}}];
|
||||
$depends{$page}=$items{depends}[0] if exists $items{depends};
|
||||
$renderedfiles{$page}=$items{dest}[0];
|
||||
$pagecase{lc $page}=$page;
|
||||
}
|
||||
$pagectime{$page}=$items{ctime}[0];
|
||||
}
|
||||
|
@ -588,7 +591,7 @@ sub match_glob ($$) { #{{{
|
|||
|
||||
sub match_link ($$) { #{{{
|
||||
my $page=shift;
|
||||
my $link=shift;
|
||||
my $link=lc(shift);
|
||||
|
||||
my $links = $links{$page} or return undef;
|
||||
foreach my $p (@$links) {
|
||||
|
|
|
@ -346,12 +346,11 @@ sub cgi_editpage ($$) { #{{{
|
|||
# This untaint is safe because titlepage removes any problematic
|
||||
# characters.
|
||||
my ($page)=$form->field('page');
|
||||
$page=titlepage(possibly_foolish_untaint(lc($page)));
|
||||
$page=titlepage(possibly_foolish_untaint($page));
|
||||
if (! defined $page || ! length $page ||
|
||||
$page=~/$config{wiki_file_prune_regexp}/ || $page=~/^\//) {
|
||||
error("bad page name");
|
||||
}
|
||||
$page=lc($page);
|
||||
|
||||
my $from;
|
||||
if (defined $form->field('from')) {
|
||||
|
@ -359,7 +358,7 @@ sub cgi_editpage ($$) { #{{{
|
|||
}
|
||||
|
||||
my $file;
|
||||
my $type;
|
||||
my $type;
|
||||
if (exists $pagesources{$page}) {
|
||||
$file=$pagesources{$page};
|
||||
$type=pagetype($file);
|
||||
|
@ -457,7 +456,7 @@ sub cgi_editpage ($$) { #{{{
|
|||
}
|
||||
|
||||
@page_locs = grep {
|
||||
! exists $pagesources{lc($_)} &&
|
||||
! exists $pagecase{lc $_} &&
|
||||
! page_locked($_, $session, 1)
|
||||
} @page_locs;
|
||||
|
||||
|
@ -485,8 +484,8 @@ sub cgi_editpage ($$) { #{{{
|
|||
if (! defined $form->field('editcontent') ||
|
||||
! length $form->field('editcontent')) {
|
||||
my $content="";
|
||||
if (exists $pagesources{lc($page)}) {
|
||||
$content=readfile(srcfile($pagesources{lc($page)}));
|
||||
if (exists $pagesources{$page}) {
|
||||
$content=readfile(srcfile($pagesources{$page}));
|
||||
$content=~s/\n/\r\n/g;
|
||||
}
|
||||
$form->field(name => "editcontent", value => $content,
|
||||
|
@ -617,11 +616,11 @@ sub cgi () { #{{{
|
|||
cgi_prefs($q, $session);
|
||||
}
|
||||
elsif ($do eq 'blog') {
|
||||
my $page=titlepage(lc($q->param('title')));
|
||||
my $page=titlepage($q->param('title'));
|
||||
# if the page already exists, munge it to be unique
|
||||
my $from=$q->param('from');
|
||||
my $add="";
|
||||
while (exists $oldpagemtime{"$from/$page$add"}) {
|
||||
while (exists $pagecase{lc "$from/$page$add"}) {
|
||||
$add=1 unless length $add;
|
||||
$add++;
|
||||
}
|
||||
|
|
|
@ -260,13 +260,12 @@ sub add_page (@) { #{{{
|
|||
# directory name or trigger ".." disallowing code.
|
||||
$page=~s!([/.])!"__".ord($1)."__"!eg;
|
||||
$page=$feed->{dir}."/".$page;
|
||||
$page=lc($page);
|
||||
($page)=$page=~/$IkiWiki::config{wiki_file_regexp}/;
|
||||
if (! defined $page || ! length $page) {
|
||||
$page=$feed->{dir}."/item";
|
||||
}
|
||||
my $c="";
|
||||
while (exists $IkiWiki::pagesources{$page.$c} ||
|
||||
while (exists $IkiWiki::pagecase{lc $page} ||
|
||||
-e pagefile($page.$c)) {
|
||||
$c++
|
||||
}
|
||||
|
|
|
@ -358,6 +358,7 @@ sub refresh () { #{{{
|
|||
debug("new page $page") unless exists $pagectime{$page};
|
||||
push @add, $file;
|
||||
$links{$page}=[];
|
||||
$pagecase{lc $page}=$page;
|
||||
$pagesources{$page}=$file;
|
||||
if ($config{getctime} && -e "$config{srcdir}/$file") {
|
||||
$pagectime{$page}=rcs_getctime("$config{srcdir}/$file");
|
||||
|
|
|
@ -11,6 +11,11 @@ clean:: extra_clean
|
|||
install:: extra_install
|
||||
pure_install:: extra_install
|
||||
|
||||
VER=$(shell perl -e '$$_=<>;print m/\((.*?)\)/'<debian/changelog)
|
||||
|
||||
ikiwiki: ikiwiki.pl
|
||||
perl -pe '$$_="" if /use lib/; $$_="our \$$version=\"$(VER)\";\n" if /VERSION_AUTOREPLACE/' ikiwiki.pl > ikiwiki
|
||||
|
||||
extra_build:
|
||||
./ikiwiki.pl doc html --templatedir=templates --underlaydir=basewiki \
|
||||
--wikiname="ikiwiki" --verbose --no-rcs \
|
||||
|
@ -50,5 +55,6 @@ extra_install:
|
|||
WriteMakefile(
|
||||
'NAME' => 'IkiWiki',
|
||||
'PM_FILTER' => 'grep -v "removed by Makefile"',
|
||||
'EXE_FILES' => ['ikiwiki.pl'],
|
||||
'EXE_FILES' => ['ikiwiki'],
|
||||
'clean' => {FILES => 'ikiwiki'},
|
||||
);
|
||||
|
|
|
@ -5,15 +5,16 @@ For example "\[[WikiLink]]".
|
|||
If you ever need to write something like "\[[WikiLink]] without creating a
|
||||
wikilink, just prefix it with a "\", like "\\\\[[WikiLink]]".
|
||||
|
||||
Note that there are some special [[SubPage/LinkingRules]] that come into
|
||||
play when linking between [[SubPage]]s.
|
||||
There are some special [[SubPage/LinkingRules]] that come into play when
|
||||
linking between [[SubPage]]s.
|
||||
|
||||
WikiLinks can be entered in any case you like, the page they link to is
|
||||
always lowercased.
|
||||
|
||||
Note that if the file linked to by a WikiLink looks like an image, it will
|
||||
Also, iIf the file linked to by a WikiLink looks like an image, it will
|
||||
be displayed inline on the page.
|
||||
|
||||
WikiLinks are matched with page names in a case-insensative manner, so you
|
||||
don't need to worry about getting the case the same, and can capitalise
|
||||
links at the start of a sentence, and so on.
|
||||
|
||||
It's also possible to write a WikiLink that uses something other than the
|
||||
page name as the link text. For example "\[[foo_bar|SandBox]]" links to the
|
||||
SandBox page, but the link will appear like this: [[foo_bar|SandBox]]
|
||||
|
|
|
@ -1,10 +1,22 @@
|
|||
ikiwiki (1.18) UNRELEASED; urgency=low
|
||||
|
||||
* The last release accidentially installed ikiwiki as ikiwiki.pl, now fixed.
|
||||
* Add --version.
|
||||
* Man page format fixups.
|
||||
* If the meta plugin overides the page title, set a title_overridden
|
||||
variable in the template to true. This allows doing things with the
|
||||
templates conditional on the title being overriden.
|
||||
* Add a %pagecase which maps lower-case page names to the actual case
|
||||
used in the filename. Use this in bestlinks calculation instead of
|
||||
forcing the link to lowercase.
|
||||
* Also use %pagecase in various other places that want to check if a page
|
||||
with a given name exists.
|
||||
* This means that links to pages with mixed case names will now work,
|
||||
even if the link is in some other case mixture, and mixed case pages
|
||||
should be fully supported throughout ikiwiki.
|
||||
* Recommend rebuilding wikis on upgrade to this version.
|
||||
|
||||
-- Joey Hess <joeyh@debian.org> Sat, 12 Aug 2006 13:45:05 -0400
|
||||
-- Joey Hess <joeyh@debian.org> Sat, 12 Aug 2006 21:26:29 -0400
|
||||
|
||||
ikiwiki (1.17) unstable; urgency=low
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ set -e
|
|||
|
||||
# Change this when some incompatible change is made that requires
|
||||
# rebuilding all wikis.
|
||||
firstcompat=1.13
|
||||
firstcompat=1.18
|
||||
|
||||
if [ "$1" = configure ] && \
|
||||
dpkg --compare-versions "$2" lt "$firstcompat"; then
|
||||
|
|
|
@ -1 +1 @@
|
|||
ikiwiki is licensed under the terms of the GNU [GPL](GPL).
|
||||
ikiwiki is licensed under the terms of the GNU [[GPL]].
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
ikiwiki should support pages that have uppercase in their filenames.
|
||||
However, links to such pages should not need to exactly preserve the case.
|
||||
|
||||
[[todo/done]]
|
|
@ -1,11 +0,0 @@
|
|||
Being case insensative is handy, but it does make the [[BackLinks]] and
|
||||
[[blog]] links a bit ugly compared to other links. It should be possible to
|
||||
support pagenames that have uppercase, while still allowing them to be
|
||||
linked to using any case.
|
||||
|
||||
Also, newly created pagenames that include upper case characters should
|
||||
perhaps not automatically be converted to lower case then.
|
||||
|
||||
Also, it's currently possible to check in a filename with uppercase and
|
||||
ikiwiki will render it that way, but fail to edit it online, fail to link to
|
||||
it properly from other pages, etc.
|
|
@ -75,6 +75,10 @@ These options control the mode that ikiwiki is operating in.
|
|||
along with this one. --rebuild will also force feeds to be polled even if
|
||||
they were polled recently.
|
||||
|
||||
* --version
|
||||
|
||||
Print ikiwiki version number.
|
||||
|
||||
# CONFIG OPTIONS
|
||||
|
||||
These options configure the wiki. Note that plugins can add additional
|
||||
|
@ -160,7 +164,7 @@ configuration options of their own.
|
|||
Specifies the url to the ikiwiki [[CGI]] script wrapper. Required when
|
||||
building the wiki for links to the cgi script to be generated.
|
||||
|
||||
* --historyurl http://url/trunk/\[[file]]?root=wiki
|
||||
* --historyurl url
|
||||
|
||||
Specifies the url to link to for page history browsing. In the url,
|
||||
"\[[file]]" is replaced with the file to browse. It's common to use
|
||||
|
@ -170,7 +174,7 @@ configuration options of their own.
|
|||
|
||||
Specifies the email address that ikiwiki should use for sending email.
|
||||
|
||||
* --diffurl http://url/trunk/\[[file]]?root=wiki&r1=\[[r1]]&r2=\[[r2]]
|
||||
* --diffurl url
|
||||
|
||||
Specifies the url to link to for a diff of changes to a page. In the url,
|
||||
"\[[file]]" is replaced with the file to browse, "\[[r1]]" is the old
|
||||
|
|
|
@ -3,6 +3,8 @@ $ENV{PATH}="/usr/local/bin:/usr/bin:/bin";
|
|||
delete @ENV{qw{IFS CDPATH ENV BASH_ENV}};
|
||||
|
||||
package IkiWiki;
|
||||
our $version='unknown'; # VERSION_AUTOREPLACE done by Makefile, DNE
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
use lib '.'; # For use without installation, removed by Makefile.
|
||||
|
@ -65,7 +67,11 @@ sub getconfig () { #{{{
|
|||
},
|
||||
"pingurl" => sub {
|
||||
push @{$config{pingurl}}, $_[1];
|
||||
}
|
||||
},
|
||||
"version" => sub {
|
||||
print "ikiwiki version $version\n";
|
||||
exit;
|
||||
},
|
||||
) || usage();
|
||||
|
||||
if (! $config{setup}) {
|
||||
|
|
6
mdwn2man
6
mdwn2man
|
@ -8,8 +8,12 @@ print ".TH $prog $section\n";
|
|||
|
||||
while (<>) {
|
||||
s{(\\?)\[\[([^\s\]]+)\]\]}{$1 ? "[[$2]]" : $2}eg;
|
||||
s/^#\s/.SH /;
|
||||
if (/^#\s/) {
|
||||
s/^#\s/.SH /;
|
||||
<>; # blank;
|
||||
}
|
||||
s/^\s+//;
|
||||
s/-/\\-/g;
|
||||
s/^Warning:.*//g;
|
||||
s/^$/.PP\n/;
|
||||
s/\`//g;
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
#!/usr/bin/perl
|
||||
use warnings;
|
||||
use strict;
|
||||
use Test::More tests => 5;
|
||||
use Test::More tests => 8;
|
||||
|
||||
sub test ($$$) {
|
||||
my $page=shift;
|
||||
my $link=shift;
|
||||
my @existing_pages=@{shift()};
|
||||
|
||||
%IkiWiki::links=();
|
||||
%IkiWiki::pagecase=();
|
||||
foreach my $page (@existing_pages) {
|
||||
$IkiWiki::links{$page}=[];
|
||||
$IkiWiki::pagecase{lc $page}=$page;
|
||||
}
|
||||
|
||||
return IkiWiki::bestlink($page, $link);
|
||||
|
@ -20,5 +20,8 @@ BEGIN { use_ok("IkiWiki"); }
|
|||
|
||||
is(test("bar", "foo", ["bar"]), "", "broken link");
|
||||
is(test("bar", "foo", ["bar", "foo"]), "foo", "simple link");
|
||||
is(test("bar", "FoO", ["bar", "foo"]), "foo", "simple link with different input case");
|
||||
is(test("bar", "foo", ["bar", "fOo"]), "fOo", "simple link with different page case");
|
||||
is(test("bar", "FoO", ["bar", "fOo"]), "fOo", "simple link with different page and input case");
|
||||
is(test("bar", "foo", ["bar", "foo", "bar/foo"]), "bar/foo", "simple subpage link");
|
||||
is(test("bar", "foo/subpage", ["bar", "foo", "bar/subpage", "foo/subpage"]), "foo/subpage", "cross subpage link");
|
||||
|
|
|
@ -12,9 +12,9 @@ sub linkify ($$$$) {
|
|||
|
||||
# This is what linkify and htmllink need set right now to work.
|
||||
# This could change, if so, update it..
|
||||
%IkiWiki::links=();
|
||||
%IkiWiki::pagecase=();
|
||||
foreach my $page (@existing_pages) {
|
||||
$IkiWiki::links{$page}=[];
|
||||
$IkiWiki::pagecase{lc $page}=$page;
|
||||
$IkiWiki::renderedfiles{"$page.mdwn"}=$page;
|
||||
}
|
||||
%IkiWiki::config=IkiWiki::defaultconfig();
|
||||
|
|
Loading…
Reference in New Issue