* The last release accidentially installed ikiwiki as ikiwiki.pl, now fixed.
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sun, 13 Aug 2006 02:03:43 +0000 (02:03 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sun, 13 Aug 2006 02:03:43 +0000 (02:03 +0000)
* 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.

16 files changed:
IkiWiki.pm
IkiWiki/CGI.pm
IkiWiki/Plugin/aggregate.pm
IkiWiki/Render.pm
Makefile.PL
basewiki/wikilink.mdwn
debian/changelog
debian/postinst
doc/freesoftware.mdwn
doc/todo/Case.mdwn [new file with mode: 0644]
doc/todo/case.mdwn [deleted file]
doc/usage.mdwn
ikiwiki.pl
mdwn2man
t/bestlink.t
t/linkify.t

index 69452792c8d8e6cb75a1e21cb530e49a480e05d0..560647e067f224bd62d2c9cd49b9c17359933b9f 100644 (file)
@@ -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) {
index f69f02a15af2396d51c3e116ada1cb8be3652d22..db97740f654e57e6276ed64b50a8470c37072ac8 100644 (file)
@@ -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++;
                }
index 633618f761839fadb52bf04843959cd0c98507ed..2e4026757aba378dc878aa79788b335d43ad0d53 100644 (file)
@@ -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++
                }
index b855d2c8f86b02e5a25da3cf822bdd482700c773..b4b95e8d4897562b695fe7d5bac5029e1e311fc3 100644 (file)
@@ -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");
index 7b61acc617195fc442d8574ea867f22c56187a6f..1f46e9c957e9fff375b2ff308e05425768416d92 100755 (executable)
@@ -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'},
 );
index 21f10a7dd7af9edc1c66dee0d4a428d873540920..a3730bcf71b3b4e30e577fecbb21f59c4ec31cc3 100644 (file)
@@ -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]]
index 4e92226facc6822e7c18a542205871add442a441..29316cc7a308265e9a9770641ba9f353ddff36e8 100644 (file)
@@ -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
 
index b3031bd9b944a80f0d61f38b74b949f8f2a6bcf0..f7043ecad790778ef1ad39c1c27454ff127aabc1 100755 (executable)
@@ -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
index bcbfe38dc47fd36668932e9cbc8e0332d04e2e1e..5d231de58b3d25312a9c7a522e726e23534bf960 100644 (file)
@@ -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 (file)
index 0000000..a19dbb2
--- /dev/null
@@ -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 (file)
index 6148b48..0000000
+++ /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.
index aab5330b637eb1011597f993f6f1b56d00877a07..048072df60d5c2f2c2fcca5e673661c0258b6ff3 100644 (file)
@@ -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
index 1342ec543f3e54c216e16cb615e9493c67484e8a..fd9300fbabed31f31413ab7efd6fb044e3ea11ad 100755 (executable)
@@ -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}) {
index 8c70c87c157217f6dc108b092e7b21567a658265..e78a4d18cf6da8046e9a998d4d7ff738deae6037 100755 (executable)
--- 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;
index ed748b0f28fb6b3b2d5051946ed06b0aa42eda39..825c88ff2fd68b9071487700656282383b215c00 100755 (executable)
@@ -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");
index d1d02cd2731cb2c170871344c6438a52347c982a..82f5f368bee49d30b5e98d557a82d63caef33972 100755 (executable)
@@ -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();