Merge branch 'master' into cvs
commit
81a9b5feff
13
IkiWiki.pm
13
IkiWiki.pm
|
@ -33,6 +33,7 @@ use Memoize;
|
|||
memoize("abs2rel");
|
||||
memoize("pagespec_translate");
|
||||
memoize("file_pruned");
|
||||
memoize("template_file");
|
||||
|
||||
sub getsetup () {
|
||||
wikiname => {
|
||||
|
@ -149,6 +150,13 @@ sub getsetup () {
|
|||
safe => 0, # path
|
||||
rebuild => 1,
|
||||
},
|
||||
templatedirs => {
|
||||
type => "internal",
|
||||
default => [],
|
||||
description => "additional directories containing template files",
|
||||
safe => 0,
|
||||
rebuild => 0,
|
||||
},
|
||||
underlaydir => {
|
||||
type => "string",
|
||||
default => "$installdir/share/ikiwiki/basewiki",
|
||||
|
@ -356,7 +364,7 @@ sub getsetup () {
|
|||
},
|
||||
web_commit_regexp => {
|
||||
type => "internal",
|
||||
default => qr/^web commit (by (.*?(?=: |$))|from (\d+\.\d+\.\d+\.\d+)):?(.*)/,
|
||||
default => qr/^web commit (by (.*?(?=: |$))|from ([0-9a-fA-F:.]+[0-9a-fA-F])):?(.*)/,
|
||||
description => "regexp to parse web commits from logs",
|
||||
safe => 0,
|
||||
rebuild => 0,
|
||||
|
@ -1609,7 +1617,8 @@ sub saveindex () {
|
|||
sub template_file ($) {
|
||||
my $template=shift;
|
||||
|
||||
foreach my $dir ($config{templatedir}, "$installdir/share/ikiwiki/templates") {
|
||||
foreach my $dir ($config{templatedir}, @{$config{templatedirs}},
|
||||
"$installdir/share/ikiwiki/templates") {
|
||||
return "$dir/$template" if -e "$dir/$template";
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -252,16 +252,30 @@ sub check_banned ($$) {
|
|||
my $q=shift;
|
||||
my $session=shift;
|
||||
|
||||
my $banned=0;
|
||||
my $name=$session->param("name");
|
||||
if (defined $name) {
|
||||
if (grep { $name eq $_ } @{$config{banned_users}}) {
|
||||
$session->delete();
|
||||
cgi_savesession($session);
|
||||
cgi_custom_failure(
|
||||
$q->header(-status => "403 Forbidden"),
|
||||
gettext("You are banned."));
|
||||
if (defined $name &&
|
||||
grep { $name eq $_ } @{$config{banned_users}}) {
|
||||
$banned=1;
|
||||
}
|
||||
|
||||
foreach my $b (@{$config{banned_users}}) {
|
||||
if (pagespec_match("", $b,
|
||||
ip => $ENV{REMOTE_ADDR},
|
||||
name => defined $name ? $name : "",
|
||||
)) {
|
||||
$banned=1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
if ($banned) {
|
||||
$session->delete();
|
||||
cgi_savesession($session);
|
||||
cgi_custom_failure(
|
||||
$q->header(-status => "403 Forbidden"),
|
||||
gettext("You are banned."));
|
||||
}
|
||||
}
|
||||
|
||||
sub cgi_getsession ($) {
|
||||
|
|
|
@ -27,14 +27,21 @@ sub getsetup () {
|
|||
safe => 0,
|
||||
rebuild => 1,
|
||||
},
|
||||
add_templates => {
|
||||
type => "string",
|
||||
default => [],
|
||||
description => "extra template directories to add",
|
||||
advanced => 1,
|
||||
safe => 0,
|
||||
rebuild => 1,
|
||||
},
|
||||
}
|
||||
|
||||
sub checkconfig () {
|
||||
return unless exists $config{add_underlays};
|
||||
|
||||
foreach my $dir (@{$config{add_underlays}}) {
|
||||
add_underlay($dir);
|
||||
}
|
||||
push @{$config{templatedirs}}, @{$config{add_templates}};
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -2,6 +2,11 @@ ikiwiki (3.14159265) UNRELEASED; urgency=low
|
|||
|
||||
* Add French basewiki translation from the Debian French l10n team,
|
||||
including Philippe Batailler, Alexandre Dupas, and Steve Petruzzello.
|
||||
* Expand banned_users; it can now include PageSpecs, which
|
||||
allows banning by IP address.
|
||||
* underlay: Also allow configuring additional directories to search
|
||||
for template files in.
|
||||
* Fix parsing web commits from ipv6 addresses.
|
||||
|
||||
-- Joey Hess <joeyh@debian.org> Wed, 02 Sep 2009 15:01:27 -0400
|
||||
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
Banned users can be configured in the setup file.
|
||||
Banned users can be configured in the setup file via the `banned_users`
|
||||
setting. This is a list of user names, or [[PageSpecs|ikiwiki/PageSpec]]
|
||||
to ban. Using a PageSpec is useful to block an IP address.
|
||||
|
||||
For example:
|
||||
|
||||
banned_users => ['evilspammer', 'ip(192.168.1.1)'],
|
||||
|
||||
If a banned user attempts to use the ikiwiki CGI, they will receive a 403
|
||||
Forbidden webpage indicating they are banned.
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
This plugin allows ikiwiki to use [[!wikipedia desc="CVS" Concurrent Versions System]] as an [[rcs]].
|
||||
|
||||
### Usage
|
||||
7. Install [cvsps](http://www.cobite.com/cvsps/), [[!cpan
|
||||
File::ReadBackwards]], and
|
||||
7. Install [[!cpan File::chdir]], [[!cpan File::ReadBackwards]],
|
||||
[cvsps](http://www.cobite.com/cvsps/), and
|
||||
[cvsweb](http://www.freebsd.org/projects/cvsweb.html) or the like.
|
||||
7. Adjust CVS-related parameters in your setup file.
|
||||
|
||||
|
@ -22,9 +22,9 @@ Consider creating `$HOME/.cvsrc` if you don't have one already; the plugin doesn
|
|||
* `cvs.pm` started life as a copy of [[3.14159|news/version_3.14159]]'s `svn.pm`.
|
||||
* `IkiWiki.pm:wiki_file_prune_regexps` avoids copying CVS metadata
|
||||
into `$DESTDIR`.
|
||||
* `IkiWiki/Wrapper.pm` avoids calling ikiwiki from post-commit if it's a
|
||||
directory being `cvs add`ed (this check is only compiled into the wrapper
|
||||
iff the configured VCS is "cvs").
|
||||
* `IkiWiki/Wrapper.pm` provides a new "wrapperargcheck" hook, which
|
||||
the plugin implements to avoid calling ikiwiki from post-commit
|
||||
(and locking against itself) if it's a directory being `cvs add`ed.
|
||||
* [[ikiwiki-makerepo]]:
|
||||
* creates a repository,
|
||||
* imports `$SRCDIR` into top-level module `ikiwiki` (vendor tag IKIWIKI, release tag PRE_CVS),
|
||||
|
@ -32,6 +32,5 @@ iff the configured VCS is "cvs").
|
|||
* CVS multi-directory commits happen separately; the post-commit hook sees only the first directory's changes in time for [[recentchanges|plugins/recentchanges]]. The next run of `ikiwiki --setup` will correctly re-render such a recentchanges entry. It should be possible to solve this problem with NetBSD's `commit_prep` and `log_accum` scripts (see below).
|
||||
|
||||
### To do
|
||||
* Add automated tests. (Blindly adding svn-like tests to `t/file_pruned.t` doesn't do the trick.)
|
||||
* Instead of resource-intensively scraping changesets with `cvsps`, have `ikiwiki-makerepo` set up NetBSD-like `log_accum` and `commit_prep` scripts that coalesce and keep records of commits. `cvsps` can be used as a fallback for repositories without such records.
|
||||
* Perhaps prevent web edits from attempting to create `.../CVS/foo.mdwn` (and `.../cvs/foo.mdwn` on case-insensitive filesystems); thanks to the CVS metadata directory, the attempt will fail anyway (and much more confusingly) if we don't.
|
||||
|
|
|
@ -125,3 +125,19 @@ to pass to the command.
|
|||
|
||||
> Thanks for reading carefully. I've tested your suggestions and
|
||||
> applied them on my branch. --[[schmonz]]
|
||||
|
||||
----
|
||||
|
||||
I've abstracted out CVS's involvement in the wrapper, adding a new
|
||||
"wrapperargcheck" hook to examine `argc/argv` and return success or
|
||||
failure (failure causes the wrapper to terminate) and implementing
|
||||
this hook in the plugin. In the non-CVS case, the check immediately
|
||||
returns success, so the added overhead is just a function call.
|
||||
|
||||
Given how rarely anything should need to reach in and modify the
|
||||
wrapper -- I'd go so far as to say we shouldn't make it too easy
|
||||
-- I don't think it's worth the effort to try and design a more
|
||||
general-purpose way to do so. If and when some other problem thinks
|
||||
it wants to be solved by a new wrapper hook, it's easy enough to add
|
||||
one. Until then, I'd say it's more important to keep the wrapper as
|
||||
short and clear as possible. --[[schmonz]]
|
||||
|
|
|
@ -317,27 +317,8 @@ text, or text in whatever single language ikiwiki is configured to "speak".
|
|||
Maybe there could be a way to switch ikiwiki to speaking another language
|
||||
when building a non-english page? Then the directives would get translated.
|
||||
|
||||
2 test suite failures
|
||||
--------------------
|
||||
|
||||
t/po is currently failing tests 57 and 59 (and I would like to release
|
||||
soon..) --[[Joey]]
|
||||
|
||||
> They are failing because of commit cdc3576c8d1e (po: do not inject
|
||||
> custom bestlink function when `po_link_to` eq `default`). The test
|
||||
> suite changes `$config{po_link_to}`, but the `checkconfig` hook is
|
||||
> not re-run. I could manually run it when needed in the test-suite,
|
||||
> but this would lead to this function being injected several times,
|
||||
> and then `$origsubs{'bestlink'}` to be sometimes set to a wrong
|
||||
> value, which would break other parts of the test-suite. The best
|
||||
> solution I can think of (apart of reverting this commit or disabling
|
||||
> these two tests) is to split the test-suite into 3 parts, depending
|
||||
> on the `$config{po_link_to}` setting, either in 3 different `.t`
|
||||
> files, or inside the existing one and completely reset the IkiWiki
|
||||
> environment at the start of these parts... which I did not manage to
|
||||
> achieve in the last 2 hours :/ --[[intrigeri]]
|
||||
|
||||
>> I've reverted it. --[[Joey]]
|
||||
(We also will need this in order to use translated templates, when they are
|
||||
available.)
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
|
|
@ -64,3 +64,10 @@ Do you like it? Can you implement the same in Ikiwiki? :) --[[Paweł|ptecza]]
|
|||
>> was written rather for simple usage. However cell alignment is very
|
||||
>> helpful feature, so I think the plugin should be able to do it.
|
||||
>> --[[Paweł|ptecza]]
|
||||
|
||||
-----
|
||||
|
||||
If you see `[[!table\ Error: ]]` you probably need to `sudo apt-get install libtext-csv-perl`.
|
||||
|
||||
> Perhaps more helpfully, ikiwiki 3.1415926 fixes display of such errors to
|
||||
> actualy include the error message. --[[Joey]]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[[!template id=plugin name=underlay author="[[Simon_McVittie|smcv]]"]]
|
||||
[[!tag type/useful]]
|
||||
|
||||
This plugin adds an `add_underlays` option to the `.setup` file.
|
||||
This plugin adds an `add_underlays` option to the setup file.
|
||||
Its value is a list of underlay directories whose content is added to the wiki.
|
||||
|
||||
Multiple underlays are normally set up automatically by other plugins (for
|
||||
|
@ -12,3 +12,9 @@ like photos or software releases.
|
|||
Directories in `add_underlays` should usually be absolute. If relative, they're
|
||||
interpreted as relative to the parent directory of the basewiki underlay, which
|
||||
is probably not particularly useful in this context.
|
||||
|
||||
--
|
||||
|
||||
This plugin also adds an `add_templates` option to the setup file.
|
||||
Its value is a list of template directories to look for template files in,
|
||||
if they are not present in the `templatedir`.
|
||||
|
|
|
@ -7,7 +7,7 @@ This is the roadmap for ikiwiki development.
|
|||
|
||||
Released 29 April 2006.
|
||||
|
||||
The 1.x series is no longer supported.
|
||||
The 1.X series is no longer supported.
|
||||
|
||||
----
|
||||
|
||||
|
|
|
@ -2,3 +2,6 @@ Admins need the ability to block IP ranges. They can already ban users.
|
|||
|
||||
See [[fileupload]] for a propsal that grew to encompass the potential to do
|
||||
this.
|
||||
|
||||
[[done]] (well, there is no pagespec for IP ranges yet, but we can block
|
||||
individual IPs)
|
||||
|
|
|
@ -14,6 +14,8 @@ and there is a po/ikiwiki.pot in the source that can be translated.
|
|||
|
||||
----
|
||||
|
||||
## template i18n
|
||||
|
||||
From [[Recai]]:
|
||||
> Here is my initial work on ikiwiki l10n infrastructure (I'm sending it
|
||||
> before finalizing, there may be errors).
|
||||
|
@ -64,9 +66,19 @@ Birisi[1], ki muhtemelen bu sizsiniz, <TMPL_VAR WIKINAME>[2] üzerindeki
|
|||
bulundu. Parola: <TMPL_VAR USER_PASSWORD> -- ikiwiki [1] Parolayı isteyen
|
||||
kullanıcının ait IP adresi: <TMPL_VAR REMOTE_ADDR>[2] <TMPL_VAR WIKIURL>
|
||||
|
||||
> Looks like, tmpl_process3 cannot preserve line breaks in template files.
|
||||
> For example, it processed the following template:
|
||||
|
||||
This could be easily worked around in tmpl_process3, but I wouldn't like to
|
||||
maintain a separate utility.
|
||||
|
||||
----
|
||||
|
||||
Another way to approach this would be to write a small program that outputs
|
||||
the current set of templates. Now i18n of that program is trivial,
|
||||
and it can be run once per language to generate localized templates.
|
||||
|
||||
Then it's just a matter of installing the templates somewhere, and having
|
||||
them be used when a different language is enabled.
|
||||
|
||||
It would make sense to make the existing `locale` setting control which
|
||||
templates are used. But the [[plugins/po]] plugin would probably want to do
|
||||
something more, and use the actual language the page is written in.
|
||||
--[[Joey]]
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
[[!tag wishlist]]
|
||||
|
||||
## Idea
|
||||
|
||||
After searching from the most local to the root for a wikilinkable page, descend into the tree of pages looking for a matching page.
|
||||
|
||||
For example, if I link to \[\[Pastrami\]\] from /users/eric, the current behavior is to look for
|
||||
|
||||
* /users/eric/pastrami
|
||||
* /users/pastrami
|
||||
* /users/eric/pastrami
|
||||
|
||||
I'd like it to find /sandwiches/pastrami.
|
||||
|
||||
## Issues
|
||||
|
||||
I know this is a tougher problem, especially to scale efficiently. There is also not a clear ordering unless it is the recursive dictionary ordering (ie the order of a breadth-first search with natural ordering). It would probably require some sort of static lookup table keyed by pagename and yielding a path. This could be generated initially by a breadth-first search and then updated incrementally when pages are added/removed/renamed. In some ways a global might not be ideal, since one might argue that the link above should match /users/eric/sandwiches/pastrami before /sandwiches/pastrami. I guess you could put all matching paths in the lookup table and then evaluate the ordering at parse-time.
|
||||
|
||||
## Motivation
|
||||
|
||||
Since I often access my documents using a text editor, I find it useful to keep them ordered in a heirarchy, about 3 levels deep with a branching factor of perhaps 10. When linking though, I'd like the wiki to find the document for me, since I am lazy.
|
||||
|
||||
Also, many of my wiki pages comprise the canonical local representation of some unique entity, for example I might have /software/ikiwiki. The nesting, however, is only to aid navigation, and shouldn't be considered as part of resource's name.
|
||||
|
||||
## Alternatives
|
||||
|
||||
If an alias could be specified in the page body (for example, /ikiwiki for /software/ikiwiki) which would then stand in for a regular page when searching, then the navigational convenience of folders could be preserved while selectively flattening the search namespace.
|
|
@ -198,7 +198,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Pro přidání nové zkratky použijte [[direktivu|ikiwiki/directive]] "
|
||||
"`shortcut`. Řetězec „%s“ je v adrese nahrazen textem předaným dané zkratce. "
|
||||
"Tento text je automaticky zakódován ([[! wikipedia url_encoding]]) do podoby "
|
||||
"Tento text je automaticky zakódován ([[!wikipedia url_encoding]]) do podoby "
|
||||
"vhodné pro url. Nechcete-li text kódovat, použijte „%S“. Volitelný parametr "
|
||||
"`desc` dovoluje změnit popis odkazu."
|
||||
|
||||
|
|
Loading…
Reference in New Issue