* Support pages with utf8 filenames. Patch by Faidon Liambotis.
parent
117e71ec9b
commit
fa9517e5bb
|
@ -3,6 +3,7 @@
|
||||||
package IkiWiki;
|
package IkiWiki;
|
||||||
use warnings;
|
use warnings;
|
||||||
use strict;
|
use strict;
|
||||||
|
use encoding "utf8";
|
||||||
|
|
||||||
use vars qw{%config %links %oldlinks %oldpagemtime %pagectime
|
use vars qw{%config %links %oldlinks %oldpagemtime %pagectime
|
||||||
%renderedfiles %pagesources %depends %hooks};
|
%renderedfiles %pagesources %depends %hooks};
|
||||||
|
@ -340,7 +341,7 @@ sub unlockwiki () { #{{{
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
||||||
sub loadindex () { #{{{
|
sub loadindex () { #{{{
|
||||||
open (IN, "$config{wikistatedir}/index") || return;
|
open (IN, "<:utf8", "$config{wikistatedir}/index") || return;
|
||||||
while (<IN>) {
|
while (<IN>) {
|
||||||
$_=possibly_foolish_untaint($_);
|
$_=possibly_foolish_untaint($_);
|
||||||
chomp;
|
chomp;
|
||||||
|
@ -372,7 +373,7 @@ sub saveindex () { #{{{
|
||||||
if (! -d $config{wikistatedir}) {
|
if (! -d $config{wikistatedir}) {
|
||||||
mkdir($config{wikistatedir});
|
mkdir($config{wikistatedir});
|
||||||
}
|
}
|
||||||
open (OUT, ">$config{wikistatedir}/index") ||
|
open (OUT, ">:utf8", "$config{wikistatedir}/index") ||
|
||||||
error("cannot write to $config{wikistatedir}/index: $!");
|
error("cannot write to $config{wikistatedir}/index: $!");
|
||||||
foreach my $page (keys %oldpagemtime) {
|
foreach my $page (keys %oldpagemtime) {
|
||||||
next unless $oldpagemtime{$page};
|
next unless $oldpagemtime{$page};
|
||||||
|
|
|
@ -308,7 +308,8 @@ sub cgi_editpage ($$) { #{{{
|
||||||
|
|
||||||
# This untaint is safe because titlepage removes any problimatic
|
# This untaint is safe because titlepage removes any problimatic
|
||||||
# characters.
|
# characters.
|
||||||
my ($page)=titlepage(possibly_foolish_untaint(lc($form->param('page'))));
|
my ($page)=Encode::decode_utf8($form->param('page'));
|
||||||
|
$page=titlepage(possibly_foolish_untaint(lc($page)));
|
||||||
if (! defined $page || ! length $page ||
|
if (! defined $page || ! length $page ||
|
||||||
$page=~/$config{wiki_file_prune_regexp}/ || $page=~/^\//) {
|
$page=~/$config{wiki_file_prune_regexp}/ || $page=~/^\//) {
|
||||||
error("bad page name");
|
error("bad page name");
|
||||||
|
@ -353,10 +354,11 @@ sub cgi_editpage ($$) { #{{{
|
||||||
# utf-8, so decode from it.
|
# utf-8, so decode from it.
|
||||||
require Encode;
|
require Encode;
|
||||||
my $content = Encode::decode_utf8($form->field('editcontent'));
|
my $content = Encode::decode_utf8($form->field('editcontent'));
|
||||||
|
my $comments = Encode::decode_utf8($form->field('comments'));
|
||||||
$form->field(name => "editcontent",
|
$form->field(name => "editcontent",
|
||||||
value => $content, force => 1);
|
value => $content, force => 1);
|
||||||
$form->field(name => "comments",
|
$form->field(name => "comments",
|
||||||
value => Encode::decode_utf8($form->field('comments')), force => 1);
|
value => $comments, force => 1);
|
||||||
$form->tmpl_param("page_preview",
|
$form->tmpl_param("page_preview",
|
||||||
htmlize($config{default_pageext},
|
htmlize($config{default_pageext},
|
||||||
linkify($page, $page, $content)));
|
linkify($page, $page, $content)));
|
||||||
|
@ -457,7 +459,7 @@ sub cgi_editpage ($$) { #{{{
|
||||||
}
|
}
|
||||||
if (defined $form->field('comments') &&
|
if (defined $form->field('comments') &&
|
||||||
length $form->field('comments')) {
|
length $form->field('comments')) {
|
||||||
$message.=Encode::decode_utf8(": ".$form->field('comments'));
|
$message.=": ".Encode::decode_utf8($form->field('comments'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($config{rcs}) {
|
if ($config{rcs}) {
|
||||||
|
|
|
@ -324,9 +324,11 @@ sub refresh () { #{{{
|
||||||
my %exists;
|
my %exists;
|
||||||
my @files;
|
my @files;
|
||||||
eval q{use File::Find};
|
eval q{use File::Find};
|
||||||
|
require Encode;
|
||||||
find({
|
find({
|
||||||
no_chdir => 1,
|
no_chdir => 1,
|
||||||
wanted => sub {
|
wanted => sub {
|
||||||
|
$_ = Encode::decode_utf8($_);
|
||||||
if (/$config{wiki_file_prune_regexp}/) {
|
if (/$config{wiki_file_prune_regexp}/) {
|
||||||
$File::Find::prune=1;
|
$File::Find::prune=1;
|
||||||
}
|
}
|
||||||
|
@ -346,6 +348,7 @@ sub refresh () { #{{{
|
||||||
find({
|
find({
|
||||||
no_chdir => 1,
|
no_chdir => 1,
|
||||||
wanted => sub {
|
wanted => sub {
|
||||||
|
$_ = Encode::decode_utf8($_);
|
||||||
if (/$config{wiki_file_prune_regexp}/) {
|
if (/$config{wiki_file_prune_regexp}/) {
|
||||||
$File::Find::prune=1;
|
$File::Find::prune=1;
|
||||||
}
|
}
|
||||||
|
@ -405,7 +408,7 @@ sub refresh () { #{{{
|
||||||
|
|
||||||
if (! exists $oldpagemtime{$page} ||
|
if (! exists $oldpagemtime{$page} ||
|
||||||
mtime(srcfile($file)) > $oldpagemtime{$page}) {
|
mtime(srcfile($file)) > $oldpagemtime{$page}) {
|
||||||
debug("rendering changed file $file");
|
debug("rendering $file");
|
||||||
render($file);
|
render($file);
|
||||||
$rendered{$file}=1;
|
$rendered{$file}=1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,9 @@ ikiwiki (1.8) UNRELEASED; urgency=low
|
||||||
getting in the way of the preview.
|
getting in the way of the preview.
|
||||||
* Centralised all calls to HTML::Template and force all the templates
|
* Centralised all calls to HTML::Template and force all the templates
|
||||||
to be read as utf8.
|
to be read as utf8.
|
||||||
|
* Support pages with utf8 filenames. Patch by Faidon Liambotis.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Sun, 2 Jul 2006 14:55:40 -0400
|
-- Joey Hess <joeyh@debian.org> Mon, 3 Jul 2006 16:09:16 -0400
|
||||||
|
|
||||||
ikiwiki (1.7) unstable; urgency=low
|
ikiwiki (1.7) unstable; urgency=low
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue