summaryrefslogtreecommitdiff
path: root/doc/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'doc/plugins')
-rw-r--r--doc/plugins/anonok.mdwn9
-rw-r--r--doc/plugins/comments/discussion.mdwn27
-rw-r--r--doc/plugins/contrib/album.mdwn101
-rw-r--r--doc/plugins/contrib/default_content_for___42__copyright__42___and___42__license__42__.mdwn6
-rw-r--r--doc/plugins/contrib/mediawiki.mdwn2
-rw-r--r--doc/plugins/contrib/mediawiki/discussion.mdwn5
-rw-r--r--doc/plugins/contrib/trail.mdwn61
-rw-r--r--doc/plugins/map/discussion.mdwn29
-rw-r--r--doc/plugins/po.mdwn296
-rw-r--r--doc/plugins/po/discussion.mdwn (renamed from doc/plugins/contrib/po.mdwn)253
-rw-r--r--doc/plugins/rst/discussion.mdwn13
-rw-r--r--doc/plugins/write.mdwn54
12 files changed, 843 insertions, 13 deletions
diff --git a/doc/plugins/anonok.mdwn b/doc/plugins/anonok.mdwn
index a3fec4d89..506657a1c 100644
--- a/doc/plugins/anonok.mdwn
+++ b/doc/plugins/anonok.mdwn
@@ -5,8 +5,13 @@ By default, anonymous users cannot edit the wiki. This plugin allows
anonymous web users, who have not signed in, to edit any page in the wiki
by default.
-The plugin also has a configuration setting, `anonok_pagespec`. This
-[[PageSpec]] can be used to allow anonymous editing of matching pages.
+Please think twice before enabling this plugin. If your wiki is accessible
+to the internet, it *will* be subject to spamming if this plugin is
+enabled. Such spam is not only a pain to deal with, but it bloats the
+revision control history of your wiki.
+
+The plugin has a configuration setting, `anonok_pagespec`. This
+[[ikiwiki/PageSpec]] can be used to allow anonymous editing of matching pages.
If you're using the [[comments]] plugin, you can allow anonymous comments
to be posted by setting:
diff --git a/doc/plugins/comments/discussion.mdwn b/doc/plugins/comments/discussion.mdwn
index 3d7452b9a..396d1f6d4 100644
--- a/doc/plugins/comments/discussion.mdwn
+++ b/doc/plugins/comments/discussion.mdwn
@@ -161,3 +161,30 @@ Raw HTML was not initially allowed by default (this was configurable).
>>> all directives will contine to be inexpensive and safe enough that it's
>>> sensible to allow users to (ab)use them on open wikis.
>>> --[[Joey]]
+
+----
+
+I have a test ikiwiki setup somewhere to investigate adopting the comments
+plugin. It is setup with no auth enabled and I got hammered with a spam attack
+over the last weekend (predictably). What surprised me was the scale of the
+attack: ikiwiki eventually triggered OOM and brought the box down. When I got
+it back up, I checked out a copy of the underlying git repository, and it
+measured 280M in size after being packed. Of that, about 300K was data prior
+to the spam attack, so the rest was entirely spam text, compressed via git's
+efficient delta compression.
+
+I had two thoughts about possible improvements to the comments plugin in the
+wake of this:
+
+ * comment pagination - there is a hard-to-define upper limit on the number
+ of comments that can be appended to a wiki page whilst the page remains
+ legible. It would be useful if comments could be paginated into sub-pages.
+
+ * crude flood control - asides from spam attacks (and I am aware of
+ [[plugins/blogspam]]), people can crap flood or just aggressively flame
+ repeatedly. An interesting prevention measure might be to not let an IP
+ post more than 3 sequential comments to a page, or to the site, without
+ at least one other comment being interleaved. I say 3 rather than 2 since
+ correction follow-ups are common.
+
+-- [[Jon]]
diff --git a/doc/plugins/contrib/album.mdwn b/doc/plugins/contrib/album.mdwn
new file mode 100644
index 000000000..f550ca64c
--- /dev/null
+++ b/doc/plugins/contrib/album.mdwn
@@ -0,0 +1,101 @@
+[[!template id=plugin name=album author="[[Simon_McVittie|smcv]]"]]
+[[!template id=gitbranch branch=smcv/album author="[[Simon_McVittie|smcv]]"]]
+[[!tag type/chrome]]
+
+Available from [[smcv]]'s git repository, in the `album` branch
+([[users/smcv/gallery|users/smcv/gallery]] contains some older
+thoughts about this plugin).
+
+This plugin formats a collection of images into a photo album,
+in the same way as many websites: good examples include the
+PHP application [Gallery](http://gallery.menalto.com/), Flickr,
+and Facebook's Photos "application". I've called it `album`
+to distinguish it from [[contrib/gallery|plugins/contrib/gallery]],
+although `gallery` might well be a better name for this functionality.
+
+The web UI I'm trying to achieve consists of one
+[HTML page of thumbnails](http://www.pseudorandom.co.uk/2008/2008-03-08-panic-cell-gig/)
+as an entry point to the album, where each thumbnail links to
+[a "viewer" HTML page](http://www.pseudorandom.co.uk/2008/2008-03-08-panic-cell-gig/img_0068/)
+with a full size image, next/previous thumbnail links, and
+[[plugins/comments]].
+
+(The Summer of Code [[plugins/contrib/gallery]] plugin does the
+next/previous UI in Javascript using Lightbox, which means that
+individual photos can't be bookmarked in a meaningful way, and
+the best it can do as a fallback for non-Javascript browsers
+is to provide a direct link to the image.)
+
+## Writing the viewers
+
+ \[[!albumimage image=foo.jpg album=myalbum
+ title=...
+ caption=...
+ copyright=...
+ size=...
+ viewertemplate=...
+ ]]
+
+Each viewer contains one `\[[!albumimage]]` directive. This
+sets the `image` filename, the `album` in which this image appears,
+and an optional `caption`, and can override the `size` at which to
+display the image and the `viewertemplate` to use to display the
+image.
+
+It can also have `title`, `copyright` and `date` parameters, which
+are short-cuts for [[ikiwiki/directive/meta]] directives.
+
+The viewer can also have any other content, but typically the
+directive will be the only thing there.
+
+Eventually, there will be a specialized CGI user interface to
+edit all the photos of an album at once, upload a new photo
+(which will attach the photo but also write out a viewer page
+for it), or mark an already-uploaded photo as a member of an
+album (which is done by writing out a viewer page for it).
+
+The `\[[!albumimage]]` directive is replaced by an
+[[ikiwiki/directive/img]], wrapped in some formatting using a
+template (by default `albumviewer.tmpl`). The template can (and
+should) also include "next photo", "previous photo" and
+"up to gallery" links.
+
+The next/previous links are themselves implemented by
+[[inlining|ikiwiki/directive/inline]] the next or previous
+photo, using a special template (by default `albumnext.tmpl`
+or `albumprev.tmpl`), in `archive`/`quick` mode.
+
+## Writing the album
+
+The album contains one `\[[!album]]` directive. It may also
+contain any number of `\[[!albumsection]]` directives, for
+example the demo album linked above could look like:
+
+ \[[!album]]
+ <!-- replaced with one uncategorized photo -->
+
+ ## Gamarra
+
+ \[[!albumsection filter="link(gamarra)"]]
+ <!-- all the Gamarra photos -->
+
+ ## Smokescreen
+
+ \[[!albumsection filter="link(smokescreen)"]]
+ <!-- all the Smokescreen photos -->
+
+ ...
+
+The `\[[!album]]` directive is replaced by an
+[[ikiwiki/directive/inline]] which automatically includes every
+page that has an `\[[!albumimage]]` directive linking it to this
+album, except those that will appear in an `\[[!albumsection]]`.
+
+The `inline` is in `archive`/`quick` mode, but includes some
+extra information about the images, including file size and a
+thumbnail (again, made using [[ikiwiki/directive/img]]). The
+default template is `albumitem.tmpl`, which takes advantage
+of these things.
+
+Each `\[[!albumsection]]` is replaced by a similar inline, which
+selects a subset of the photos in the album.
diff --git a/doc/plugins/contrib/default_content_for___42__copyright__42___and___42__license__42__.mdwn b/doc/plugins/contrib/default_content_for___42__copyright__42___and___42__license__42__.mdwn
index 5e3db3d7c..b9ad3cc8e 100644
--- a/doc/plugins/contrib/default_content_for___42__copyright__42___and___42__license__42__.mdwn
+++ b/doc/plugins/contrib/default_content_for___42__copyright__42___and___42__license__42__.mdwn
@@ -39,3 +39,9 @@ I'm missing something terribly obvious? --Peter
By the way: these need not be *HTML* files; `copyright.mdwn`,
respectively `license.mdwn`, or every other format supported
by ikiwiki are likewise fine. --[[tschwinge]]
+
+> Jon has done something similar in [[todo/allow_site-wide_meta_definitions]];
+> his version has the advantages that it doesn't invent magical page names,
+> and can extend beyond just copyright and license, but has the disadvantage
+> that it doesn't support setting defaults for a given "subdirectory"
+> only. --[[smcv]]
diff --git a/doc/plugins/contrib/mediawiki.mdwn b/doc/plugins/contrib/mediawiki.mdwn
index c0a23254f..7bf1ba0df 100644
--- a/doc/plugins/contrib/mediawiki.mdwn
+++ b/doc/plugins/contrib/mediawiki.mdwn
@@ -3,3 +3,5 @@
[The Mediawiki plugin](http://u32.net/Mediawiki_Plugin/) allows ikiwiki to
process pages written using MediaWiki markup.
+
+Available at <http://alcopop.org/~jon/mediawiki.pm>
diff --git a/doc/plugins/contrib/mediawiki/discussion.mdwn b/doc/plugins/contrib/mediawiki/discussion.mdwn
new file mode 100644
index 000000000..5066d9de5
--- /dev/null
+++ b/doc/plugins/contrib/mediawiki/discussion.mdwn
@@ -0,0 +1,5 @@
+Anyone know a safe place where this plugin can be found? -- mjr at phonecoop.coop
+
+> I ended up doing a backassward way of doing it, as described at the [convert discussion page](http://ikiwiki.info/tips/convert_mediawiki_to_ikiwiki/discussion/). -[[simonraven]]
+
+>> I've mirrored it at <http://alcopop.org/~jon/mediawiki.pm>. -- [[Jon]]
diff --git a/doc/plugins/contrib/trail.mdwn b/doc/plugins/contrib/trail.mdwn
new file mode 100644
index 000000000..52dea52d6
--- /dev/null
+++ b/doc/plugins/contrib/trail.mdwn
@@ -0,0 +1,61 @@
+[[!tag type/chrome patch]]
+[[!template id=gitbranch branch=smcv/trail author="[[smcv]]"]]
+
+Available from [[smcv]]'s git repository, in the `trail` branch. This
+plugin aims to solve [[todo/wikitrails]] in a simpler way.
+
+Joey: what do you think of this plugin? If you like the general approach
+and are likely to include it in ikiwiki, I'll try to modify
+[[plugins/contrib/album]] to be based on it, rather than partially
+reinventing it.
+
+This plugin can benefit from
+[[another_of_my_branches|todo/inline_plugin:_specifying_ordered_page_names]]
+but does not require it.
+
+----
+
+[[!template id=plugin name=trail author="[[Simon_McVittie|smcv]]"]]
+
+It's sometimes useful to have "trails" of pages in a wiki, as a guided
+tour, sequence of chapters etc. In this plugin, a trail is represented
+by a page, and the pages in the trail are indicated by specially marked
+links within that page.
+
+If using the default `page.tmpl`, each page automatically displays the
+trails that it's a member of (if any), with links to the trail and to
+the next and previous members.
+
+The `traillink` [[ikiwiki/directive]] is used to record which pages
+are in a trail, and simultaneously link to them. Alternatively, the
+[[ikiwiki/directive/inline]] directive can be used with `trail=yes`
+to record the inlined pages as part of the trail, in the order in
+which they are inlined.
+
+## Directives
+
+(These will go to the appropriate pages in [[ikiwiki/directive]] if this
+plugin is included in ikiwiki.)
+
+### traillink
+
+The `traillink` directive is supplied by the [[!iki plugins/contrib/trail desc=trail]]
+plugin. This directive appears on the page representing a trail. It acts
+as a visible [[ikiwiki/WikiLink]], but also records the linked page as
+a member of the trail.
+
+Various syntaxes can be used:
+
+ \[[!traillink Badgers]]
+ \[[!traillink How_to_find_mushrooms_using_badgers|badgers]]
+ \[[!traillink badgers text="How to find mushrooms using badgers"]]
+
+### trailoptions
+
+The `trailoptions` directive is supplied by the [[!iki plugins/contrib/trail desc=trail]]
+plugin. This directive appears on the page representing a trail, and
+produces no output.
+
+Currently, the only option supported is `[[!trailoptions circular=yes]]`,
+which adds links between the first and last pages, turning the trail into
+a circle.
diff --git a/doc/plugins/map/discussion.mdwn b/doc/plugins/map/discussion.mdwn
index c724a6492..2f7b140d6 100644
--- a/doc/plugins/map/discussion.mdwn
+++ b/doc/plugins/map/discussion.mdwn
@@ -18,3 +18,32 @@ We'd also very much like to have an option to display the title of the page inst
There's a patch implementing this in [[!debbug 484510]]. It needs a few fixes
before I merge it. Now applied. --[[Joey]]
+
+----
+
+I noticed that when the pagespec returns no map items, the map plugin does not close off the ul and div tags. Below is a simple patch
+that seems to work on the examples I tried. I am a beginner so please help me out here. Thanks. --[[harishcm]]
+
+ --- a/map.pm
+ +++ b/map.pm
+ @@ -81,6 +81,13 @@
+ my $openli=0;
+ my $addparent="";
+ my $map = "<div class='map'>\n<ul>\n";
+ +
+ + # Return properly closed $map if %mapitems is empty
+ + if (!scalar(keys %mapitems)) {
+ + $map .= "</ul>\n</div>\n";
+ + return $map;
+ + }
+ +
+ foreach my $item (sort keys %mapitems) {
+ my @linktext = (length $mapitems{$item} ? (linktext => $mapitems{$item}) : ());
+ $item=~s/^\Q$common_prefix\E\///
+
+> This was also reported as [[bugs/map_fails_to_close_ul_element_for_empty_list]];
+> this patch is simpler than the one there, but has the same problem (it emits
+> `<ul></ul>`, which technically isn't valid HTML either). --[[smcv]]
+
+>> Thanks for the tip, I added another patch addressing the issue at
+>> [[bugs/map_fails_to_close_ul_element_for_empty_list]]. --[[harishcm]]
diff --git a/doc/plugins/po.mdwn b/doc/plugins/po.mdwn
new file mode 100644
index 000000000..0c8110563
--- /dev/null
+++ b/doc/plugins/po.mdwn
@@ -0,0 +1,296 @@
+[[!template id=plugin name=po core=0 author="[[intrigeri]]"]]
+[[!tag type/format]]
+
+This plugin adds support for multi-lingual wikis, translated with
+gettext, using [po4a](http://po4a.alioth.debian.org/).
+
+It depends on the Perl `Locale::Po4a::Po` library (`apt-get install po4a`).
+As detailed bellow in the security section, `po4a` is subject to
+denial-of-service attacks before version 0.35.
+
+[[!toc levels=2]]
+
+Introduction
+============
+
+A language is chosen as the "master" one, and any other supported
+language is a "slave" one.
+
+A page written in the "master" language is a "master" page. It can be
+of any page type supported by ikiwiki, except `po`. It does not have to be
+named a special way: migration to this plugin does not imply any page
+renaming work.
+
+Example: `bla/page.mdwn` is a "master" Markdown page written in
+English; if `usedirs` is enabled, it is rendered as
+`bla/page/index.en.html`, else as `bla/page.en.html`.
+
+Any translation of a "master" page into a "slave" language is called
+a "slave" page; it is written in the gettext PO format. `po` is now
+a page type supported by ikiwiki.
+
+Example: `bla/page.fr.po` is the PO "message catalog" used to
+translate `bla/page.mdwn` into French; if `usedirs` is enabled, it is
+rendered as `bla/page/index.fr.html`, else as `bla/page.fr.html`
+
+(In)Compatibility
+=================
+
+This plugin does not support the `indexpages` mode. If you don't know
+what it is, you probably don't care.
+
+
+Configuration
+=============
+
+Supported languages
+-------------------
+
+`po_master_language` is used to set the "master" language in
+`ikiwiki.setup`, such as:
+
+ po_master_language => { 'code' => 'en', 'name' => 'English' }
+
+`po_slave_languages` is used to set the list of supported "slave"
+languages, such as:
+
+ po_slave_languages => { 'fr' => 'Français',
+ 'es' => 'Español',
+ 'de' => 'Deutsch',
+ }
+
+Decide which pages are translatable
+-----------------------------------
+
+The `po_translatable_pages` setting configures what pages are
+translatable. It is a [[ikiwiki/PageSpec]], so you have lots of
+control over what kind of pages are translatable.
+
+The `.po` files are not considered as being translatable, so you don't need to
+worry about excluding them explicitly from this [[ikiwiki/PageSpec]].
+
+Internal links
+--------------
+
+### Links targets
+
+The `po_link_to` option in `ikiwiki.setup` is used to decide how
+internal links should be generated, depending on web server features
+and site-specific preferences.
+
+#### Default linking behavior
+
+If `po_link_to` is unset, or set to `default`, ikiwiki's default
+linking behavior is preserved: `\[[destpage]]` links to the master
+language's page.
+
+#### Link to current language
+
+If `po_link_to` is set to `current`, `\[[destpage]]` links to the
+`destpage`'s version written in the current page's language, if
+available, *i.e.*:
+
+* `foo/destpage/index.LL.html` if `usedirs` is enabled
+* `foo/destpage.LL.html` if `usedirs` is disabled
+
+#### Link to negotiated language
+
+If `po_link_to` is set to `negotiated`, `\[[page]]` links to the
+negotiated preferred language, *i.e.* `foo/page/`.
+
+(In)compatibility notes:
+
+* if `usedirs` is disabled, it does not make sense to set `po_link_to`
+ to `negotiated`; this option combination is neither implemented
+ nor allowed.
+* if the web server does not support Content Negotiation, setting
+ `po_link_to` to `negotiated` will produce a unusable website.
+
+Server support
+==============
+
+Apache
+------
+
+Using Apache `mod_negotiation` makes it really easy to have Apache
+serve any page in the client's preferred language, if available.
+This is the default Debian Apache configuration.
+
+When `usedirs` is enabled, one has to set `DirectoryIndex index` for
+the wiki context.
+
+Setting `DefaultLanguage LL` (replace `LL` with your default MIME
+language code) for the wiki context can help to ensure
+`bla/page/index.en.html` is served as `Content-Language: LL`.
+
+lighttpd
+--------
+
+lighttpd unfortunately does not support content negotiation.
+
+**FIXME**: does `mod_magnet` provide the functionality needed to
+ emulate this?
+
+
+Usage
+=====
+
+Templates
+---------
+
+When `po_link_to` is not set to `negotiated`, one should replace some
+occurrences of `BASEURL` with `HOMEPAGEURL` to get correct links to
+the wiki homepage.
+
+The `ISTRANSLATION` and `ISTRANSLATABLE` variables can be used to
+display things only on translatable or translation pages.
+
+### Display page's versions in other languages
+
+The `OTHERLANGUAGES` loop provides ways to display other languages'
+versions of the same page, and the translations' status.
+
+An example of its use can be found in the default
+`templates/page.tmpl`. In case you want to customize it, the following
+variables are available inside the loop (for every page in):
+
+* `URL` - url to the page
+* `CODE` - two-letters language code
+* `LANGUAGE` - language name (as defined in `po_slave_languages`)
+* `MASTER` - is true (1) if, and only if the page is a "master" page
+* `PERCENT` - for "slave" pages, is set to the translation completeness, in percents
+
+### Display the current translation status
+
+The `PERCENTTRANSLATED` variable is set to the translation
+completeness, expressed in percent, on "slave" pages. It is used by
+the default `templates/page.tmpl`.
+
+Additional PageSpec tests
+-------------------------
+
+This plugin enhances the regular [[ikiwiki/PageSpec]] syntax with some
+additional tests that are documented [[here|ikiwiki/pagespec/po]].
+
+Automatic PO file update
+------------------------
+
+Committing changes to a "master" page:
+
+1. updates the POT file and the PO files for the "slave" languages;
+ the updated PO files are then put under version control;
+2. triggers a refresh of the corresponding HTML slave pages.
+
+Also, when the plugin has just been enabled, or when a page has just
+been declared as being translatable, the needed POT and PO files are
+created, and the PO files are checked into version control.
+
+Discussion pages and other sub-pages
+------------------------------------
+
+Discussion should happen in the language in which the pages are
+written for real, *i.e.* the "master" one. If discussion pages are
+enabled, "slave" pages therefore link to the "master" page's
+discussion page.
+
+Likewise, "slave" pages are not supposed to have sub-pages;
+[[WikiLinks|wikilink]] that appear on a "slave" page therefore link to
+the master page's sub-pages.
+
+Translating
+-----------
+
+One can edit the PO files using ikiwiki's CGI (a message-by-message
+interface could also be implemented at some point).
+
+If [[tips/untrusted_git_push]] is setup, one can edit the PO files in one's
+preferred `$EDITOR`, without needing to be online.
+
+Markup languages support
+------------------------
+
+[[Markdown|mdwn]] is well supported. Some other markup languages supported
+by ikiwiki mostly work, but some pieces of syntax are not rendered
+correctly on the slave pages:
+
+* [[reStructuredText|rst]]: anonymous hyperlinks and internal
+ cross-references
+* [[wikitext]]: conversion of newlines to paragraphs
+* [[creole]]: verbatim text is wrapped, tables are broken
+* [[html]] and LaTeX: not supported yet; the dedicated po4a modules
+ could be used to support them, but they would need a security audit
+* other markup languages have not been tested.
+
+Security
+========
+
+[[po/discussion]] contains a detailed security analysis of this plugin
+and its dependencies.
+
+When using po4a older than 0.35, it is recommended to uninstall
+`Text::WrapI18N` (Debian package `libtext-wrapi18n-perl`), in order to
+avoid a potential denial of service.
+
+TODO
+====
+
+Better links
+------------
+
+Once the fix to
+[[bugs/pagetitle_function_does_not_respect_meta_titles]] from
+[[intrigeri]]'s `meta` branch is merged into ikiwiki upstream, the
+generated links' text will be optionally based on the page titles set
+with the [[meta|plugins/meta]] plugin, and will thus be translatable.
+It will also allow displaying the translation status in links to slave
+pages. Both were implemented, and reverted in commit
+ea753782b222bf4ba2fb4683b6363afdd9055b64, which should be reverted
+once [[intrigeri]]'s `meta` branch is merged.
+
+An integration branch, called `meta-po`, merges [[intrigeri]]'s `po`
+and `meta` branches, and thus has thise additional features.
+
+Self links
+----------
+
+If a page contains a WikiLink to itself, ikiwiki does not normally
+turn that into a hyperlink. However, if a translated page contains a
+WikiLink to itself, a hyperlink is inserted, at least with the default
+`po_link_to` the link points to the English version of the page. Is there a
+good reason for that to be done? --[[Joey]]
+
+Language display order
+----------------------
+
+Jonas pointed out that one might want to control the order that links to
+other languages are listed, for various reasons. Currently, there is no
+order, as `po_slave_languages` is a hash. It would need to be converted
+to an array to support this. (If twere done, twere best done quickly.)
+--[[Joey]]
+
+Duplicate %links ?
+------------------
+
+I notice code in the scan hook that seems to assume
+that %links will accumulate duplicate links for a page.
+That used to be so, but the bug was fixed. Does this mean
+that po might be replacing the only link on a page, in error?
+--[[Joey]]
+
+Bug when editing underlay file
+------------------------------
+
+While I've gotten translated underlays working, there is a bug
+if the wiki is currently using a page from the underlay, and the master
+language version is edited. This causes the edited page to be saved
+to srcdir.. and all the translations get set to 0% and their
+po files have the translated strings "emptied". What's really going on
+is that these are entirely new po files not based on the old ones
+in the basewiki, and thus lacking translations. --[[Joey]]
+
+Documentation
+-------------
+
+Maybe write separate documentation depending on the people it targets:
+translators, wiki administrators, hackers. This plugin may be complex
+enough to deserve this.
diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/po/discussion.mdwn
index 665e48343..1c3f0e752 100644
--- a/doc/plugins/contrib/po.mdwn
+++ b/doc/plugins/po/discussion.mdwn
@@ -1,3 +1,216 @@
+[[!toc ]]
+
+----
+
+# Security review
+
+## Probable holes
+
+_(The list of things to fix.)_
+
+### po4a-gettextize
+
+* po4a CVS 2009-01-16
+* Perl 5.10.0
+
+`po4a-gettextize` uses more or less the same po4a features as our
+`refreshpot` function.
+
+Without specifying an input charset, zzuf'ed `po4a-gettextize` quickly
+errors out, complaining it was not able to detect the input charset;
+it leaves no incomplete file on disk. I therefore had to pretend the
+input was in UTF-8, as does the po plugin.
+
+ zzuf -c -s 13 -r 0.1 \
+ po4a-gettextize -f text -o markdown -M utf-8 -L utf-8 \
+ -m GPL-3 -p GPL-3.pot
+
+Crashes with:
+
+ Malformed UTF-8 character (UTF-16 surrogate 0xdfa4) in substitution
+ iterator at /usr/share/perl5/Locale/Po4a/Po.pm line 1449.
+ Malformed UTF-8 character (fatal) at /usr/share/perl5/Locale/Po4a/Po.pm
+ line 1449.
+
+An incomplete pot file is left on disk. Unfortunately Po.pm tells us
+nothing about the place where the crash happens.
+
+> It's fairly standard perl behavior when fed malformed utf-8. As long
+> as it doesn't crash ikiwiki, it's probably acceptable. Ikiwiki can
+> do some similar things itself when fed malformed utf-8 (doesn't
+> crash tho) --[[Joey]]
+
+----
+
+## Potential gotchas
+
+_(Things not to do.)_
+
+
+### Blindly activating more po4a format modules
+
+The format modules we want to use have to be checked, as not all are
+safe (e.g. the LaTeX module's behaviour is changed by commands
+included in the content); they may use regexps generated from
+the content.
+
+----
+
+## Hopefully non-holes
+
+_(AKA, the assumptions that will be the root of most security holes...)_
+
+### PO file features
+
+No [documented](http://www.gnu.org/software/gettext/manual/gettext.html#PO-Files)
+directive that can be put in po files is supposed to cause mischief
+(ie, include other files, run commands, crash gettext, whatever).
+
+### gettext
+
+#### Security history
+
+The only past security issue I could find in GNU gettext is
+[CVE-2004-0966](http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-0966),
+*i.e.* [Debian bug #278283](http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=278283):
+the autopoint and gettextize scripts in the GNU gettext package (1.14
+and later versions) may allow local users to overwrite files via
+a symlink attack on temporary files.
+
+This plugin would not have allowed to exploit this bug, as it does not
+use, either directly or indirectly, the faulty scripts.
+
+Note: the lack of found security issues can either indicate that there
+are none, or reveal that no-one ever bothered to find or publish them.
+
+#### msgmerge
+
+`refreshpofiles()` runs this external program.
+
+* I was not able to crash it with `zzuf`.
+* I could not find any past security hole.
+
+#### msgfmt
+
+`isvalidpo()` runs this external program.
+
+* I was not able to make it behave badly using zzuf: it exits cleanly
+ when too many errors are detected.
+* I could not find any past security hole.
+
+### po4a
+
+#### Security history
+
+The only past security issue I could find in po4a is
+[CVE-2007-4462](http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-4462):
+`lib/Locale/Po4a/Po.pm` in po4a before 0.32 allowed local users to
+overwrite arbitrary files via a symlink attack on the
+gettextization.failed.po temporary file.
+
+This plugin would not have allowed to exploit this bug, as it does not
+use, either directly or indirectly, the faulty `gettextize` function.
+
+Note: the lack of found security issues can either indicate that there
+are none, or reveal that no-one ever bothered to find or publish them.
+
+#### General feeling
+
+Are there any security issues on running po4a on untrusted content?
+
+To say the least, this issue is not well covered, at least publicly:
+
+* the documentation does not talk about it;
+* grep'ing the source code for `security` or `trust` gives no answer.
+
+On the other hand, a po4a developer answered my questions in
+a convincing manner, stating that processing untrusted content was not
+an initial goal, and analysing in detail the possible issues.
+The following analysis was done with his help.
+
+#### Details
+
+* the core (`Po.pm`, `Transtractor.pm`) should be safe
+* po4a source code was fully checked for other potential symlink
+ attacks, after discovery of one such issue
+* the only external program run by the core is `diff`, in `Po.pm` (in
+ parts of its code we don't use)
+* `Locale::gettext` is only used to display translated error messages
+* Nicolas François "hopes" `DynaLoader` is safe, and has "no reason to
+ think that `Encode` is not safe"
+* Nicolas François has "no reason to think that `Encode::Guess` is not
+ safe". The po plugin nevertheless avoids using it by defining the
+ input charset (`file_in_charset`) before asking `TransTractor` to
+ read any file. NB: this hack depends on po4a internals.
+
+##### Locale::Po4a::Text
+
+* does not run any external program
+* only `do_paragraph()` builds regexp's that expand untrusted
+ variables; according to [[Joey]], this is "Freaky code, but seems ok
+ due to use of `quotementa`".
+
+##### Text::WrapI18N
+
+`Text::WrapI18N` can cause DoS
+([Debian bug #470250](http://bugs.debian.org/470250)).
+It is optional, and we do not need the features it provides.
+
+If a recent enough po4a (>=0.35) is installed, this module's use is
+fully disabled. Else, the wiki administrator is warned about this
+at runtime.
+
+##### Term::ReadKey
+
+`Term::ReadKey` is not a hard dependency in our case, *i.e.* po4a
+works nicely without it. But the po4a Debian package recommends
+`libterm-readkey-perl`, so it will probably be installed on most
+systems using the po plugin.
+
+`Term::ReadKey` has too far reaching implications for us to
+be able to guarantee anything wrt. security.
+
+If a recent enough po4a (>=2009-01-15 CVS, which will probably be
+released as 0.35) is installed, this module's use is fully disabled.
+
+##### Fuzzing input
+
+###### po4a-translate
+
+* po4a CVS 2009-01-16
+* Perl 5.10.0
+
+`po4a-translate` uses more or less the same po4a features as our
+`filter` function.
+
+Without specifying an input charset, same behaviour as
+`po4a-gettextize`, so let's specify UTF-8 as input charset as of now.
+
+`LICENSES` is a 21M file containing 100 concatenated copies of all the
+files in `/usr/share/common-licenses/`; I had no existing PO file or
+translated versions at hand, which renders these tests
+quite incomplete.
+
+ zzuf -cv -s 0:10 -r 0.001:0.3 \
+ po4a-translate -d -f text -o markdown -M utf-8 -L utf-8 \
+ -k 0 -m LICENSES -p LICENSES.fr.po -l test.fr
+
+... seems to lose the fight, at the `readpo(LICENSES.fr.po)` step,
+against some kind of infinite loop, deadlock, or any similar beast.
+
+The root of this bug lies in `Text::WrapI18N`, see the corresponding
+section.
+
+
+----
+
+## Fixed holes
+
+
+----
+
+# original contrib/po page, with old commentary
+
I've been working on a plugin called "po", that adds support for multi-lingual wikis,
translated with gettext, using [po4a](http://po4a.alioth.debian.org/).
@@ -153,11 +366,13 @@ Any thoughts on this?
>> basewiki, which seems like it should be pretty easy to do, and would be
>> a great demo! --[[Joey]]
>>
->>> I have a complete translation of basewiki into danish, and am working with
+>>> I have a complete translation of basewiki into danish, available merged into
+>>> ikiwiki at git://source.jones.dk/ikiwiki-upstream (branch underlay-da), and am working with
>>> others on preparing one in german. For a complete translated user
>>> experience, however, you will also need templates translated (there are a few
->>> translatable strings there too). My not-yet-merged po4a Markdown improvements
->>> (see [bug#530574](http://bugs.debian.org/530574)) correctly handles multiple
+>>> translatable strings there too). My most recent po4a Markdown improvements
+>>> adopted upstream but not yet in Debian (see
+>>> [bug#530574](http://bugs.debian.org/530574)) correctly handles multiple
>>> files in a single PO which might be relevant for template translation handling.
>>> --[[JonasSmedegaard]]
>>
@@ -452,3 +667,35 @@ daring a timid "please pull"... or rather, please review again :)
secondary parameter overriding the default locale (for messages like "N/A" as
percentage in po plugin). Alternatively (with above mentioned template support)
all such strings could be externalized as templates that can then be localized.
+
+# Robustness tests
+
+### Enabling/disabling the plugin
+
+* enabling the plugin with `po_translatable_pages` set to blacklist: **OK**
+* enabling the plugin with `po_translatable_pages` set to whitelist: **OK**
+* enabling the plugin without `po_translatable_pages` set: **OK**
+* disabling the plugin: **OK**
+
+### Changing the plugin config
+
+* adding existing pages to `po_translatable_pages`: **OK**
+* removing existing pages from `po_translatable_pages`: **OK**
+* adding a language to `po_slave_languages`: **OK**
+* removing a language from `po_slave_languages`: **OK**
+* changing `po_master_language`: **OK**
+* replacing `po_master_language` with a language previously part of
+ `po_slave_languages`: needs two rebuilds, but **OK** (this is quite
+ a perverse test actually)
+
+### Creating/deleting/renaming pages
+
+All cases of master/slave page creation/deletion/rename, both via RCS
+and via CGI, have been tested.
+
+### Misc
+
+* general test with `usedirs` disabled: **OK**
+* general test with `indexpages` enabled: **not OK**
+* general test with `po_link_to=default` with `userdirs` enabled: **OK**
+* general test with `po_link_to=default` with `userdirs` disabled: **OK**
diff --git a/doc/plugins/rst/discussion.mdwn b/doc/plugins/rst/discussion.mdwn
index a792b670f..9909784d5 100644
--- a/doc/plugins/rst/discussion.mdwn
+++ b/doc/plugins/rst/discussion.mdwn
@@ -29,4 +29,15 @@ An exhaustive list of differences between prest and "standard" reST follows:
* csv directive doesn't require csv.py
* references directive doesn't allow options
-There may be a few others; my eyes glazed over. --Ethan \ No newline at end of file
+There may be a few others; my eyes glazed over. --Ethan
+
+rst support for ikiwiki seems to be on hold. rst is much more elegant
+than markdown in my opinion, so I tried it out in ikiwiki. I found out
+in other places that some directives work just fine, like [[meta]] and
+[[tag]], others work fine if you wrap them in `.. raw::`, like [[inline]].
+
+But to make a wiki we need [[WikiLinks]]; they can't be escape-inserted or
+such since they are inline elements in the text.. But images work fine in
+rst's syntax.. what about using rst syntax for wikilinks as well?
+Is it possible to inject something into the parser to turn unmached links
+``WikiLink`_` into ikiwiki links? --ulrik
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index d0f6a09e1..3976f9adf 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -330,6 +330,26 @@ This hook should avoid directly redirecting the user to a signin page,
since it's sometimes used to test to see which pages in a set of pages a
user can edit.
+### canremove
+
+ hook(type => "canremove", id => "foo", call => \&canremove);
+
+This hook can be used to implement arbitrary access methods to control
+when a page can be removed using the web interface (commits from
+revision control bypass it). It works exactly like the `canedit` hook,
+but is passed the named parameters `cgi` (a CGI object), `session`
+(a session object) and `page` (the page subject to deletion).
+
+### canrename
+
+ hook(type => "canrename", id => "foo", call => \&canrename);
+
+This hook can be used to implement arbitrary access methods to control when
+a page can be renamed using the web interface (commits from revision control
+bypass it). It works exactly like the `canedit` hook,
+but is passed the named parameters `cgi` (a CGI object), `session` (a
+session object), `src`, `srcfile`, `dest` and `destfile`.
+
### checkcontent
hook(type => "checkcontent", id => "foo", call => \&checkcontent);
@@ -342,8 +362,9 @@ the content the user has entered is a comment, it may also be passed some
additional parameters: `author`, `url`, and `subject`. The `subject`
parameter may also be filled with the user's comment about the change.
-Note: When the user edits an existing wiki page, the passed `content` will
-include only the lines that they added to the page, or modified.
+Note: When the user edits an existing wiki page, this hook is also
+passed a `diff` named parameter, which will include only the lines
+that they added to the page, or modified.
The hook should return `undef` on success. If the content is disallowed, it
should return a message stating what the problem is, or a function
@@ -394,9 +415,28 @@ they're saved, etc.
hook(type => "renamepage", id => "foo", call => \&renamepage);
This hook is called by the [[plugins/rename]] plugin when it renames
-something. The hook is passed named parameters: `page`, `oldpage`,
-`newpage`, and `content`, and should try to modify the content to reflect
-the name change. For example, by converting links to point to the new page.
+something, once per page linking to the renamed page's old location.
+The hook is passed named parameters: `page`, `oldpage`, `newpage`, and
+`content`, and should try to modify the content of `page` to reflect
+the name change. For example, by converting links to point to the
+new page.
+
+### rename
+
+ hook(type => "rename", id => "foo", call => \&rename);
+
+When a page or set of pages is renamed, the referenced function is
+called for every page, and is passed named parameters:
+
+* `torename`: a reference to a hash with keys: `src`, `srcfile`,
+ `dest`, `destfile`, `required`.
+* `cgi`: a CGI object
+* `session`: a session object.
+
+Such a hook function returns any additional rename hashes it wants to
+add. This hook is applied recursively to returned additional rename
+hashes, so that it handles the case where two plugins use the hook:
+plugin A would see when plugin B adds a new file to be renamed.
### getsetup
@@ -601,7 +641,7 @@ pages, as described in [[ikiwiki/SubPage/LinkingRules]].
Many plugins need to generate html links and add them to a page. This is
done by using the `htmllink` function. The usual way to call
-`htmlllink` is:
+`htmllink` is:
htmllink($page, $page, $link)
@@ -810,7 +850,7 @@ of the page with the rcs's conflict markers on failure.
Passed a message, user, and ip address. Should commit all staged changes.
Returns undef on success, and an error message on failure.
-Changes can be staged by calls to `rcs_add, `rcs_remove`, and
+Changes can be staged by calls to `rcs_add`, `rcs_remove`, and
`rcs_rename`.
#### `rcs_add($)`