For fine control over what characters are allowed, unescaped in source filenames, the wiki_file_chars setting is added. For example, set to "-[:alnum:]+/._" to disable colons from being used in source files (which can cause trouble om Windows).

master
Joey Hess 2008-09-04 14:13:10 -04:00
parent 57153dcb9b
commit d2679de965
4 changed files with 48 additions and 26 deletions

View File

@ -312,9 +312,15 @@ sub getsetup () { #{{{
safe => 0,
rebuild => 1,
},
wiki_file_chars => {
type => "string",
description => "specifies the characters that are allowed in source filenames",
default => "-[:alnum:]+/.:_",
safe => 0,
rebuild => 1,
},
wiki_file_regexp => {
type => "internal",
default => qr/(^[-[:alnum:]_.:\/+]+$)/,
description => "regexp of legal source files",
safe => 0,
rebuild => 1,
@ -413,6 +419,10 @@ sub checkconfig () { #{{{
$gettext_obj=undef;
}
}
if (! defined $config{wiki_file_regexp}) {
$config{wiki_file_regexp}=qr/(^[$config{wiki_file_chars}]+$)/;
}
if (ref $config{ENV} eq 'HASH') {
foreach my $val (keys %{$config{ENV}}) {
@ -770,7 +780,7 @@ sub bestlink ($$) { #{{{
elsif (exists $pagecase{lc $l}) {
return $pagecase{lc $l};
}
} while $cwd=~s!/?[^/]+$!!;
} while $cwd=~s{/?[^/]+$}{};
if (length $config{userdir}) {
my $l = "$config{userdir}/".lc($link);
@ -808,13 +818,16 @@ sub pagetitle ($;$) { #{{{
sub titlepage ($) { #{{{
my $title=shift;
$title=~s/([^-[:alnum:]:+\/.])/$1 eq ' ' ? '_' : "__".ord($1)."__"/eg;
# support use w/o %config set
my $chars = defined $config{wiki_file_chars} ? $config{wiki_file_chars} : "-[:alnum:]+/.:_";
$title=~s/([^$chars]|_)/$1 eq ' ' ? '_' : "__".ord($1)."__"/eg;
return $title;
} #}}}
sub linkpage ($) { #{{{
my $link=shift;
$link=~s/([^-[:alnum:]:+\/._])/$1 eq ' ' ? '_' : "__".ord($1)."__"/eg;
my $chars = defined $config{wiki_file_chars} ? $config{wiki_file_chars} : "-[:alnum:]+/.:_";
$link=~s/([^$chars])/$1 eq ' ' ? '_' : "__".ord($1)."__"/eg;
return $link;
} #}}}

4
debian/changelog vendored
View File

@ -11,6 +11,10 @@ ikiwiki (2.63) UNRELEASED; urgency=low
if no mime type is detected.
* table: Support header=column to make the table header be the first
column of the data. (AlexandreDupas)
* For fine control over what characters are allowed, unescaped in source filenames,
the wiki_file_chars setting is added. For example, set to "-[:alnum:]+/._" to
disable colons from being used in source files (which can cause trouble
om Windows).
-- Joey Hess <joeyh@debian.org> Thu, 28 Aug 2008 16:08:18 -0400

View File

@ -60,6 +60,11 @@ Windows does not support filenames containing any of these characters: `/ \ * :
>>> source on windows systems is desired, you'd have to remember to turn
>>> that on when setting up a wiki, even if the wiki was hosted on unix.
>>>
>>> Ok, `wiki_file_chars` config option added, set to
>>> `"-[:alnum:]+/._"` to exclude colons from filenames read or written by
>>> ikiwiki. [[done]]
>>>
>>> BTW, I suspect there are lots of other problems with actually running
>>> ikiwiki on windows, including its assumption that the directory
>>> separator is "/". --[[Joey]]
>>> separator is "/". Windows will be supported when someone sends me a
>>> comprehansive and not ugly or performance impacting patch. :-) --[[Joey]]

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-08-28 13:05-0400\n"
"POT-Creation-Date: 2008-09-04 14:10-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -16,62 +16,62 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../IkiWiki/CGI.pm:139
#: ../IkiWiki/CGI.pm:140
msgid "You need to log in first."
msgstr ""
#: ../IkiWiki/CGI.pm:171
#: ../IkiWiki/CGI.pm:172
msgid "login failed, perhaps you need to turn on cookies?"
msgstr ""
#: ../IkiWiki/CGI.pm:189 ../IkiWiki/CGI.pm:538
#: ../IkiWiki/CGI.pm:190 ../IkiWiki/CGI.pm:539
msgid "Your login session has expired."
msgstr ""
#: ../IkiWiki/CGI.pm:210
#: ../IkiWiki/CGI.pm:211
msgid "Login"
msgstr ""
#: ../IkiWiki/CGI.pm:211
#: ../IkiWiki/CGI.pm:212
msgid "Preferences"
msgstr ""
#: ../IkiWiki/CGI.pm:212
#: ../IkiWiki/CGI.pm:213
msgid "Admin"
msgstr ""
#: ../IkiWiki/CGI.pm:279
#: ../IkiWiki/CGI.pm:280
msgid "Preferences saved."
msgstr ""
#: ../IkiWiki/CGI.pm:338
#: ../IkiWiki/CGI.pm:339
#, perl-format
msgid "%s is not an editable page"
msgstr ""
#: ../IkiWiki/CGI.pm:449 ../IkiWiki/Plugin/brokenlinks.pm:33
#: ../IkiWiki/CGI.pm:450 ../IkiWiki/Plugin/brokenlinks.pm:33
#: ../IkiWiki/Plugin/inline.pm:310 ../IkiWiki/Plugin/opendiscussion.pm:26
#: ../IkiWiki/Plugin/orphans.pm:37 ../IkiWiki/Render.pm:78
#: ../IkiWiki/Render.pm:148
msgid "discussion"
msgstr ""
#: ../IkiWiki/CGI.pm:505
#: ../IkiWiki/CGI.pm:506
#, perl-format
msgid "creating %s"
msgstr ""
#: ../IkiWiki/CGI.pm:523 ../IkiWiki/CGI.pm:551 ../IkiWiki/CGI.pm:561
#: ../IkiWiki/CGI.pm:596 ../IkiWiki/CGI.pm:641
#: ../IkiWiki/CGI.pm:524 ../IkiWiki/CGI.pm:552 ../IkiWiki/CGI.pm:562
#: ../IkiWiki/CGI.pm:597 ../IkiWiki/CGI.pm:642
#, perl-format
msgid "editing %s"
msgstr ""
#: ../IkiWiki/CGI.pm:666
#: ../IkiWiki/CGI.pm:667
msgid "You are banned."
msgstr ""
#: ../IkiWiki/CGI.pm:783 ../IkiWiki/CGI.pm:784 ../IkiWiki.pm:1117
#: ../IkiWiki/CGI.pm:784 ../IkiWiki/CGI.pm:785 ../IkiWiki.pm:1132
msgid "Error"
msgstr ""
@ -673,11 +673,11 @@ msgstr ""
msgid "empty data"
msgstr ""
#: ../IkiWiki/Plugin/table.pm:101
#: ../IkiWiki/Plugin/table.pm:100
msgid "Direct data download"
msgstr ""
#: ../IkiWiki/Plugin/table.pm:135
#: ../IkiWiki/Plugin/table.pm:134
#, perl-format
msgid "parse fail at line %d: %s"
msgstr ""
@ -865,20 +865,20 @@ msgstr ""
msgid "refreshing wiki.."
msgstr ""
#: ../IkiWiki.pm:434
#: ../IkiWiki.pm:444
msgid "Must specify url to wiki with --url when using --cgi"
msgstr ""
#: ../IkiWiki.pm:478
#: ../IkiWiki.pm:490
msgid "cannot use multiple rcs plugins"
msgstr ""
#: ../IkiWiki.pm:1100
#: ../IkiWiki.pm:1115
#, perl-format
msgid "preprocessing loop detected on %s at depth %i"
msgstr ""
#: ../IkiWiki.pm:1588
#: ../IkiWiki.pm:1603
msgid "yes"
msgstr ""