]> sipb.mit.edu Git - ikiwiki.git/commitdiff
Merge branch 'master' into cvs
authorJoey Hess <joey@gnu.kitenet.net>
Thu, 10 Sep 2009 17:44:27 +0000 (13:44 -0400)
committerJoey Hess <joey@gnu.kitenet.net>
Thu, 10 Sep 2009 17:44:27 +0000 (13:44 -0400)
15 files changed:
IkiWiki.pm
IkiWiki/CGI.pm
IkiWiki/Plugin/underlay.pm
debian/changelog
doc/banned_users.mdwn
doc/plugins/contrib/cvs.mdwn
doc/plugins/contrib/cvs/discussion.mdwn
doc/plugins/po.mdwn
doc/plugins/table/discussion.mdwn
doc/plugins/underlay.mdwn
doc/roadmap.mdwn
doc/todo/blocking_ip_ranges.mdwn
doc/todo/l10n.mdwn
doc/todo/make_link_target_search_all_paths_as_fallback.mdwn [new file with mode: 0644]
po/underlays/basewiki/shortcuts.cs.po

index 453bc9f8ca0898b97c2242d36367ec2ecb077b13..85d8eea68419cb350e530c322958796186e05b1f 100644 (file)
@@ -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;
index af58d7cb56893a831d5ae798d5c5f16fc96b23fd..52cafade0f9f7f7ae155402464283e22c991a67d 100644 (file)
@@ -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 ($) {
index 380d418fba9919b3023e391bed3237406424f76a..c599356728e39dddcf729f62cbe5e78ada939f50 100644 (file)
@@ -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;
index 6109a70127a709b519d95e5c03bc5440c9f9f81e..2e178171349e37fbb85f7890fb37c4eeb6dd724f 100644 (file)
@@ -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
 
index d2bec90f0459d9016461293bb4c68fa8849f078c..c44f8c587fd12af58e0f0e0275e76d7123b2b57b 100644 (file)
@@ -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.
index fcf5b936f926e19d70d82794666cdbc7dc463838..d4599230004870fff4742326763cfae32746cbda 100644 (file)
@@ -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.
index 1f0ce010211cd7a77eadf7bf563ba6dfd0cc7163..155a2289ddf5dbb44a28283de537de1132e3aa7f 100644 (file)
@@ -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]]
index 38b6b12cdefdd80c897baaaf05e794bc5ef27d08..f3b70b5f786b5f244d8e3ba4ef6a8af0b0f8db2e 100644 (file)
@@ -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
 -------------
index 16e5a5a56e058e8d3415349c586e2649f1475856..86572c93591bef3d12302713635f820d83d3be6d 100644 (file)
@@ -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]] 
index 09d096a6e39bd86d4b49bf284eb1060d2a35fe63..f7eafee7cd7017c319fa6c63f82e4fb70a8a660e 100644 (file)
@@ -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`.
index 2f79f79784ef0efc73c5db8a52a9ff3250dad7f0..a701a26855f7cc548fb83d62da5a08d0ad2a9c8d 100644 (file)
@@ -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.
 
 ----
 
index 95026eef126a4b64c932ae3274d751b7359fe7be..ac2344ece877aa565c696fbb69c817f48ae96747 100644 (file)
@@ -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)
index fed3f63b69b3b667750b917bea6e886f734052f0..a539f04246dc05a108969c98239ddb2dc8ee6d31 100644 (file)
@@ -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]] 
diff --git a/doc/todo/make_link_target_search_all_paths_as_fallback.mdwn b/doc/todo/make_link_target_search_all_paths_as_fallback.mdwn
new file mode 100644 (file)
index 0000000..f971fd8
--- /dev/null
@@ -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.
index c842e249f58f2a01d4d15200010713b127ee6e89..7ae43e31afbab19856c598a1cedc762232284f92 100644 (file)
@@ -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."