summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki.pm13
-rw-r--r--IkiWiki/CGI.pm15
-rw-r--r--IkiWiki/Plugin/aggregate.pm3
-rw-r--r--IkiWiki/Render.pm1
-rwxr-xr-xMakefile.PL8
-rw-r--r--basewiki/wikilink.mdwn13
-rw-r--r--debian/changelog16
-rwxr-xr-xdebian/postinst2
-rw-r--r--doc/freesoftware.mdwn2
-rw-r--r--doc/todo/Case.mdwn4
-rw-r--r--doc/todo/case.mdwn11
-rw-r--r--doc/usage.mdwn8
-rwxr-xr-xikiwiki.pl8
-rwxr-xr-xmdwn2man6
-rwxr-xr-xt/bestlink.t9
-rwxr-xr-xt/linkify.t4
16 files changed, 77 insertions, 46 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 69452792c..560647e06 100644
--- a/IkiWiki.pm
+++ b/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) {
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm
index f69f02a15..db97740f6 100644
--- a/IkiWiki/CGI.pm
+++ b/IkiWiki/CGI.pm
@@ -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++;
}
diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm
index 633618f76..2e4026757 100644
--- a/IkiWiki/Plugin/aggregate.pm
+++ b/IkiWiki/Plugin/aggregate.pm
@@ -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++
}
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index b855d2c8f..b4b95e8d4 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -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");
diff --git a/Makefile.PL b/Makefile.PL
index 7b61acc61..1f46e9c95 100755
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -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'},
);
diff --git a/basewiki/wikilink.mdwn b/basewiki/wikilink.mdwn
index 21f10a7dd..a3730bcf7 100644
--- a/basewiki/wikilink.mdwn
+++ b/basewiki/wikilink.mdwn
@@ -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]]
diff --git a/debian/changelog b/debian/changelog
index 4e92226fa..29316cc7a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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.
-
- -- 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
diff --git a/debian/postinst b/debian/postinst
index b3031bd9b..f7043ecad 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -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
diff --git a/doc/freesoftware.mdwn b/doc/freesoftware.mdwn
index bcbfe38dc..5d231de58 100644
--- a/doc/freesoftware.mdwn
+++ b/doc/freesoftware.mdwn
@@ -1 +1 @@
-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]].
diff --git a/doc/todo/Case.mdwn b/doc/todo/Case.mdwn
new file mode 100644
index 000000000..a19dbb2a6
--- /dev/null
+++ b/doc/todo/Case.mdwn
@@ -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]]
diff --git a/doc/todo/case.mdwn b/doc/todo/case.mdwn
deleted file mode 100644
index 6148b48e9..000000000
--- a/doc/todo/case.mdwn
+++ /dev/null
@@ -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.
diff --git a/doc/usage.mdwn b/doc/usage.mdwn
index aab5330b6..048072df6 100644
--- a/doc/usage.mdwn
+++ b/doc/usage.mdwn
@@ -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&amp;r1=\[[r1]]&amp;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
diff --git a/ikiwiki.pl b/ikiwiki.pl
index 1342ec543..fd9300fba 100755
--- a/ikiwiki.pl
+++ b/ikiwiki.pl
@@ -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}) {
diff --git a/mdwn2man b/mdwn2man
index 8c70c87c1..e78a4d18c 100755
--- a/mdwn2man
+++ b/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;
diff --git a/t/bestlink.t b/t/bestlink.t
index ed748b0f2..825c88ff2 100755
--- a/t/bestlink.t
+++ b/t/bestlink.t
@@ -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");
diff --git a/t/linkify.t b/t/linkify.t
index d1d02cd27..82f5f368b 100755
--- a/t/linkify.t
+++ b/t/linkify.t
@@ -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();