* 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.
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 () { #{{{
# 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 {
$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";
}
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>"
}
$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];
}
sub match_link ($$) { #{{{
my $page=shift;
- my $link=shift;
+ my $link=lc(shift);
my $links = $links{$page} or return undef;
foreach my $p (@$links) {
# 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')) {
}
my $file;
- my $type;
+ my $type;
if (exists $pagesources{$page}) {
$file=$pagesources{$page};
$type=pagetype($file);
}
@page_locs = grep {
- ! exists $pagesources{lc($_)} &&
+ ! exists $pagecase{lc $_} &&
! page_locked($_, $session, 1)
} @page_locs;
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,
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++;
}
# 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++
}
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");
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 \
WriteMakefile(
'NAME' => 'IkiWiki',
'PM_FILTER' => 'grep -v "removed by Makefile"',
- 'EXE_FILES' => ['ikiwiki.pl'],
+ 'EXE_FILES' => ['ikiwiki'],
+ 'clean' => {FILES => 'ikiwiki'},
);
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]]
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.
-
- -- Joey Hess <joeyh@debian.org> Sat, 12 Aug 2006 13:45:05 -0400
+ * 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 21:26:29 -0400
ikiwiki (1.17) unstable; urgency=low
# 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
-ikiwiki is licensed under the terms of the GNU [GPL](GPL).
\ No newline at end of file
+ikiwiki is licensed under the terms of the GNU [[GPL]].
--- /dev/null
+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]]
+++ /dev/null
-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.
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
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
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
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.
},
"pingurl" => sub {
push @{$config{pingurl}}, $_[1];
- }
+ },
+ "version" => sub {
+ print "ikiwiki version $version\n";
+ exit;
+ },
) || usage();
if (! $config{setup}) {
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;
#!/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);
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");
# 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();