From 79b376f9912891a8748fcbb4580969e4dbf7fc75 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 17 Oct 2008 20:28:18 -0400 Subject: Add an underlay for javascript, and add ikiwiki.js containing some utility code. * Add an underlay for javascript, and add ikiwiki.js containing some utility code. * toggle: Stop embedding the full toggle code on each page using it, and move it to toggle.js in the javascript underlay. --- doc/plugins/write.mdwn | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 1b78f5900..daf70c8e2 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -847,3 +847,32 @@ to a hash containing all the config items. They should also implement a By the way, to parse a ikiwiki setup file and populate `%config`, a program just needs to do something like: `use IkiWiki::Setup; IkiWiki::Setup::load($filename)` + +### Javascript + +Some plugins use javascript to make ikiwiki look a bit more web-2.0-ish. + +All javascript code should be put in `.js` files in the `javascript` +underlay, and plugins using those files can enable use of the underlay by +calling `add_underlay("javascript");` in their `import` function. + +You'll have to arrange for `'."\n". + ''; +} #}}} + +1 diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index bc997ffb0..8385c1aff 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -109,7 +109,9 @@ sub genpage ($$) { #{{{ backlinks => $backlinks, more_backlinks => $more_backlinks, mtime => displaytime($pagemtime{$page}), + mtime_raw => scalar localtime($pagemtime{$page}), ctime => displaytime($pagectime{$page}), + ctime_raw => scalar localtime($pagectime{$page}), baseurl => baseurl($page), ); diff --git a/debian/changelog b/debian/changelog index 66d108e9e..908eb1f53 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ ikiwiki (2.68) UNRELEASED; urgency=low code. * toggle: Stop embedding the full toggle code on each page using it, and move it to toggle.js in the javascript underlay. + * relativedate: New javascript-alicious plugin that makes all dates display + relative, in a very nice way, if I say so myself. -- Joey Hess Fri, 17 Oct 2008 20:11:02 -0400 diff --git a/doc/plugins/ddate.mdwn b/doc/plugins/ddate.mdwn index e82760d88..741606a6e 100644 --- a/doc/plugins/ddate.mdwn +++ b/doc/plugins/ddate.mdwn @@ -1,5 +1,6 @@ [[!template id=plugin name=ddate author="[[Joey]]"]] [[!tag type/fun]] +[[!tag type/date]] Enables use of Discordian dates. `--timeformat` can be used to change the date format; see `ddate(1)`. diff --git a/doc/plugins/prettydate.mdwn b/doc/plugins/prettydate.mdwn index 9a67f5dca..11ad4252f 100644 --- a/doc/plugins/prettydate.mdwn +++ b/doc/plugins/prettydate.mdwn @@ -1,5 +1,5 @@ [[!template id=plugin name=prettydate author="[[Joey]]"]] -[[!tag type/format]] +[[!tag type/date]] Enabling this plugin changes the dates displayed on pages in the wiki to a format that is nice and easy to read. Examples: "late Wednesday evening, diff --git a/doc/plugins/relativedate.mdwn b/doc/plugins/relativedate.mdwn new file mode 100644 index 000000000..ecbdf68bf --- /dev/null +++ b/doc/plugins/relativedate.mdwn @@ -0,0 +1,16 @@ +[[!template id=plugin name=prettydate author="[[Joey]]"]] +[[!tag type/date]] + +This plugin lets dates be displayed in relative form. Examples: "2 days ago", +"1 month and 3 days ago", "30 minutes ago". Hovering over the date will +cause a tooltip to pop up with the absolute date. + +This only works in browsers with javascript enabled; other browsers will +show the absolute date instead. Also, this plugin can be used with other +plugins like [[prettydate]] that change how the absolute date is displayed. + +If this plugin is enabled, you may also add relative dates to pages in the +wiki, by using html elements in the "date" class. For example, this will +display as a relative date: + + Fri Oct 17 18:36:13 EDT 2008 diff --git a/doc/plugins/type/date.mdwn b/doc/plugins/type/date.mdwn new file mode 100644 index 000000000..eae1226da --- /dev/null +++ b/doc/plugins/type/date.mdwn @@ -0,0 +1 @@ +These plugins control how ikiwiki displays dates. diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot index 6853df153..2d213a799 100644 --- a/po/ikiwiki.pot +++ b/po/ikiwiki.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-10-17 20:11-0400\n" +"POT-Creation-Date: 2008-10-17 20:39-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -172,9 +172,9 @@ msgid "automatic index generation" msgstr "" #: ../IkiWiki/Plugin/brokenlinks.pm:33 ../IkiWiki/Plugin/editpage.pm:261 -#: ../IkiWiki/Plugin/inline.pm:327 ../IkiWiki/Plugin/opendiscussion.pm:26 +#: ../IkiWiki/Plugin/inline.pm:329 ../IkiWiki/Plugin/opendiscussion.pm:26 #: ../IkiWiki/Plugin/orphans.pm:37 ../IkiWiki/Render.pm:79 -#: ../IkiWiki/Render.pm:149 +#: ../IkiWiki/Render.pm:151 msgid "discussion" msgstr "" @@ -318,11 +318,11 @@ msgstr "" msgid "nonexistant template %s" msgstr "" -#: ../IkiWiki/Plugin/inline.pm:335 ../IkiWiki/Render.pm:83 +#: ../IkiWiki/Plugin/inline.pm:337 ../IkiWiki/Render.pm:83 msgid "Discussion" msgstr "" -#: ../IkiWiki/Plugin/inline.pm:572 +#: ../IkiWiki/Plugin/inline.pm:574 msgid "RPC::XML::Client not found, not pinging" msgstr "" @@ -780,59 +780,59 @@ msgstr "" msgid "

Error: %s exited nonzero (%s)" msgstr "" -#: ../IkiWiki/Render.pm:253 +#: ../IkiWiki/Render.pm:255 #, perl-format msgid "" "symlink found in srcdir path (%s) -- set allow_symlinks_before_srcdir to " "allow this" msgstr "" -#: ../IkiWiki/Render.pm:277 ../IkiWiki/Render.pm:302 +#: ../IkiWiki/Render.pm:279 ../IkiWiki/Render.pm:304 #, perl-format msgid "skipping bad filename %s" msgstr "" -#: ../IkiWiki/Render.pm:284 +#: ../IkiWiki/Render.pm:286 #, perl-format msgid "%s has multiple possible source pages" msgstr "" -#: ../IkiWiki/Render.pm:360 +#: ../IkiWiki/Render.pm:362 #, perl-format msgid "removing old page %s" msgstr "" -#: ../IkiWiki/Render.pm:400 +#: ../IkiWiki/Render.pm:402 #, perl-format msgid "scanning %s" msgstr "" -#: ../IkiWiki/Render.pm:405 +#: ../IkiWiki/Render.pm:407 #, perl-format msgid "rendering %s" msgstr "" -#: ../IkiWiki/Render.pm:426 +#: ../IkiWiki/Render.pm:428 #, perl-format msgid "rendering %s, which links to %s" msgstr "" -#: ../IkiWiki/Render.pm:447 +#: ../IkiWiki/Render.pm:449 #, perl-format msgid "rendering %s, which depends on %s" msgstr "" -#: ../IkiWiki/Render.pm:486 +#: ../IkiWiki/Render.pm:488 #, perl-format msgid "rendering %s, to update its backlinks" msgstr "" -#: ../IkiWiki/Render.pm:498 +#: ../IkiWiki/Render.pm:500 #, perl-format msgid "removing %s, no longer rendered by %s" msgstr "" -#: ../IkiWiki/Render.pm:522 +#: ../IkiWiki/Render.pm:524 #, perl-format msgid "ikiwiki: cannot render %s" msgstr "" diff --git a/templates/inlinepage.tmpl b/templates/inlinepage.tmpl index ffcb897a8..3f640fcdd 100644 --- a/templates/inlinepage.tmpl +++ b/templates/inlinepage.tmpl @@ -5,9 +5,9 @@ - + - + @@ -28,14 +28,14 @@

-Posted +Posted Tags: - + diff --git a/templates/page.tmpl b/templates/page.tmpl index f2f9c34cc..7456e9e41 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -22,7 +22,7 @@ -/ +/ @@ -74,7 +74,7 @@
Tags: - +
@@ -83,13 +83,13 @@ Tags: - +
diff --git a/underlays/javascript/relativedate.js b/underlays/javascript/relativedate.js new file mode 100644 index 000000000..c5e62b3cc --- /dev/null +++ b/underlays/javascript/relativedate.js @@ -0,0 +1,70 @@ +// Causes html elements in the 'date' and 'pagedate' classes to be displayed +// as relative dates. The date is parsed from the title attribute, or from +// the element content. + +var dateElements; + +hook("onload", getDates); + +function getDates() { + dateElements = getElementsByClass('date'); + for (var i = 0; i < dateElements.length; i++) { + var elt = dateElements[i]; + var title = elt.attributes.title; + var d = new Date(title ? title.value : elt.innerHTML); + if (! isNaN(d)) { + dateElements[i].date=d; + elt.title=elt.innerHTML; + } + } + + showDates(); +} + +function showDates() { + for (var i = 0; i < dateElements.length; i++) { + var elt = dateElements[i]; + var d = elt.date; + if (! isNaN(d)) { + elt.innerHTML=relativeDate(d); + } + } + setTimeout(showDates,30000); // keep updating every 30s +} + +var timeUnits = new Array; +timeUnits['minute'] = 60; +timeUnits['hour'] = timeUnits['minute'] * 60; +timeUnits['day'] = timeUnits['hour'] * 24; +timeUnits['month'] = timeUnits['day'] * 30; +timeUnits['year'] = timeUnits['day'] * 364; +var timeUnitOrder = ['year', 'month', 'day', 'hour', 'minute']; + +function relativeDate(date) { + var now = new Date(); + var offset = date.getTime() - now.getTime(); + var seconds = Math.round(Math.abs(offset) / 1000); + + var ret = ""; + var shown = 0; + for (i = 0; i < timeUnitOrder.length; i++) { + var unit = timeUnitOrder[i]; + if (seconds >= timeUnits[unit]) { + var num = Math.floor(seconds / timeUnits[unit]); + seconds -= num * timeUnits[unit]; + if (ret) + ret += "and "; + ret += num + " " + unit + (num > 1 ? "s" : "") + " "; + + if (++shown == 2) + break; + } + else if (shown) + break; + } + + if (! ret) + ret = "less than a minute " + + return ret + (offset < 0 ? "ago" : "from now"); +} -- cgit v1.2.3 From 3670fe9a4f2e24729c5be64429af5afdcd2ca1c5 Mon Sep 17 00:00:00 2001 From: tschwinge Date: Sun, 19 Oct 2008 12:14:08 -0400 Subject: Correct copy&paste-o. --- doc/plugins/relativedate.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/relativedate.mdwn b/doc/plugins/relativedate.mdwn index ecbdf68bf..121bce477 100644 --- a/doc/plugins/relativedate.mdwn +++ b/doc/plugins/relativedate.mdwn @@ -1,4 +1,4 @@ -[[!template id=plugin name=prettydate author="[[Joey]]"]] +[[!template id=plugin name=relativedate author="[[Joey]]"]] [[!tag type/date]] This plugin lets dates be displayed in relative form. Examples: "2 days ago", -- cgit v1.2.3 From fd9393ef8575ad4a8966ae7f5310aab688dedf48 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 19 Oct 2008 20:12:37 -0400 Subject: add displaytime hook Need to use a hook because an exported function cannot be reliably overridden. The replacement verstion was actually only affecting plugins loaded after it. formattime doesn't need a hook, since there's no reason to export it. --- IkiWiki.pm | 17 ++++++++++++++--- IkiWiki/Plugin/relativedate.pm | 3 ++- doc/plugins/write.mdwn | 8 +++++++- po/ikiwiki.pot | 8 ++++---- 4 files changed, 27 insertions(+), 9 deletions(-) (limited to 'doc/plugins') diff --git a/IkiWiki.pm b/IkiWiki.pm index 1f4d40d41..207ca87fb 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -898,12 +898,23 @@ sub abs2rel ($$) { #{{{ } #}}} sub displaytime ($;$) { #{{{ - # Plugins can override this function to mark up the time for - # display. - return formattime(@_); + my $time=shift; + my $format=shift; + if (exists $hooks{displaytime}) { + my $ret; + run_hooks(displaytime => sub { + $ret=shift->($time, $format) + }); + return $ret; + } + else { + return formattime($time, $format); + } } #}}} sub formattime ($;$) { #{{{ + # Plugins can override this function to mark up the time for + # display. my $time=shift; my $format=shift; if (! defined $format) { diff --git a/IkiWiki/Plugin/relativedate.pm b/IkiWiki/Plugin/relativedate.pm index 0c9426dda..d9d8f7776 100644 --- a/IkiWiki/Plugin/relativedate.pm +++ b/IkiWiki/Plugin/relativedate.pm @@ -12,6 +12,7 @@ sub import { #{{{ add_underlay("javascript"); hook(type => "getsetup", id => "relativedate", call => \&getsetup); hook(type => "format", id => "relativedate", call => \&format); + hook(type => "displaytime", id => "relativedate", call => \&display); } # }}} sub getsetup () { #{{{ @@ -42,7 +43,7 @@ sub include_javascript ($;$) { #{{{ '" type="text/javascript" charset="utf-8">'; } #}}} -sub IkiWiki::displaytime ($;$) { #{{{ +sub display ($;$) { #{{{ my $time=shift; my $format=shift; diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index daf70c8e2..856b34ba1 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -196,7 +196,6 @@ generating the page. hook(type => "pagetemplate", id => "foo", call => \&pagetemplate); - [[Templates|wikitemplates]] are filled out for many different things in ikiwiki, like generating a page, or part of a blog page, or an rss feed, or a cgi. This hook allows modifying the variables available on those @@ -361,6 +360,13 @@ This hook is called whenever ikiwiki normally saves its state, just before the state is saved. The function can save other state, modify values before they're saved, etc. +### displaytime + + hook(type => "displaytime", id => "foo", call => \&display); + +This hook can be registered to override the regular `displaytime` function. +Only the last displaytime hook will be used. + ### renamepage hook(type => "renamepage", id => "foo", call => \&renamepage); diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot index 89cca9ff4..335575f02 100644 --- a/po/ikiwiki.pot +++ b/po/ikiwiki.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-10-19 19:13-0400\n" +"POT-Creation-Date: 2008-10-19 20:06-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -48,7 +48,7 @@ msgstr "" msgid "You are banned." msgstr "" -#: ../IkiWiki/CGI.pm:385 ../IkiWiki/CGI.pm:386 ../IkiWiki.pm:1173 +#: ../IkiWiki/CGI.pm:385 ../IkiWiki/CGI.pm:386 ../IkiWiki.pm:1182 msgid "Error" msgstr "" @@ -926,12 +926,12 @@ msgstr "" msgid "failed to load external plugin needed for %s plugin: %s" msgstr "" -#: ../IkiWiki.pm:1156 +#: ../IkiWiki.pm:1165 #, perl-format msgid "preprocessing loop detected on %s at depth %i" msgstr "" -#: ../IkiWiki.pm:1665 +#: ../IkiWiki.pm:1674 msgid "yes" msgstr "" -- cgit v1.2.3 From 566c1af2aafa7b371a07f5229513ac2014e93fd9 Mon Sep 17 00:00:00 2001 From: "http://alcopop.org/me/openid/" Date: Mon, 20 Oct 2008 10:25:49 -0400 Subject: split into subpages? --- doc/plugins/write/discussion.mdwn | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/write/discussion.mdwn b/doc/plugins/write/discussion.mdwn index 039775b79..9a36d7b0b 100644 --- a/doc/plugins/write/discussion.mdwn +++ b/doc/plugins/write/discussion.mdwn @@ -40,3 +40,7 @@ distributed wiki. > > OTOH, if something can be added to the documentation that encourages > good behavior, that'd be a good thing ... --[[Joey]] + +--- + +I would find this page clearer split up into sub-pages. Does anyone agree/disagree? -- [[JonDowland]] -- cgit v1.2.3 From 47294262929f6bcb1f25bf25504d53a3b864da43 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 20 Oct 2008 16:55:38 -0400 Subject: pull together info on converting to ikiwiki from other systems --- doc/convert.mdwn | 7 +++++++ doc/index/discussion.mdwn | 4 ++++ doc/plugins/contrib/mediawiki,mdwn | 5 +++++ doc/tips/convert_MoinMoin_and_TWiki_to_ikiwiki.mdwn | 3 +++ doc/tips/convert_mediawiki_to_ikiwiki.mdwn | 4 ++++ 5 files changed, 23 insertions(+) create mode 100644 doc/convert.mdwn create mode 100644 doc/plugins/contrib/mediawiki,mdwn create mode 100644 doc/tips/convert_MoinMoin_and_TWiki_to_ikiwiki.mdwn create mode 100644 doc/tips/convert_mediawiki_to_ikiwiki.mdwn (limited to 'doc/plugins') diff --git a/doc/convert.mdwn b/doc/convert.mdwn new file mode 100644 index 000000000..871cd31fe --- /dev/null +++ b/doc/convert.mdwn @@ -0,0 +1,7 @@ +Do you have an existing wiki or blog using other software, and would like +to convert it to ikiwiki? Various tools and techniques have been developed +to handle such conversions. + +* [[tips/convert_mediawiki_to_ikiwiki]] +* [[tips/convert_MoinMoin_and_TWiki_to_ikiwiki]] +* [[tips/convert_blogger_blogs_to_ikiwiki]] diff --git a/doc/index/discussion.mdwn b/doc/index/discussion.mdwn index 89e12e6c2..d52cb0a2d 100644 --- a/doc/index/discussion.mdwn +++ b/doc/index/discussion.mdwn @@ -288,6 +288,10 @@ easily, perl is possible (but I'm not strong in perl). >>> It appears the scripts were never posted? I recently imported my Mediawiki site into Iki. If it helps, my notes are here: --[[sabr]] +>>>>> The scripts have been posted now, see [[joshtriplett]]'s user page, +>>>>> and I've pulled together all ways I can find to [[convert]] other +>>>>> systems into ikiwiki. --[[Joey]] + ---- # LaTeX support? diff --git a/doc/plugins/contrib/mediawiki,mdwn b/doc/plugins/contrib/mediawiki,mdwn new file mode 100644 index 000000000..162937ed9 --- /dev/null +++ b/doc/plugins/contrib/mediawiki,mdwn @@ -0,0 +1,5 @@ +[[!template id=plugin name=sar author="[[sabr]]"]] +[[!tag type/format]] + +[The Mediawiki plugin](http://u32.net/Mediawiki_Plugin/) allows ikiwiki to +process pages written using MediaWiki markup. diff --git a/doc/tips/convert_MoinMoin_and_TWiki_to_ikiwiki.mdwn b/doc/tips/convert_MoinMoin_and_TWiki_to_ikiwiki.mdwn new file mode 100644 index 000000000..5565dbd8a --- /dev/null +++ b/doc/tips/convert_MoinMoin_and_TWiki_to_ikiwiki.mdwn @@ -0,0 +1,3 @@ +[[JoshTriplett]] has developed scripts to convert MoinMoin and TWiki wikis +to ikiwikis backed by a git repository, including full history. For +details, see [[his_user_page|JoshTriplett]]. diff --git a/doc/tips/convert_mediawiki_to_ikiwiki.mdwn b/doc/tips/convert_mediawiki_to_ikiwiki.mdwn new file mode 100644 index 000000000..f03703b46 --- /dev/null +++ b/doc/tips/convert_mediawiki_to_ikiwiki.mdwn @@ -0,0 +1,4 @@ +[[sabr]] explains how to [import MediaWiki content into +git](http://u32.net/Mediawiki_Conversion/index.html?updated), including +full edit hostory. The [[plugins/contrib/mediawiki]] plugin can then be +used by ikiwiki to build the wiki. -- cgit v1.2.3 From f1213d3ab77218695bb2e3b6fd948eb4827c6ef5 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 20 Oct 2008 16:57:37 -0400 Subject: fix name --- doc/plugins/contrib/mediawiki,mdwn | 5 ----- doc/plugins/contrib/mediawiki.mdwn | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) delete mode 100644 doc/plugins/contrib/mediawiki,mdwn create mode 100644 doc/plugins/contrib/mediawiki.mdwn (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/mediawiki,mdwn b/doc/plugins/contrib/mediawiki,mdwn deleted file mode 100644 index 162937ed9..000000000 --- a/doc/plugins/contrib/mediawiki,mdwn +++ /dev/null @@ -1,5 +0,0 @@ -[[!template id=plugin name=sar author="[[sabr]]"]] -[[!tag type/format]] - -[The Mediawiki plugin](http://u32.net/Mediawiki_Plugin/) allows ikiwiki to -process pages written using MediaWiki markup. diff --git a/doc/plugins/contrib/mediawiki.mdwn b/doc/plugins/contrib/mediawiki.mdwn new file mode 100644 index 000000000..162937ed9 --- /dev/null +++ b/doc/plugins/contrib/mediawiki.mdwn @@ -0,0 +1,5 @@ +[[!template id=plugin name=sar author="[[sabr]]"]] +[[!tag type/format]] + +[The Mediawiki plugin](http://u32.net/Mediawiki_Plugin/) allows ikiwiki to +process pages written using MediaWiki markup. -- cgit v1.2.3 From 22ec2912bed5e0f40c35f78500c2c34cd3b7949c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 20 Oct 2008 16:58:22 -0400 Subject: update --- doc/plugins/contrib/mediawiki.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/mediawiki.mdwn b/doc/plugins/contrib/mediawiki.mdwn index 162937ed9..c0a23254f 100644 --- a/doc/plugins/contrib/mediawiki.mdwn +++ b/doc/plugins/contrib/mediawiki.mdwn @@ -1,4 +1,4 @@ -[[!template id=plugin name=sar author="[[sabr]]"]] +[[!template id=plugin name=mediawiki author="[[sabr]]"]] [[!tag type/format]] [The Mediawiki plugin](http://u32.net/Mediawiki_Plugin/) allows ikiwiki to -- cgit v1.2.3 From df22dd5cbdb50f5686d15af7d288de05c4629029 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 20 Oct 2008 16:59:34 -0400 Subject: add header --- doc/plugins/contrib/highlightcode.mdwn | 3 +++ 1 file changed, 3 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/highlightcode.mdwn b/doc/plugins/contrib/highlightcode.mdwn index 9b43a106c..8abb76583 100644 --- a/doc/plugins/contrib/highlightcode.mdwn +++ b/doc/plugins/contrib/highlightcode.mdwn @@ -1,3 +1,6 @@ +[[!template id=plugin name=highlightcode author="[[sabr]]"]] +[[!tag type/format]] + A small plugin to allow Ikiwiki to display source files complete with syntax highlighting. Files with recognized extensions (i.e. my-file.cpp) are be rendered just like any other Ikiwiki page. You can even edit your source files with Ikiwiki's editor. It uses the Syntax::Highlight::Engine::Kate Perl module to do the highlighting. -- cgit v1.2.3 From eea52bccc967890c89cc9f87b16844a0a87ce5dc Mon Sep 17 00:00:00 2001 From: intrigeri Date: Mon, 20 Oct 2008 18:54:04 -0400 Subject: initial plugin public apparition --- doc/plugins/contrib/po.mdwn | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 doc/plugins/contrib/po.mdwn (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn new file mode 100644 index 000000000..06d491d01 --- /dev/null +++ b/doc/plugins/contrib/po.mdwn @@ -0,0 +1,16 @@ +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/). + +More information: + +* It can be found in my "po" branch on http://repo.or.cz/w/ikiwiki/intrigeri.git +* It involves adding three hooks to ikiwiki core. +* It is documented (including TODO and plans for next work steps) in `doc/plugins/po.mdwn`, which can be found in the same branch. +* No public demo site is available so far, I'm working on this. + +My plan is to get this plugin clean enough to be included in ikiwiki. + +The current version is a proof-of-concept, mature enough for me to dare submitting it here, +but I'm prepared to hear various helpful remarks, and to rewrite parts of it as needed. + +Any thoughts on this? -- cgit v1.2.3 From 93959d45db207690da03f1da216894821bfd78da Mon Sep 17 00:00:00 2001 From: intrigeri Date: Mon, 20 Oct 2008 18:56:21 -0400 Subject: formatting, added git clone information --- doc/plugins/contrib/po.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index 06d491d01..b22b8c179 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -3,7 +3,7 @@ translated with gettext, using [po4a](http://po4a.alioth.debian.org/). More information: -* It can be found in my "po" branch on http://repo.or.cz/w/ikiwiki/intrigeri.git +* It can be found in [my "po" branch](http://repo.or.cz/w/ikiwiki/intrigeri.git?a=shortlog;h=refs/heads/po): `git clone git://repo.or.cz/ikiwiki/intrigeri.git` * It involves adding three hooks to ikiwiki core. * It is documented (including TODO and plans for next work steps) in `doc/plugins/po.mdwn`, which can be found in the same branch. * No public demo site is available so far, I'm working on this. -- cgit v1.2.3 From 2c89dacde45d257207067cdeeb84dc7923f6cdad Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 20 Oct 2008 19:18:49 -0400 Subject: wow --- doc/plugins/contrib/po.mdwn | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index 06d491d01..83fc6c57c 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -14,3 +14,17 @@ The current version is a proof-of-concept, mature enough for me to dare submitti but I'm prepared to hear various helpful remarks, and to rewrite parts of it as needed. Any thoughts on this? + +> Well, I think it's pretty stunning what you've done here. Seems very +> complete and well thought out. I have not read the code in great detail +> yet. +> +> Just using po files is an approach I've never seen tried with a wiki. I +> suspect it will work better for some wikis than others. For wikis that +> just want translations that match the master language as closely as +> possible and don't wander off and diverge, it seems perfect. (But what happens +> if someone edits the Discussion page of a translated page?) +> +> Please keep me posted, when you get closer to having all issues solved +> and ready for merging I can do a review and hopefully help with the +> security items you listed. --[[Joey]] -- cgit v1.2.3 From ee1ccfa863b9d56cf7ec987f7fee89c98c484b0b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 20 Oct 2008 19:22:22 -0400 Subject: use relativedate as the css class for dates that should display relative --- IkiWiki/Plugin/relativedate.pm | 2 +- doc/plugins/relativedate.mdwn | 6 +++--- underlays/javascript/relativedate.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'doc/plugins') diff --git a/IkiWiki/Plugin/relativedate.pm b/IkiWiki/Plugin/relativedate.pm index d9d8f7776..f4dba61a4 100644 --- a/IkiWiki/Plugin/relativedate.pm +++ b/IkiWiki/Plugin/relativedate.pm @@ -53,7 +53,7 @@ sub display ($;$) { #{{{ my $gmtime=decode_utf8(POSIX::strftime("%a, %d %b %Y %H:%M:%S %z", localtime($time))); - return ''. + return ''. IkiWiki::formattime($time, $format).''; } #}}} diff --git a/doc/plugins/relativedate.mdwn b/doc/plugins/relativedate.mdwn index 121bce477..32f8c798b 100644 --- a/doc/plugins/relativedate.mdwn +++ b/doc/plugins/relativedate.mdwn @@ -10,7 +10,7 @@ show the absolute date instead. Also, this plugin can be used with other plugins like [[prettydate]] that change how the absolute date is displayed. If this plugin is enabled, you may also add relative dates to pages in the -wiki, by using html elements in the "date" class. For example, this will -display as a relative date: +wiki, by using html elements in the "relativedate" class. For example, this +will display as a relative date: - Fri Oct 17 18:36:13 EDT 2008 + Fri Oct 17 18:36:13 EDT 2008 diff --git a/underlays/javascript/relativedate.js b/underlays/javascript/relativedate.js index c5e62b3cc..8e05d4065 100644 --- a/underlays/javascript/relativedate.js +++ b/underlays/javascript/relativedate.js @@ -1,4 +1,4 @@ -// Causes html elements in the 'date' and 'pagedate' classes to be displayed +// Causes html elements in the 'relativedate' class to be displayed // as relative dates. The date is parsed from the title attribute, or from // the element content. @@ -7,7 +7,7 @@ var dateElements; hook("onload", getDates); function getDates() { - dateElements = getElementsByClass('date'); + dateElements = getElementsByClass('relativedate'); for (var i = 0; i < dateElements.length; i++) { var elt = dateElements[i]; var title = elt.attributes.title; -- cgit v1.2.3 From 94797b66c4d7f807245aa4bf09dd645468079142 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Mon, 20 Oct 2008 19:45:49 -0400 Subject: answering joey --- doc/plugins/contrib/po.mdwn | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index ad06e8570..cbc046d98 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -28,3 +28,19 @@ Any thoughts on this? > Please keep me posted, when you get closer to having all issues solved > and ready for merging I can do a review and hopefully help with the > security items you listed. --[[Joey]] + +>> Thanks a lot for your quick review, it's reassuring to hear such nice words +>> from you. I did not want to design and write a full translation system, when +>> tools such as gettext/po4a already have all the needed functionality, for cases +>> where the master/slave languages paradigm fits. +>> Integrating these tools into ikiwiki plugin system was a pleasure. +>> +>> I'll tell you when I'm ready for merging, but in the meantime, +>> I'd like you to review the changes I did to the core (3 added hooks). +>> Can you please do this? If not, I'll go on and hope I'm not going to far in +>> the wrong direction. +>> +>> The Discussion pages issue is something I am not sure about yet. But I will +>> probably decide that "slave" pages, being only translations, don't deserve +>> a discussion page: the discussion should happen in the language in which the +>> pages are written for real, which is the "master" one. --[[intrigeri]] -- cgit v1.2.3 From ec566c02fdf4e1f76e6559afbb8c01ec772412f8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 20 Oct 2008 20:57:42 -0400 Subject: response --- doc/plugins/contrib/po.mdwn | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index cbc046d98..30ede95a6 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -40,6 +40,14 @@ Any thoughts on this? >> Can you please do this? If not, I'll go on and hope I'm not going to far in >> the wrong direction. >> +>>> Sure.. I'm not completly happy with any of the hooks since they're very +>>> special purpose, and also since `run_hooks` is not the best interface +>>> for a hook that modifies a variable, where only the last hook run will +>>> actually do anything. It might be better to just wrap +>>> `targetpage`, `bestlink`, and `beautify_urlpath`. But, I noticed +>>> the other day that such wrappers around exported functions are only visible by +>>> plugins loaded after the plugin that defines them. +>> >> The Discussion pages issue is something I am not sure about yet. But I will >> probably decide that "slave" pages, being only translations, don't deserve >> a discussion page: the discussion should happen in the language in which the -- cgit v1.2.3 From 64d2ba358d306da18a09020119a94d525093ca03 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 21 Oct 2008 14:59:02 -0400 Subject: added link to po plugin --- doc/plugins/contrib/linguas.mdwn | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/linguas.mdwn b/doc/plugins/contrib/linguas.mdwn index 0c3366846..bf502606e 100644 --- a/doc/plugins/contrib/linguas.mdwn +++ b/doc/plugins/contrib/linguas.mdwn @@ -10,7 +10,8 @@ Download: [linguas.pm](http://ettin.org/pub/ikiwiki/linguas.pm) (2006-08-21). Note that even though it is still available for download, this plugin is no longer actively maintained. If you are interested in multilingual wiki pages, you -can also take a look at other approaches such as [[todo/l10n]] or Lars Wirzenius's +can also take a look at other approaches such as [[todo/l10n]], [[plugins/contrib/po]], +or Lars Wirzenius's [Static website, with translations, using IkiWiki](http://liw.iki.fi/liw/log/2007-05.html#20070528b). Usage -- cgit v1.2.3 From 70e0c9447add5853aa745f1f1e681e849f56c6f7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 21 Oct 2008 17:09:44 -0400 Subject: change obsolete example --- doc/plugins/write/external.mdwn | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/write/external.mdwn b/doc/plugins/write/external.mdwn index 272f74a7c..e30bf2ff3 100644 --- a/doc/plugins/write/external.mdwn +++ b/doc/plugins/write/external.mdwn @@ -96,14 +96,13 @@ the sentinal. ## Function injection -Some parts of ikiwiki are extensible by adding functions. For example, the -RCS interface relies on plugins providing several IkiWiki::rcs_* functions. +Some parts of ikiwiki are extensible by adding or overriding functions. It's actually possible to do this from an external plugin too. -To make your external plugin provide an `IkiWiki::rcs_update` function, for +To make your external plugin override the `IkiWiki::formattime` function, for example, make an RPC call to `inject`. Pass it named parameters "name" and "call", where "name" is the name of the function to inject into perl (here -"Ikiwiki::rcs_update" and "call" is the RPC call ikiwiki will make whenever +"Ikiwiki::formattime" and "call" is the RPC call ikiwiki will make whenever that function is run. If the RPC call is memoizable, you can also pass a "memoize" parameter, set -- cgit v1.2.3 From e75818572fff5256d16221a2b065b214d8cb9f5d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 21 Oct 2008 17:57:19 -0400 Subject: function injection overhaul Add an inject function, that can be used by plugins that want to replace one of ikiwiki's functions with their own version. (This is a scary thing that grubs through the symbol table, and replaces all exported occurances of a function with the injected version.) external: RPC functions can be injected to replace exported functions. Removed the stupid displaytime hook, and use injection instead. --- IkiWiki.pm | 46 +++++++++++++++++++++++++------------- IkiWiki/Plugin/external.pm | 8 ++++++- IkiWiki/Plugin/relativedate.pm | 4 ++-- debian/changelog | 5 +++++ doc/plugins/contrib/po.mdwn | 5 +++++ doc/plugins/write.mdwn | 50 ++++++++++++++++++++++++++++++++++++++++++ plugins/externaldemo | 10 ++++----- po/ikiwiki.pot | 14 ++++++------ 8 files changed, 111 insertions(+), 31 deletions(-) (limited to 'doc/plugins') diff --git a/IkiWiki.pm b/IkiWiki.pm index 207ca87fb..e0454963d 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -21,6 +21,7 @@ our @EXPORT = qw(hook debug error template htmlpage add_depends pagespec_match bestlink htmllink readfile writefile pagetype srcfile pagename displaytime will_render gettext urlto targetpage add_underlay pagetitle titlepage linkpage newpagefile + inject %config %links %pagestate %wikistate %renderedfiles %pagesources %destsources); our $VERSION = 2.00; # plugin interface version, next is ikiwiki version @@ -898,23 +899,13 @@ sub abs2rel ($$) { #{{{ } #}}} sub displaytime ($;$) { #{{{ - my $time=shift; - my $format=shift; - if (exists $hooks{displaytime}) { - my $ret; - run_hooks(displaytime => sub { - $ret=shift->($time, $format) - }); - return $ret; - } - else { - return formattime($time, $format); - } + # Plugins can override this function to mark up the time to + # display. + return ''.formattime(@_).''; } #}}} sub formattime ($;$) { #{{{ - # Plugins can override this function to mark up the time for - # display. + # Plugins can override this function to format the time. my $time=shift; my $format=shift; if (! defined $format) { @@ -1676,6 +1667,31 @@ sub yesno ($) { #{{{ return (defined $val && lc($val) eq gettext("yes")); } #}}} +sub inject { #{{{ + # Injects a new function into the symbol table to replace an + # exported function. + my %params=@_; + + # This is deep ugly perl foo, beware. + no strict; + no warnings; + if (! defined $params{parent}) { + $params{parent}='::'; + $params{old}=\&{$params{name}}; + $params{name}=~s/.*:://; + } + my $parent=$params{parent}; + foreach my $ns (grep /^\w+::/, keys %{$parent}) { + $ns = $params{parent} . $ns; + inject(%params, parent => $ns) unless $ns eq '::main::'; + *{$ns . $params{name}} = $params{call} + if exists ${$ns}{$params{name}} && + \&{${$ns}{$params{name}}} == $params{old}; + } + use strict; + use warnings; +} #}}} + sub pagespec_merge ($$) { #{{{ my $a=shift; my $b=shift; @@ -1770,7 +1786,7 @@ sub pagespec_valid ($) { #{{{ my $sub=pagespec_translate($spec); return ! $@; } #}}} - + sub glob2re ($) { #{{{ my $re=quotemeta(shift); $re=~s/\\\*/.*/g; diff --git a/IkiWiki/Plugin/external.pm b/IkiWiki/Plugin/external.pm index 287e118f1..4ce9c8bab 100644 --- a/IkiWiki/Plugin/external.pm +++ b/IkiWiki/Plugin/external.pm @@ -202,10 +202,16 @@ sub inject ($@) { #{{{ my $sub = sub { IkiWiki::Plugin::external::rpc_call($plugin, $params{call}, @_) }; + $sub=memoize($sub) if $params{memoize}; + + # This will add it to the symbol table even if not present. no warnings; eval qq{*$params{name}=\$sub}; use warnings; - memoize($params{name}) if $params{memoize}; + + # This will ensure that everywhere it was exported to sees + # the injected version. + IkiWiki::inject(name => $params{name}, call => $sub); return 1; } #}}} diff --git a/IkiWiki/Plugin/relativedate.pm b/IkiWiki/Plugin/relativedate.pm index f4dba61a4..dc8f7d538 100644 --- a/IkiWiki/Plugin/relativedate.pm +++ b/IkiWiki/Plugin/relativedate.pm @@ -12,7 +12,7 @@ sub import { #{{{ add_underlay("javascript"); hook(type => "getsetup", id => "relativedate", call => \&getsetup); hook(type => "format", id => "relativedate", call => \&format); - hook(type => "displaytime", id => "relativedate", call => \&display); + inject(name => "IkiWiki::displaytime", call => \&mydisplaytime); } # }}} sub getsetup () { #{{{ @@ -43,7 +43,7 @@ sub include_javascript ($;$) { #{{{ '" type="text/javascript" charset="utf-8">'; } #}}} -sub display ($;$) { #{{{ +sub mydisplaytime ($;$) { #{{{ my $time=shift; my $format=shift; diff --git a/debian/changelog b/debian/changelog index 928cd8666..e1baea8ce 100644 --- a/debian/changelog +++ b/debian/changelog @@ -24,6 +24,11 @@ ikiwiki (2.68) UNRELEASED; urgency=low the toplevel tagpage, and not closer subpages. The html links already went there, but internally the links were not recorded as absolute, which could cause confusing backlinks etc. + * Add an inject function, that can be used by plugins that want to + replace one of ikiwiki's functions with their own version. + (This is a scary thing that grubs through the symbol table, and replaces + all exported occurances of a function with the injected version.) + * external: RPC functions can be injected to replace exported functions. -- Joey Hess Fri, 17 Oct 2008 20:11:02 -0400 diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index 30ede95a6..c4b7f9ee9 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -47,6 +47,11 @@ Any thoughts on this? >>> `targetpage`, `bestlink`, and `beautify_urlpath`. But, I noticed >>> the other day that such wrappers around exported functions are only visible by >>> plugins loaded after the plugin that defines them. +>>> +>>> Update: Take a look at the new "Function overriding" section of +>>> [[plugins/write]]. I think you can just inject wrappers about a few ikiwiki +>>> functions, rather than adding hooks. The `inject` function is pretty +>>> insane^Wlow level, but seems to work great. --[[Joey]] >> >> The Discussion pages issue is something I am not sure about yet. But I will >> probably decide that "slave" pages, being only translations, don't deserve diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 856b34ba1..2e11e6234 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -854,6 +854,56 @@ By the way, to parse a ikiwiki setup file and populate `%config`, a program just needs to do something like: `use IkiWiki::Setup; IkiWiki::Setup::load($filename)` +### Function overriding + +Sometimes using ikiwiki's pre-defined hooks is not enough. Your plugin +may need to replace one of ikiwiki's own functions with a modified version, +or wrap one of the functions. + +For example, your plugin might want to override `displaytime`, to change +the html markup used when displaying a date. Or it might want to override +`IkiWiki::formattime`, to change how a date is formatted. Or perhaps you +want to override `bestlink` and change how ikiwiki deals with WikiLinks. + +By venturing into this territory, your plugin is becoming tightly tied to +ikiwiki's internals. And it might break if those internals change. But +don't let that stop you, if you're brave. + +Ikiwiki provides an `inject()` function, that is a powerful way to replace +any function with one of your own. This even allows you to inject a +replacement for an exported function, like `bestlink`. Everything that +imports that function will get your version instead. Pass it the name of +the function to replace, and a new function to call. + +For example, here's how to replace `displaytime` with a version using HTML 5 +markup: + + inject(name => 'IkiWiki::displaytime', call => sub { + return ""; + }); + +Here's how to wrap `bestlink` with a version that tries to handle +plural words: + + my $origbestlink=\&bestlink; + inject(name => 'IkiWiki::bestlink', call => \&mybestlink); + + sub deplural ($) { + my $word=shift; + $word =~ s/e?s$//; # just an example :-) + return $word; + } + + sub mybestlink ($$) { + my $page=shift; + my $link=shift; + my $ret=$origbestlink->($page, $link); + if (! length $ret) { + $ret=$origbestlink->($page, deplural($link)); + } + return $ret; + } + ### Javascript Some plugins use javascript to make ikiwiki look a bit more web-2.0-ish. diff --git a/plugins/externaldemo b/plugins/externaldemo index 4d13f2444..be7aba8b9 100755 --- a/plugins/externaldemo +++ b/plugins/externaldemo @@ -106,9 +106,8 @@ sub import { rpc_call("getvar", "config", "url")."\n"; # Here's an example of how to inject an arbitrary function into - # ikiwiki, replacing a core function. - # Note use of automatic memoization. - rpc_call("inject", name => "IkiWiki::formattime", + # ikiwiki. Note use of automatic memoization. + rpc_call("inject", name => "IkiWiki::bob", call => "formattime", memoize => 1); print STDERR "externaldemo plugin successfully imported\n"; @@ -126,9 +125,8 @@ sub preprocess { return "externaldemo plugin preprocessing on $title!"; } -sub formattime { - print STDERR "externaldemo plugin's formattime called via RPC"; - return scalar "formatted time: ".localtime(shift); +sub bob { + print STDERR "externaldemo plugin's bob called via RPC"; } # Now all that's left to do is loop and handle each incoming RPC request. diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot index 335575f02..4452ea8dc 100644 --- a/po/ikiwiki.pot +++ b/po/ikiwiki.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-10-19 20:06-0400\n" +"POT-Creation-Date: 2008-10-21 17:51-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -48,7 +48,7 @@ msgstr "" msgid "You are banned." msgstr "" -#: ../IkiWiki/CGI.pm:385 ../IkiWiki/CGI.pm:386 ../IkiWiki.pm:1182 +#: ../IkiWiki/CGI.pm:385 ../IkiWiki/CGI.pm:386 ../IkiWiki.pm:1175 msgid "Error" msgstr "" @@ -913,25 +913,25 @@ msgstr "" msgid "refreshing wiki.." msgstr "" -#: ../IkiWiki.pm:458 +#: ../IkiWiki.pm:459 msgid "Must specify url to wiki with --url when using --cgi" msgstr "" -#: ../IkiWiki.pm:504 +#: ../IkiWiki.pm:505 msgid "cannot use multiple rcs plugins" msgstr "" -#: ../IkiWiki.pm:533 +#: ../IkiWiki.pm:534 #, perl-format msgid "failed to load external plugin needed for %s plugin: %s" msgstr "" -#: ../IkiWiki.pm:1165 +#: ../IkiWiki.pm:1158 #, perl-format msgid "preprocessing loop detected on %s at depth %i" msgstr "" -#: ../IkiWiki.pm:1674 +#: ../IkiWiki.pm:1667 msgid "yes" msgstr "" -- cgit v1.2.3 From b33ce3139cd5be5e5d903c62ce1e281af2645d6f Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 21 Oct 2008 19:17:49 -0400 Subject: thanks! --- doc/plugins/contrib/po.mdwn | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index c4b7f9ee9..f60b8fbea 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -53,6 +53,10 @@ Any thoughts on this? >>> functions, rather than adding hooks. The `inject` function is pretty >>> insane^Wlow level, but seems to work great. --[[Joey]] >> +>>>> Thanks a lot, it seems to be a nice interface for what I was trying to achieve. +>>>> I may be forced to wait two long weeks before I have a chance to confirm +>>>> this. Stay tuned. --[[intrigeri]] +>> >> The Discussion pages issue is something I am not sure about yet. But I will >> probably decide that "slave" pages, being only translations, don't deserve >> a discussion page: the discussion should happen in the language in which the -- cgit v1.2.3 From 97b94e4e88c8aab955451121eb984ee568530caa Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 21 Oct 2008 20:37:49 -0400 Subject: displaytime hook is gone --- doc/plugins/write.mdwn | 7 ------- 1 file changed, 7 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 2e11e6234..0d244e1f5 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -360,13 +360,6 @@ This hook is called whenever ikiwiki normally saves its state, just before the state is saved. The function can save other state, modify values before they're saved, etc. -### displaytime - - hook(type => "displaytime", id => "foo", call => \&display); - -This hook can be registered to override the regular `displaytime` function. -Only the last displaytime hook will be used. - ### renamepage hook(type => "renamepage", id => "foo", call => \&renamepage); -- cgit v1.2.3 From 094af3d113f375f7faf2abf283615582a9977a65 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 22 Oct 2008 20:52:34 -0400 Subject: initial support for git repos with untrusted committers Still need to wire up the calls to check_* , but it's cold out here and my hands are going numb, so enough for now. --- IkiWiki.pm | 11 +++++ IkiWiki/Plugin/git.pm | 115 ++++++++++++++++++++++++++++++++++++++++++++----- doc/plugins/write.mdwn | 9 ++++ doc/rcs/details.mdwn | 3 ++ doc/rcs/git.mdwn | 27 ++++++++++++ ikiwiki.in | 3 ++ 6 files changed, 158 insertions(+), 10 deletions(-) (limited to 'doc/plugins') diff --git a/IkiWiki.pm b/IkiWiki.pm index e0454963d..245eaafba 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -382,6 +382,13 @@ sub getsetup () { #{{{ safe => 0, rebuild => 0, }, + test_receive => { + type => "internal", + default => 0, + description => "running in receive test mode", + safe => 0, + rebuild => 0, + }, getctime => { type => "internal", default => 0, @@ -1575,6 +1582,10 @@ sub rcs_getctime ($) { #{{{ $hooks{rcs}{rcs_getctime}{call}->(@_); } #}}} +sub rcs_test_receive ($) { #{{{ + $hooks{rcs}{rcs_test_receive}{call}->(@_); +} #}}} + sub globlist_to_pagespec ($) { #{{{ my @globlist=split(' ', shift); diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index 14b0ab285..1facb14c0 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -23,6 +23,7 @@ sub import { #{{{ hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges); hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff); hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime); + hook(type => "rcs", id => "rcs_test_receive", call => \&rcs_test_receive); } #}}} sub checkconfig () { #{{{ @@ -32,12 +33,21 @@ sub checkconfig () { #{{{ if (! defined $config{gitmaster_branch}) { $config{gitmaster_branch}="master"; } - if (defined $config{git_wrapper} && length $config{git_wrapper}) { + if (defined $config{git_wrapper} && + length $config{git_wrapper}) { push @{$config{wrappers}}, { wrapper => $config{git_wrapper}, wrappermode => (defined $config{git_wrappermode} ? $config{git_wrappermode} : "06755"), }; } + if (defined $config{git_test_receive_wrapper} && + length $config{git_test_receive_wrapper}) { + push @{$config{wrappers}}, { + test_receive => 1, + wrapper => $config{git_test_receive_wrapper}, + wrappermode => "0755", + }; + } } #}}} sub getsetup () { #{{{ @@ -60,6 +70,20 @@ sub getsetup () { #{{{ safe => 0, rebuild => 0, }, + git_test_receive_wrapper => { + type => "string", + example => "/git/wiki.git/hooks/pre-receive", + description => "git pre-receive hook to generate", + safe => 0, # file + rebuild => 0, + }, + git_untrusted_committers => { + type => "string", + example => [], + description => "unix users whose commits should be checked by the pre-receive hook", + safe => 0, + rebuild => 0, + }, historyurl => { type => "string", example => "http://git.example.com/gitweb.cgi?p=wiki.git;a=history;f=[[file]]", @@ -320,6 +344,9 @@ sub parse_diff_tree ($@) { #{{{ 'file' => decode("utf8", $file), 'sha1_from' => $sha1_from[0], 'sha1_to' => $sha1_to, + 'mode_from' => $mode_from[0], + 'mode_to' => $mode_to, + 'status' => $status, }; } next; @@ -331,14 +358,12 @@ sub parse_diff_tree ($@) { #{{{ } #}}} sub git_commit_info ($;$) { #{{{ - # Return an array of commit info hashes of num commits (default: 1) + # Return an array of commit info hashes of num commits # starting from the given sha1sum. - my ($sha1, $num) = @_; - $num ||= 1; - - my @raw_lines = run_or_die('git', 'log', "--max-count=$num", + my @raw_lines = run_or_die('git', 'log', + (defined $num ? "--max-count=$num" : ""), '--pretty=raw', '--raw', '--abbrev=40', '--always', '-c', '-r', $sha1, '--', '.'); my ($prefix) = run_or_die('git', 'rev-parse', '--show-prefix'); @@ -355,7 +380,6 @@ sub git_commit_info ($;$) { #{{{ sub git_sha1 (;$) { #{{{ # Return head sha1sum (of given file). - my $file = shift || q{--}; # Ignore error since a non-existing file might be given. @@ -378,7 +402,6 @@ sub rcs_update () { #{{{ sub rcs_prepedit ($) { #{{{ # Return the commit sha1sum of the file when editing begins. # This will be later used in rcs_commit if a merge is required. - my ($file) = @_; return git_sha1($file); @@ -475,7 +498,7 @@ sub rcs_recentchanges ($) { #{{{ error($@) if $@; my @rets; - foreach my $ci (git_commit_info('HEAD', $num)) { + foreach my $ci (git_commit_info('HEAD', $num || 1)) { # Skip redundant commits. next if ($ci->{'comment'} && @{$ci->{'comment'}}[0] eq $dummy_commit_msg); @@ -558,11 +581,83 @@ sub rcs_getctime ($) { #{{{ $file =~ s/^\Q$config{srcdir}\E\/?//; my $sha1 = git_sha1($file); - my $ci = git_commit_info($sha1); + my $ci = git_commit_info($sha1, 1); my $ctime = $ci->{'author_epoch'}; debug("ctime for '$file': ". localtime($ctime)); return $ctime; } #}}} +sub rcs_test_receive () { #{{{ + # quick success if the user is trusted + my $committer=(getpwuid($<))[0]; + if (! defined $committer) { + error("cannot determine username for $<"); + } + exit 0 if ! ref $config{git_untrusted_committers} || + ! grep { $_ eq $committer } @{$config{git_untrusted_committers}}; + + # The wiki may not be the only thing in the git repo. + # Determine if it is in a subdirectory by examining the srcdir, + # and its parents, looking for the .git directory. + my $subdir=""; + my $dir=$config{srcdir}; + while (! -d "$dir/.git") { + $subdir=IkiWiki::basename($dir)."/".$subdir; + $dir=IkiWiki::dirname($dir); + if (! length $dir) { + error("cannot determine root of git repo"); + } + } + + my @errors; + while (<>) { + chomp; + my ($oldrev, $newrev, $refname) = split(' ', $_, 3); + + # only allow changes to gitmaster_branch + if ($refname !~ /^refs\/heads\/\Q$config{gitmaster_branch}\E$/) { + push @errors, sprintf(gettext("you are not allowed to change %s"), $refname); + } + + foreach my $ci (git_commit_info($oldrev."..".$newrev)) { + foreach my $detail (@{ $ci->{'details'} }) { + my $file = $detail->{'file'}; + + # check that all changed files are in the subdir + if (length $subdir && + ! ($file =~ s/^\Q$subdir\E//)) { + push @errors, sprintf(gettext("you are not allowed to change %s"), $file); + next; + } + + if ($detail->{'mode_from'} ne $detail->{'mode_to'}) { + push @errors, gettext("you are not allowed to change file modes"); + } + + if ($detail->{'status'} =~ /^D+\d*/) { + # TODO check_canremove + } + elsif ($detail->{'status'} !~ /^[MA]+\d*$/) { + push @errors, "unknown status ".$detail->{'status'}; + } + else { + # TODO check_canedit + # TODO check_canattach + } + } + } + } + + if (@errors) { + # TODO clean up objects from failed push + + print STDERR "$_\n" foreach @errors; + exit 1; + } + else { + exit 0; + } +} #}}} + 1 diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 0d244e1f5..5a5db6be0 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -820,6 +820,15 @@ it up in the history. It's ok if this is not implemented, and throws an error. +#### `rcs_test_receive()` + +This is used to test if changes pushed into the RCS should be accepted. +Ikiwiki will be running as a pre-receive hook (or equivilant) and should +examine the incoming changes, decide if they are allowed, and communicate +that to the RCS. + +This is optional, and doesn't make sense for all RCSs. + ### PageSpec plugins It's also possible to write plugins that add new functions to diff --git a/doc/rcs/details.mdwn b/doc/rcs/details.mdwn index e62f3ef49..089221cab 100644 --- a/doc/rcs/details.mdwn +++ b/doc/rcs/details.mdwn @@ -280,6 +280,9 @@ Here is a how a commit from a remote repository works: * git-commit in the remote repository * git-push, pushes the commit to the master repo on the server +* (Optionally, the master repo's pre-receive hook runs, and checks that the + update only modifies files that the pushing user is allowed to update. + If not, it aborts the receive.) * the master repo's post-update hook notices this update, and runs ikiwiki * ikiwiki notices the modifies page source, and compiles it diff --git a/doc/rcs/git.mdwn b/doc/rcs/git.mdwn index b210af825..2a6feecf5 100644 --- a/doc/rcs/git.mdwn +++ b/doc/rcs/git.mdwn @@ -100,6 +100,33 @@ repository, should only be writable by the wiki's admin, and *not* by the group. Take care that ikiwiki uses a umask that does not cause files in the srcdir to become group writable. (umask 022 will work.) +## git repository with untrusted committers + +By default, anyone who can commit to the git repository can modify any file +on the wiki however they like. A `pre-receive` hook can be set up to limit +incoming commits from untrusted users. Then the same limits that are placed +on edits via the web will be in effect for commits to git for the users. +They will not be allowed to edit locked pages, they will only be able to +delete pages that the [[plugins/remove]] configuration allows them to +remove, and they will only be allowed to add non-page attachments that the +[[plugins/attachment]] configuration allows. + +To enable this, you need to set up the git repository to have multiple +committers. Trusted committers, including the user that ikiwiki runs as, +will not have their commits checked by the `pre-receive` hook. Untrusted +committers will have their commits checked. The configuration settings to +enable are `git_test_receive_wrapper`, which enables generation of a +`pre-receive` hook, and `git_untrusted_committers`, which is a list of +usernames of the untrusted committers. + +Note that when the `pre-receive` hook is checking incoming changes, it +ignores the git authorship information, and uses the username of the unix +user who made the commit. Then tests including the `locked_pages` [[PageSpec]] +are checked to see if that user can edit the pages in the commit. + +You can even set up an anonymous user, to allow anyone to push +changes in via git rather than using the web interface. + ## Optionally using a local wiki to preview changes When working on the "working clones" to add content to your wiki, diff --git a/ikiwiki.in b/ikiwiki.in index 4f24cfc2e..873bde0df 100755 --- a/ikiwiki.in +++ b/ikiwiki.in @@ -183,6 +183,9 @@ sub main () { #{{{ elsif ($config{post_commit} && ! commit_hook_enabled()) { # do nothing } + elsif ($config{test_receive}) { + rcs_test_receive(); + } else { if ($config{rebuild}) { debug(gettext("rebuilding wiki..")); -- cgit v1.2.3 From 4669eab596c8d90de0cf9f9d359ad8dd8f48edb5 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 23 Oct 2008 16:29:50 -0400 Subject: more work on untrusted committers Wired up check_canedit and check_canremove, still need to deal with check_canattach, and test. --- IkiWiki.pm | 4 +- IkiWiki/Plugin/editpage.pm | 2 +- IkiWiki/Plugin/git.pm | 70 ++++++++++++++++--------------- IkiWiki/Plugin/remove.pm | 2 +- IkiWiki/Receive.pm | 101 +++++++++++++++++++++++++++++++++++++++++++++ doc/plugins/write.mdwn | 24 ++++++++--- doc/rcs/git.mdwn | 2 +- ikiwiki.in | 10 ++++- 8 files changed, 168 insertions(+), 47 deletions(-) create mode 100644 IkiWiki/Receive.pm (limited to 'doc/plugins') diff --git a/IkiWiki.pm b/IkiWiki.pm index 245eaafba..698244187 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -1582,8 +1582,8 @@ sub rcs_getctime ($) { #{{{ $hooks{rcs}{rcs_getctime}{call}->(@_); } #}}} -sub rcs_test_receive ($) { #{{{ - $hooks{rcs}{rcs_test_receive}{call}->(@_); +sub rcs_receive ($) { #{{{ + $hooks{rcs}{rcs_receive}{call}->(@_); } #}}} sub globlist_to_pagespec ($) { #{{{ diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm index 30c93df20..fe2864bac 100644 --- a/IkiWiki/Plugin/editpage.pm +++ b/IkiWiki/Plugin/editpage.pm @@ -122,7 +122,7 @@ sub cgi_editpage ($$) { #{{{ my $absolute=($page =~ s#^/+##); if (! defined $page || ! length $page || file_pruned($page, $config{srcdir})) { - error("bad page name"); + error(gettext("bad page name")); } my $baseurl = urlto($page, undef, 1); diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index 1facb14c0..234e7af2e 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -23,7 +23,7 @@ sub import { #{{{ hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges); hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff); hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime); - hook(type => "rcs", id => "rcs_test_receive", call => \&rcs_test_receive); + hook(type => "rcs", id => "rcs_receive", call => \&rcs_receive); } #}}} sub checkconfig () { #{{{ @@ -77,7 +77,7 @@ sub getsetup () { #{{{ safe => 0, # file rebuild => 0, }, - git_untrusted_committers => { + untrusted_committers => { type => "string", example => [], description => "unix users whose commits should be checked by the pre-receive hook", @@ -588,15 +588,7 @@ sub rcs_getctime ($) { #{{{ return $ctime; } #}}} -sub rcs_test_receive () { #{{{ - # quick success if the user is trusted - my $committer=(getpwuid($<))[0]; - if (! defined $committer) { - error("cannot determine username for $<"); - } - exit 0 if ! ref $config{git_untrusted_committers} || - ! grep { $_ eq $committer } @{$config{git_untrusted_committers}}; - +sub rcs_receive () { #{{{ # The wiki may not be the only thing in the git repo. # Determine if it is in a subdirectory by examining the srcdir, # and its parents, looking for the .git directory. @@ -610,54 +602,64 @@ sub rcs_test_receive () { #{{{ } } - my @errors; + my @rets; while (<>) { chomp; my ($oldrev, $newrev, $refname) = split(' ', $_, 3); # only allow changes to gitmaster_branch if ($refname !~ /^refs\/heads\/\Q$config{gitmaster_branch}\E$/) { - push @errors, sprintf(gettext("you are not allowed to change %s"), $refname); + error sprintf(gettext("you are not allowed to change %s"), $refname); } foreach my $ci (git_commit_info($oldrev."..".$newrev)) { foreach my $detail (@{ $ci->{'details'} }) { my $file = $detail->{'file'}; - # check that all changed files are in the subdir + # check that all changed files are in the + # subdir if (length $subdir && ! ($file =~ s/^\Q$subdir\E//)) { - push @errors, sprintf(gettext("you are not allowed to change %s"), $file); - next; + error sprintf(gettext("you are not allowed to change %s"), $file); } - if ($detail->{'mode_from'} ne $detail->{'mode_to'}) { - push @errors, gettext("you are not allowed to change file modes"); + my $action; + my $mode; + if ($detail->{'status'} =~ /^[M]+\d*$/) { + $action="change"; + $mode=$detail->{'mode_to'}; } - - if ($detail->{'status'} =~ /^D+\d*/) { - # TODO check_canremove + elsif ($detail->{'status'} =~ /^[AM]+\d*$/) { + $action="add"; + $mode=$detail->{'mode_to'}; } - elsif ($detail->{'status'} !~ /^[MA]+\d*$/) { - push @errors, "unknown status ".$detail->{'status'}; + elsif ($detail->{'status'} =~ /^[DAM]+\d*/) { + $action="remove"; + $mode=$detail->{'mode_from'}; } else { - # TODO check_canedit - # TODO check_canattach + error "unknown status ".$detail->{'status'}; } + + # test that the file mode is ok + if ($mode !~ /^100[64][64][64]$/) { + error sprintf(gettext("you cannot act on a file with mode %s"), $mode); + } + if ($action eq "change") { + if ($detail->{'mode_from'} ne $detail->{'mode_to'}) { + error gettext("you are not allowed to change file modes"); + } + } + + push @rets, { + file => $file, + action => $action, + }; } } } - if (@errors) { - # TODO clean up objects from failed push - - print STDERR "$_\n" foreach @errors; - exit 1; - } - else { - exit 0; - } + return @rets; } #}}} 1 diff --git a/IkiWiki/Plugin/remove.pm b/IkiWiki/Plugin/remove.pm index 68bf9d1ee..c512b3b97 100644 --- a/IkiWiki/Plugin/remove.pm +++ b/IkiWiki/Plugin/remove.pm @@ -41,7 +41,7 @@ sub check_canremove ($$$) { #{{{ error(sprintf(gettext("%s is not a file"), $file)); } - # Must be editiable. + # Must be editable. IkiWiki::check_canedit($page, $q, $session); # If a user can't upload an attachment, don't let them delete it. diff --git a/IkiWiki/Receive.pm b/IkiWiki/Receive.pm new file mode 100644 index 000000000..63944bb81 --- /dev/null +++ b/IkiWiki/Receive.pm @@ -0,0 +1,101 @@ +#!/usr/bin/perl + +package IkiWiki::Receive; + +use warnings; +use strict; +use IkiWiki; + +sub getuser () { #{{{ + my $user=(getpwuid($<))[0]; + if (! defined $user) { + error("cannot determine username for $<"); + } + return $user; +} #}}} + +sub trusted () { #{{{ + my $user=getuser(); + return ! ref $config{untrusted_committers} || + ! grep { $_ eq $user } @{$config{untrusted_committers}}; +} #}}} + +sub test () { #{{{ + exit 0 if trusted(); + IkiWiki::rcs_test_receive(); + + # Dummy up a cgi environment to use when calling check_canedit + # and friends. + eval q{use CGI}; + error($@) if $@; + my $cgi=CGI->new; + require IkiWiki::CGI; + my $session=IkiWiki::cgi_getsession($cgi); + my $user=getuser(); + $session->param("name", $user); + $ENV{REMOTE_ADDR}='unknown' unless exists $ENV{REMOTE_ADDR}; + + lockwiki(); + loadindex(); + + my %newfiles; + + foreach my $change (IkiWiki::rcs_receive()) { + # This untaint is safe because we check file_pruned and + # wiki_file_regexp. + my $file=$change->{file}=~/$config{wiki_file_regexp}/; + $file=possibly_foolish_untaint($file); + if (! defined $file || ! length $file || + IkiWiki::file_pruned($file, $config{srcdir})) { + error(gettext("bad file name")); + } + + my $type=pagetype($file); + my $page=pagename($file) if defined $type; + + if ($change->{action} eq 'add') { + $newfiles{$file}=1; + } + + if ($change->{action} eq 'change' || + $change->{action} eq 'add') { + if (defined $page) { + if (IkiWiki->can("check_canedit") && + IkiWiki::check_canedit($page, $cgi, $session)) { + next; + } + } + else { + # TODO + #if (IkiWiki::Plugin::attachment->can("check_canattach") && + # IkiWiki::Plugin::attachment::check_canattach($session, $file, $path)) { + # next; + #} + } + } + elsif ($change->{action} eq 'remove') { + # check_canremove tests to see if the file is present + # on disk. This will fail is a single commit adds a + # file and then removes it again. Avoid the problem + # by not testing the removal in such pairs of changes. + # (The add is still tested, just to make sure that + # no data is added to the repo that a web edit + # could add.) + next if $newfiles{$file}; + + if (IkiWiki::Plugin::remove->can("check_canremove") && + IkiWiki::Plugin::remove::check_canremove(defined $page ? $page : $file, $cgi, $session)) { + next; + } + } + else { + error "unknown action ".$change->{action}; + } + + error sprintf(gettext("you are not allowed to change %s"), $file); + } + + exit 0; +} #}}} + +1 diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 5a5db6be0..9f096e4f7 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -820,14 +820,26 @@ it up in the history. It's ok if this is not implemented, and throws an error. -#### `rcs_test_receive()` +#### `rcs_receive()` -This is used to test if changes pushed into the RCS should be accepted. -Ikiwiki will be running as a pre-receive hook (or equivilant) and should -examine the incoming changes, decide if they are allowed, and communicate -that to the RCS. +This is called when ikiwiki is running as a pre-receive hook (or +equivilant), and is testing if changes pushed into the RCS from an +untrusted user should be accepted. This is optional, and doesn't make +sense to implement for all RCSs. -This is optional, and doesn't make sense for all RCSs. +It should examine the incoming changes, and do any sanity +checks that are appropriate for the RCS to limit changes to safe file adds, +removes, and renames. If something bad is found, it should exit +nonzero, to abort the push. Otherwise, it should return a list of +files that were changed, in the form: + + { + file => # name of file that was changed + action => # either "add", "change", or "remove" + } + +The list will then be checked to make sure that each change is one that +is allowed to be made via the web interface. ### PageSpec plugins diff --git a/doc/rcs/git.mdwn b/doc/rcs/git.mdwn index 2a6feecf5..6ba0da894 100644 --- a/doc/rcs/git.mdwn +++ b/doc/rcs/git.mdwn @@ -116,7 +116,7 @@ committers. Trusted committers, including the user that ikiwiki runs as, will not have their commits checked by the `pre-receive` hook. Untrusted committers will have their commits checked. The configuration settings to enable are `git_test_receive_wrapper`, which enables generation of a -`pre-receive` hook, and `git_untrusted_committers`, which is a list of +`pre-receive` hook, and `untrusted_committers`, which is a list of usernames of the untrusted committers. Note that when the `pre-receive` hook is checking incoming changes, it diff --git a/ikiwiki.in b/ikiwiki.in index 22addb463..60663bc89 100755 --- a/ikiwiki.in +++ b/ikiwiki.in @@ -119,10 +119,15 @@ sub getconfig () { #{{{ } delete $ENV{WRAPPED_OPTIONS}; - # optimisation for no-op post_commit if ($config{post_commit} && ! commit_hook_enabled()) { + # optimisation for no-op post_commit exit 0; } + elsif ($config{test_receive}) { + # quick success if the user is trusted + require IkiWiki::Receive; + exit 0 if IkiWiki::Receive::trusted(); + } loadplugins(); checkconfig(); @@ -190,7 +195,8 @@ sub main () { #{{{ # do nothing } elsif ($config{test_receive}) { - rcs_test_receive(); + require IkiWiki::Receive; + IkiWiki::Receive::test(); } else { if ($config{rebuild}) { -- cgit v1.2.3 From ad9e443f22a139c71f0cd05885cda3e418f27567 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 23 Oct 2008 16:56:40 -0400 Subject: check_canattach hooked up --- IkiWiki/Plugin/git.pm | 33 ++++++++++++++++++++++++++------- IkiWiki/Receive.pm | 9 ++++----- doc/plugins/write.mdwn | 5 ++++- 3 files changed, 34 insertions(+), 13 deletions(-) (limited to 'doc/plugins') diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index 234e7af2e..bdac6f7a1 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -9,6 +9,7 @@ use open qw{:utf8 :std}; my $sha1_pattern = qr/[0-9a-fA-F]{40}/; # pattern to validate Git sha1sums my $dummy_commit_msg = 'dummy commit'; # message to skip in recent changes +my $no_chdir=0; sub import { #{{{ hook(type => "checkconfig", id => "git", call => \&checkconfig); @@ -127,8 +128,10 @@ sub safe_git (&@) { #{{{ if (!$pid) { # In child. # Git commands want to be in wc. - chdir $config{srcdir} - or error("Cannot chdir to $config{srcdir}: $!"); + if (! $no_chdir) { + chdir $config{srcdir} + or error("Cannot chdir to $config{srcdir}: $!"); + } exec @cmdline or error("Cannot exec '@cmdline': $!"); } # In parent. @@ -606,13 +609,20 @@ sub rcs_receive () { #{{{ while (<>) { chomp; my ($oldrev, $newrev, $refname) = split(' ', $_, 3); - + # only allow changes to gitmaster_branch if ($refname !~ /^refs\/heads\/\Q$config{gitmaster_branch}\E$/) { error sprintf(gettext("you are not allowed to change %s"), $refname); } - - foreach my $ci (git_commit_info($oldrev."..".$newrev)) { + + # Avoid chdir when running git here, because the changes + # are in the master git repo, not the srcdir repo. + # The pre-recieve hook already puts us in the right place. + $no_chdir=1; + my @changes=git_commit_info($oldrev."..".$newrev); + $no_chdir=0; + + foreach my $ci (@changes) { foreach my $detail (@{ $ci->{'details'} }) { my $file = $detail->{'file'}; @@ -623,8 +633,7 @@ sub rcs_receive () { #{{{ error sprintf(gettext("you are not allowed to change %s"), $file); } - my $action; - my $mode; + my ($action, $mode, $path); if ($detail->{'status'} =~ /^[M]+\d*$/) { $action="change"; $mode=$detail->{'mode_to'}; @@ -632,6 +641,15 @@ sub rcs_receive () { #{{{ elsif ($detail->{'status'} =~ /^[AM]+\d*$/) { $action="add"; $mode=$detail->{'mode_to'}; + if (! pagetype($file)) { + eval q{use File::Temp}; + die $@ if $@; + my $fh; + ($fh, $path)=tempfile("XXXXXXXXXX", UNLINK => 1); + if (system("git show ".$detail->{sha1_to}." > '$path'") != 0) { + error("failed writing temp file"); + } + } } elsif ($detail->{'status'} =~ /^[DAM]+\d*/) { $action="remove"; @@ -654,6 +672,7 @@ sub rcs_receive () { #{{{ push @rets, { file => $file, action => $action, + path => $path, }; } } diff --git a/IkiWiki/Receive.pm b/IkiWiki/Receive.pm index 63944bb81..4d437cf78 100644 --- a/IkiWiki/Receive.pm +++ b/IkiWiki/Receive.pm @@ -66,11 +66,10 @@ sub test () { #{{{ } } else { - # TODO - #if (IkiWiki::Plugin::attachment->can("check_canattach") && - # IkiWiki::Plugin::attachment::check_canattach($session, $file, $path)) { - # next; - #} + if (IkiWiki::Plugin::attachment->can("check_canattach") && + IkiWiki::Plugin::attachment::check_canattach($session, $file, $change->{path})) { + next; + } } } elsif ($change->{action} eq 'remove') { diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 9f096e4f7..7fbe4bd57 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -829,13 +829,16 @@ sense to implement for all RCSs. It should examine the incoming changes, and do any sanity checks that are appropriate for the RCS to limit changes to safe file adds, -removes, and renames. If something bad is found, it should exit +removes, and changes. If something bad is found, it should exit nonzero, to abort the push. Otherwise, it should return a list of files that were changed, in the form: { file => # name of file that was changed action => # either "add", "change", or "remove" + path => # temp file containing the new file content, only + # needed for "add", and only if the file is an + # attachment, not a page } The list will then be checked to make sure that each change is one that -- cgit v1.2.3 From 0a081d78c4b4f24592f19e896b4f7daea30e9ef1 Mon Sep 17 00:00:00 2001 From: tschwinge Date: Fri, 24 Oct 2008 05:40:52 -0400 Subject: Typo fix. --- doc/plugins/write.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 7fbe4bd57..5ee4acb53 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -823,7 +823,7 @@ It's ok if this is not implemented, and throws an error. #### `rcs_receive()` This is called when ikiwiki is running as a pre-receive hook (or -equivilant), and is testing if changes pushed into the RCS from an +equivalent), and is testing if changes pushed into the RCS from an untrusted user should be accepted. This is optional, and doesn't make sense to implement for all RCSs. -- cgit v1.2.3 From 0196e1f9fcfebbf904e59c029e494cb2186793e6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 24 Oct 2008 13:29:41 -0400 Subject: updates --- IkiWiki/Plugin/git.pm | 2 +- doc/plugins/pingee.mdwn | 2 +- doc/users/xma/discussion.mdwn | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'doc/plugins') diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index e565f6369..3a8476e7d 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -619,7 +619,7 @@ sub rcs_receive () { #{{{ # Avoid chdir when running git here, because the changes # are in the master git repo, not the srcdir repo. - # The pre-recieve hook already puts us in the right place. + # The pre-receive hook already puts us in the right place. $no_chdir=1; my @changes=git_commit_info($oldrev."..".$newrev); $no_chdir=0; diff --git a/doc/plugins/pingee.mdwn b/doc/plugins/pingee.mdwn index d012004f9..6156c235f 100644 --- a/doc/plugins/pingee.mdwn +++ b/doc/plugins/pingee.mdwn @@ -3,7 +3,7 @@ This plugin causes ikiwiki to listen for pings, typically delivered from another ikiwiki instance using the [[pinger]] plugin. When a ping is -recieved, ikiwiki will update the wiki, the same as if `ikiwiki --refresh` +received, ikiwiki will update the wiki, the same as if `ikiwiki --refresh` were ran at the command line. An url such as the following is used to trigger a ping: diff --git a/doc/users/xma/discussion.mdwn b/doc/users/xma/discussion.mdwn index c2bb62062..34adbf821 100644 --- a/doc/users/xma/discussion.mdwn +++ b/doc/users/xma/discussion.mdwn @@ -14,3 +14,5 @@ How do you edit this wiki (I mean [ikiwiki]) without the web browser ? Is there > for ikiwiki. --[[Joey]] > > I'll think about it. It may solve some of my offline-being issues. --[[intrigeri]] + +>>>> Now developed! --[[Joey]] -- cgit v1.2.3 From 1a883b3c504a543c8f4a5b5bb9687e7770f28a4f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 24 Oct 2008 13:44:03 -0400 Subject: include temp file for attachment change too --- IkiWiki/Plugin/git.pm | 23 +++++++++++++---------- IkiWiki/Receive.pm | 2 +- doc/plugins/write.mdwn | 4 ++-- 3 files changed, 16 insertions(+), 13 deletions(-) (limited to 'doc/plugins') diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index 3a8476e7d..84df56181 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -619,7 +619,7 @@ sub rcs_receive () { #{{{ # Avoid chdir when running git here, because the changes # are in the master git repo, not the srcdir repo. - # The pre-receive hook already puts us in the right place. + # The pre-recieve hook already puts us in the right place. $no_chdir=1; my @changes=git_commit_info($oldrev."..".$newrev); $no_chdir=0; @@ -643,15 +643,6 @@ sub rcs_receive () { #{{{ elsif ($detail->{'status'} =~ /^[AM]+\d*$/) { $action="add"; $mode=$detail->{'mode_to'}; - if (! pagetype($file)) { - eval q{use File::Temp}; - die $@ if $@; - my $fh; - ($fh, $path)=File::Temp::tempfile("XXXXXXXXXX", UNLINK => 1); - if (system("git show ".$detail->{sha1_to}." > '$path'") != 0) { - error("failed writing temp file"); - } - } } elsif ($detail->{'status'} =~ /^[DAM]+\d*/) { $action="remove"; @@ -670,6 +661,18 @@ sub rcs_receive () { #{{{ error gettext("you are not allowed to change file modes"); } } + + # extract attachment to temp file + if (($action eq 'add' || $action eq 'change') && + ! pagetype($file)) { + eval q{use File::Temp}; + die $@ if $@; + my $fh; + ($fh, $path)=File::Temp::tempfile("XXXXXXXXXX", UNLINK => 1); + if (system("git show ".$detail->{sha1_to}." > '$path'") != 0) { + error("failed writing temp file"); + } + } push @rets, { file => $file, diff --git a/IkiWiki/Receive.pm b/IkiWiki/Receive.pm index c69911a7c..9a672abc9 100644 --- a/IkiWiki/Receive.pm +++ b/IkiWiki/Receive.pm @@ -45,7 +45,7 @@ sub test () { #{{{ $file=IkiWiki::possibly_foolish_untaint($file); if (! defined $file || ! length $file || IkiWiki::file_pruned($file, $config{srcdir})) { - error(gettext("bad file name")); + error(gettext("bad file name %s"), $file); } my $type=pagetype($file); diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 5ee4acb53..abcabbdc3 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -837,8 +837,8 @@ files that were changed, in the form: file => # name of file that was changed action => # either "add", "change", or "remove" path => # temp file containing the new file content, only - # needed for "add", and only if the file is an - # attachment, not a page + # needed for "add"/"change", and only if the file + # is an attachment, not a page } The list will then be checked to make sure that each change is one that -- cgit v1.2.3 From 65bf71d387ba406d4fcf697d76151b6953176cf8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 26 Oct 2008 19:43:57 -0400 Subject: organizing and pulling together syntax highlighting info --- doc/plugins/contrib/sourcehighlight.mdwn | 5 ++ doc/todo/syntax_highlighting.mdwn | 54 ++++++++++++++++++++++ ...wiki-formatted_comments_with_syntax_plugin.mdwn | 5 +- 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 doc/todo/syntax_highlighting.mdwn (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/sourcehighlight.mdwn b/doc/plugins/contrib/sourcehighlight.mdwn index 2eb22e6ed..fb368945b 100644 --- a/doc/plugins/contrib/sourcehighlight.mdwn +++ b/doc/plugins/contrib/sourcehighlight.mdwn @@ -20,3 +20,8 @@ This problem with sourcehighlight needs to be fixed before it is very useful. - Is there a way to configure the colors used by source-highlight (other than editing the globally installed "default.style" file)? It would help if I could pass the command arbitrary command-line arguments; then I could configure which config file it's supposed to use. For instance, I'm not a fan of hard-coding the colors into the HTML output. IMHO, css-style formatting should be preferred. All that can be set via the command line ... --Peter > I don't really have time right now, but it should be easy to add, if you look at how src-lang is handled. Patches are welcome :-) --[[DavidBremner]] + +Note that [[Will]] wrote a plugin that uses source-highlight also. It's +available +[here|todo/automatic_use_of_syntax_plugin_on_source_code_files/discussion]]. +--[[Joey]] diff --git a/doc/todo/syntax_highlighting.mdwn b/doc/todo/syntax_highlighting.mdwn new file mode 100644 index 000000000..e992cc514 --- /dev/null +++ b/doc/todo/syntax_highlighting.mdwn @@ -0,0 +1,54 @@ +There's been a lot of work on contrib syntax highlighting plugins. One should be +picked and added to ikiwiki core. + +Ideally, it should support both converting whole source files into wiki +pages, as well as doing syntax highlighting as a preprocessor directive +(which is either passed the text, or reads it from a file). + +The big list of possibilities: + +* [[plugins/contrib/highlightcode]] uses [[cpan Syntax::Highlight::Engine::Kate]], + operates on whole source files only, has a few bugs (see + [here](http://u32.net/Highlight_Code_Plugin/), and needs to be updated to + support [[bugs/multiple_pages_with_same_name]]. +* [[cpan IkiWiki-Plugin-syntax]] only operates as a directive. + Interestingly, it supports multiple highlighting backends, including Kate + and Vim. +* [[plugins/contrib/syntax]] only operates as a directive + ([[not_on_source_code_files|automatic_use_of_syntax_plugin_on_source_code_files]]), + and uses [[cpan Text::VimColor]]. +* [[plugins/contrib/sourcehighlight]] uses src-highlight, and operates on + whole source files only. Needs to be updated to + support [[bugs/multiple_pages_with_same_name]]. +* [[sourcecode|todo/automatic_use_of_syntax_plugin_on_source_code_files/discussion]] + also uses src-highlight, and operates on whole source files. + Has problems with [[bugs/multiple_pages_with_same_name]]. + +General problems: + +* Using non-perl syntax highlighting backends is slow. I'd prefer either + using a perl module, or a multiple-backend solution that can use a perl + module as one option. +* Currently no single plugin supports both modes of operation (directive + and whole source file to page). +* Nothing seems to support + [[wiki-formatted_comments|wiki-formatted_comments_with_syntax_plugin]] + inside source files. Doing this probably means post-processing the + results of the highlighting engine, to find places where it's highlighted + comments, and then running them through the ikiwiki rendering pipeline. + This seems fairly doable with [[cpan Syntax::Highlight::Engine::Kate]], + at least. +* The whole-file plugins tend to have a problem that things that look like + wikilinks in the source code get munged into links by ikiwiki, which can + have confusing results. Similar problem with preprocessor directives. +* The whole-file plugins all get confused if there is a `foo.c` and a `foo.h`. + This is trivially fixable now by passing the keepextension option when + registering the htmlize hooks, though. +* Whole-file plugins register a bunch of htmlize hooks. The wacky thing + about it is that, when creating a new page, you can then pick "c" or + "h" or "pl" etc from the dropdown that normally has "mdwn" etc in it. + Is this a bug, or a feature? (Even if a feature, plugins with many + extensions make the dropdown unusable..) +* The per page highlighters can't handle "Makefile", or other files + without a significant extension. +* diff --git a/doc/todo/wiki-formatted_comments_with_syntax_plugin.mdwn b/doc/todo/wiki-formatted_comments_with_syntax_plugin.mdwn index 08ca61b0c..a5244c9ef 100644 --- a/doc/todo/wiki-formatted_comments_with_syntax_plugin.mdwn +++ b/doc/todo/wiki-formatted_comments_with_syntax_plugin.mdwn @@ -1 +1,4 @@ -[[Wishlist]] item: I'd love to see the ability to optionally switch back to wiki syntax within the comments of code pretty-printed with the [[plugins/contrib/syntax]] plugin. This would allow the use of links and formatting in comments. +[[Wishlist]] item: I'd love to see the ability to optionally switch back to +wiki syntax within the comments of code pretty-printed with the +[[plugins/contrib/syntax]] plugin. This would allow the use of links and +formatting in comments. -- cgit v1.2.3 From 3c487585765a9106ffe07698819858dfd4d38fd4 Mon Sep 17 00:00:00 2001 From: "https://yag.myopenid.com//" Date: Wed, 29 Oct 2008 15:09:56 -0400 Subject: Fixed broken link. --- ...fault_content_for___42__copyright__42___and___42__license__42__.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/plugins') 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 b4a7cd5d6..3efc68418 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 @@ -27,7 +27,7 @@ Somewhat more detailed usage documentation would be appreciated. I tried to setu those plugins with a current ikiwiki release, i.e. 2.61, but they appeared to do nothing, really. Also, those example pages don't seem to use those plugins, even; they set "copyright" and "license" properties using ordinary [[meta]] tags. Maybe -I'm missing something terribly obvious? --[[Peter]] +I'm missing something terribly obvious? --Peter > Only obvious if you read the source :-). You need to put a file named "copyright.html" >(respectively "license.html") in your wiki. Everything underneath that (in the wikilink sense) will use that >content for the license or copyright. Saves putting \[[meta license="foo"]] in every page [[DavidBremner]] -- cgit v1.2.3 From 3d72fd8f265703a46ab9bd5af268547eafea0292 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 29 Oct 2008 18:05:56 -0400 Subject: wording --- doc/plugins/rst.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/rst.mdwn b/doc/plugins/rst.mdwn index 9355597ac..5e97e2d80 100644 --- a/doc/plugins/rst.mdwn +++ b/doc/plugins/rst.mdwn @@ -11,7 +11,7 @@ ikiwiki. Limitations include: * There are issues with inserting raw html into documents, as ikiwiki does with [[WikiLinks|ikiwiki/WikiLink]] and many - preprocessor [[directives|ikiwiki/directive]]. + [[directives|ikiwiki/directive]]. So while you may find this useful for importing old files into your wiki, using this as your main markup language in ikiwiki isn't recommended at -- cgit v1.2.3 From 40b6033917be90377d3abc86b5fdd6479ae104fd Mon Sep 17 00:00:00 2001 From: "http://lollipopman.myopenid.com/" Date: Thu, 30 Oct 2008 08:28:28 -0400 Subject: --- doc/plugins/autoindex/discussion.mdwn | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 doc/plugins/autoindex/discussion.mdwn (limited to 'doc/plugins') diff --git a/doc/plugins/autoindex/discussion.mdwn b/doc/plugins/autoindex/discussion.mdwn new file mode 100644 index 000000000..82e30aab1 --- /dev/null +++ b/doc/plugins/autoindex/discussion.mdwn @@ -0,0 +1,7 @@ +Would it be possible to add an option to only generate the index files +for the html output and not place the markdown files in the wiki source? + +The reason being that I have a lot of directories which need to be autoindexed, +but I would prefer if the index files didn't clutter up my git repository. + +even without that feature the plugin is a great help, thanks -- cgit v1.2.3 From 547d296924b27b196fdc0d7c3c88e19ad1a4755f Mon Sep 17 00:00:00 2001 From: jwalzer Date: Thu, 30 Oct 2008 12:22:51 -0400 Subject: opml-Plugin - Stub-Page --- doc/plugins/contrib/opml.mdwn | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 doc/plugins/contrib/opml.mdwn (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/opml.mdwn b/doc/plugins/contrib/opml.mdwn new file mode 100644 index 000000000..3f98e8065 --- /dev/null +++ b/doc/plugins/contrib/opml.mdwn @@ -0,0 +1,11 @@ +[[!template id=plugin name=opml author="[[JanWalzer|jwalzer]]"]] +[[!tag type/format]] + +The idea of this plugin is to parse in an OPML-File and output a linklist, maybe some customization. +OPML-Files are xml-files that most RSS-Readers write out, to summarize their subscribes feedlist. + +I have a "dumb" perlscript running on my website, that tries to do a opml2mdwn transformation, but its quite bad on that. + +This Plugin is **NOT Ready** in any way. I'm just putting this page up as a hook, to discuss it. + +I intend to work on this, but I'd appreciate any help on this. -- cgit v1.2.3 From 8f5723e1d572664ecac4d0aeed079ab3365719cc Mon Sep 17 00:00:00 2001 From: jwalzer Date: Thu, 30 Oct 2008 12:27:09 -0400 Subject: start discussion of the plugin --- doc/plugins/contrib/opml/discussion.mdwn | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 doc/plugins/contrib/opml/discussion.mdwn (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/opml/discussion.mdwn b/doc/plugins/contrib/opml/discussion.mdwn new file mode 100644 index 000000000..3a145c79a --- /dev/null +++ b/doc/plugins/contrib/opml/discussion.mdwn @@ -0,0 +1,4 @@ +If this is the wrong place for the development of the plugin, please mode it on to a more appropriate one. + +Currently I'm quite stuck with the perl-stuff itself. I'm trying to become comfortable with the language, but it seems, the language doesn't like me. I'm lost in complex datastructures, when trying to iterate through the output of XML::Simple. --[[Jan|jwalzer]] + -- cgit v1.2.3 From bb841f94f47d865e4c78bd4f27c5f9cc04dc1557 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 31 Oct 2008 16:42:20 -0400 Subject: format: New plugin, allows embedding differntly formatted text inside a page (ie, otl inside a mdwn page, or syntax highlighted code inside a page). --- IkiWiki/Plugin/format.pm | 29 +++++++++++++++++++++++++++++ debian/changelog | 3 +++ doc/ikiwiki/directive/format.mdwn | 21 +++++++++++++++++++++ doc/plugins/format.mdwn | 9 +++++++++ doc/todo/syntax_highlighting.mdwn | 4 ++-- po/bg.po | 29 +++++++++++++++++++---------- po/cs.po | 29 +++++++++++++++++++---------- po/da.po | 29 +++++++++++++++++++---------- po/de.po | 29 +++++++++++++++++++---------- po/es.po | 29 +++++++++++++++++++---------- po/fr.po | 29 +++++++++++++++++++---------- po/gu.po | 29 +++++++++++++++++++---------- po/ikiwiki.pot | 13 +++++++++++-- po/pl.po | 29 +++++++++++++++++++---------- po/sv.po | 29 +++++++++++++++++++---------- po/vi.po | 29 +++++++++++++++++++---------- 16 files changed, 265 insertions(+), 104 deletions(-) create mode 100644 IkiWiki/Plugin/format.pm create mode 100644 doc/ikiwiki/directive/format.mdwn create mode 100644 doc/plugins/format.mdwn (limited to 'doc/plugins') diff --git a/IkiWiki/Plugin/format.pm b/IkiWiki/Plugin/format.pm new file mode 100644 index 000000000..a219190e8 --- /dev/null +++ b/IkiWiki/Plugin/format.pm @@ -0,0 +1,29 @@ +#!/usr/bin/perl +package IkiWiki::Plugin::format; + +use warnings; +use strict; +use IkiWiki 2.00; + +sub import { #{{{ + hook(type => "preprocess", id => "format", call => \&preprocess); +} #}}} + +sub preprocess (@) { #{{{ + my $format=$_[0]; + shift; shift; + my $text=$_[0]; + shift; shift; + my %params=@_; + + if (! defined $format || ! defined $text) { + error(gettext("must specify format and text")); + } + elsif (! exists $IkiWiki::hooks{htmlize}{$format}) { + error(sprintf(gettext("unsupported page format %s"), $format)); + } + + return IkiWiki::htmlize($params{page}, $params{destpage}, $format, $text); +} #}}} + +1 diff --git a/debian/changelog b/debian/changelog index 0c3fded41..ca0433d10 100644 --- a/debian/changelog +++ b/debian/changelog @@ -39,6 +39,9 @@ ikiwiki (2.68) UNRELEASED; urgency=low * shortcut: Fix display of shortcuts while previewing. * Preserve syslog setting when doing `ikiwiki -setup foo -dumpsetup bar` * Several fixes to --render mode. + * format: New plugin, allows embedding differntly formatted text inside a + page (ie, otl inside a mdwn page, or syntax highlighted code inside a + page). -- Joey Hess Fri, 17 Oct 2008 20:11:02 -0400 diff --git a/doc/ikiwiki/directive/format.mdwn b/doc/ikiwiki/directive/format.mdwn new file mode 100644 index 000000000..94cf1b04f --- /dev/null +++ b/doc/ikiwiki/directive/format.mdwn @@ -0,0 +1,21 @@ +The `format` directive is supplied by the [[!iki plugins/format desc=format]] +plugin. + +The directive allows formatting a chunk of text using any available page +format. It takes two parameters. First is the type of format to use, +ie the extension that would be used for a standalone file of this type. +Second is the text to format. + +For example, this will embed an otl outline inside a page using mdwn or +some other format: + + \[[!format otl """ + foo + 1 + 2 + bar + 3 + 4 + """]] + +[[!meta robots="noindex, follow"]] diff --git a/doc/plugins/format.mdwn b/doc/plugins/format.mdwn new file mode 100644 index 000000000..91e707fcf --- /dev/null +++ b/doc/plugins/format.mdwn @@ -0,0 +1,9 @@ +[[!template id=plugin name=format core=0 author="[[Joey]]"]] +[[!tag type/format]] + +This plugin allows mixing different page formats together, by embedding +text formatted one way inside a page formatted another way. This is done +using the [[ikiwiki/directive/format]] [[ikiwiki/directive]]. + +For example, it could be used to embed an [[otl]] outline inside a page +that is formatted as [[mdwn]]. diff --git a/doc/todo/syntax_highlighting.mdwn b/doc/todo/syntax_highlighting.mdwn index 43878437f..bb1c84f02 100644 --- a/doc/todo/syntax_highlighting.mdwn +++ b/doc/todo/syntax_highlighting.mdwn @@ -73,8 +73,8 @@ That would run the text through the pl htmlizer, from the syntax hightligh plugin. OTOH, if "rst" were given, it would run the text through the rst htmlizer. So, more generic, allows mixing different types of markup on one page, as well as syntax highlighting. Does require specifying the type of -format, instead of allows it to be guessed (which some syntax highlighters -can do). +format, instead of allowing it to be guessed (which some syntax highlighters +can do). (This directive is now implemented..) Hmm, this would also allow comments inside source files to have mdwn embedded in them, without making the use of mdwn a special case, or needing diff --git a/po/bg.po b/po/bg.po index 471e03119..19b0fff50 100644 --- a/po/bg.po +++ b/po/bg.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ikiwiki-bg\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-10-26 15:03-0400\n" +"POT-Creation-Date: 2008-10-31 16:37-0400\n" "PO-Revision-Date: 2007-01-12 01:19+0200\n" "Last-Translator: Damyan Ivanov \n" "Language-Team: Bulgarian \n" @@ -131,7 +131,7 @@ msgstr "създаване на нова страницa „%s”" msgid "deleting bucket.." msgstr "" -#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:205 +#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:206 msgid "done" msgstr "готово" @@ -253,22 +253,31 @@ msgstr "" msgid "failed to process" msgstr "грешка при обработване на шаблона" +#: ../IkiWiki/Plugin/format.pm:22 +msgid "must specify format and text" +msgstr "" + +#: ../IkiWiki/Plugin/format.pm:25 +#, perl-format +msgid "unsupported page format %s" +msgstr "" + #: ../IkiWiki/Plugin/fortune.pm:27 msgid "fortune failed" msgstr "грешшка в приставката „fortune”" -#: ../IkiWiki/Plugin/git.pm:617 ../IkiWiki/Plugin/git.pm:635 +#: ../IkiWiki/Plugin/git.pm:618 ../IkiWiki/Plugin/git.pm:636 #: ../IkiWiki/Receive.pm:129 #, perl-format msgid "you are not allowed to change %s" msgstr "" -#: ../IkiWiki/Plugin/git.pm:657 +#: ../IkiWiki/Plugin/git.pm:658 #, perl-format msgid "you cannot act on a file with mode %s" msgstr "" -#: ../IkiWiki/Plugin/git.pm:661 +#: ../IkiWiki/Plugin/git.pm:662 msgid "you are not allowed to change file modes" msgstr "" @@ -686,11 +695,11 @@ msgstr "" msgid "search" msgstr "" -#: ../IkiWiki/Plugin/shortcut.pm:27 +#: ../IkiWiki/Plugin/shortcut.pm:28 msgid "shortcut plugin will not work without a shortcuts.mdwn" msgstr "" -#: ../IkiWiki/Plugin/shortcut.pm:36 +#: ../IkiWiki/Plugin/shortcut.pm:38 #, fuzzy msgid "missing name or url parameter" msgstr "препратката няма указани параметрите „name” или „url”" @@ -698,7 +707,7 @@ msgstr "препратката няма указани параметрите #. translators: This is used to display what shortcuts are defined. #. translators: First parameter is the name of the shortcut, the second #. translators: is an URL. -#: ../IkiWiki/Plugin/shortcut.pm:45 +#: ../IkiWiki/Plugin/shortcut.pm:48 #, fuzzy, perl-format msgid "shortcut %s points to %s" msgstr "препратката „%s” сочи към „%s”" @@ -970,11 +979,11 @@ msgstr "" msgid "generating wrappers.." msgstr "генериране на обвивки..." -#: ../ikiwiki.in:194 +#: ../ikiwiki.in:195 msgid "rebuilding wiki.." msgstr "обновяване на уики..." -#: ../ikiwiki.in:197 +#: ../ikiwiki.in:198 msgid "refreshing wiki.." msgstr "осъвременяване на уики..." diff --git a/po/cs.po b/po/cs.po index ece992c47..6cbb0c596 100644 --- a/po/cs.po +++ b/po/cs.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ikiwiki\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-10-26 15:03-0400\n" +"POT-Creation-Date: 2008-10-31 16:37-0400\n" "PO-Revision-Date: 2007-05-09 21:21+0200\n" "Last-Translator: Miroslav Kure \n" "Language-Team: Czech \n" @@ -128,7 +128,7 @@ msgstr "vytvářím novou stránku %s" msgid "deleting bucket.." msgstr "" -#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:205 +#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:206 msgid "done" msgstr "hotovo" @@ -250,22 +250,31 @@ msgstr "" msgid "failed to process" msgstr "nepodařilo se zpracovat:" +#: ../IkiWiki/Plugin/format.pm:22 +msgid "must specify format and text" +msgstr "" + +#: ../IkiWiki/Plugin/format.pm:25 +#, perl-format +msgid "unsupported page format %s" +msgstr "" + #: ../IkiWiki/Plugin/fortune.pm:27 msgid "fortune failed" msgstr "fortune selhal" -#: ../IkiWiki/Plugin/git.pm:617 ../IkiWiki/Plugin/git.pm:635 +#: ../IkiWiki/Plugin/git.pm:618 ../IkiWiki/Plugin/git.pm:636 #: ../IkiWiki/Receive.pm:129 #, perl-format msgid "you are not allowed to change %s" msgstr "" -#: ../IkiWiki/Plugin/git.pm:657 +#: ../IkiWiki/Plugin/git.pm:658 #, perl-format msgid "you cannot act on a file with mode %s" msgstr "" -#: ../IkiWiki/Plugin/git.pm:661 +#: ../IkiWiki/Plugin/git.pm:662 msgid "you are not allowed to change file modes" msgstr "" @@ -674,18 +683,18 @@ msgstr "" msgid "search" msgstr "" -#: ../IkiWiki/Plugin/shortcut.pm:27 +#: ../IkiWiki/Plugin/shortcut.pm:28 msgid "shortcut plugin will not work without a shortcuts.mdwn" msgstr "" -#: ../IkiWiki/Plugin/shortcut.pm:36 +#: ../IkiWiki/Plugin/shortcut.pm:38 msgid "missing name or url parameter" msgstr "chybí parametr jméno nebo url" #. translators: This is used to display what shortcuts are defined. #. translators: First parameter is the name of the shortcut, the second #. translators: is an URL. -#: ../IkiWiki/Plugin/shortcut.pm:45 +#: ../IkiWiki/Plugin/shortcut.pm:48 #, perl-format msgid "shortcut %s points to %s" msgstr "zkratka %s odkazuje na %s" @@ -951,11 +960,11 @@ msgstr "" msgid "generating wrappers.." msgstr "generuji obaly..." -#: ../ikiwiki.in:194 +#: ../ikiwiki.in:195 msgid "rebuilding wiki.." msgstr "znovu vytvářím wiki..." -#: ../ikiwiki.in:197 +#: ../ikiwiki.in:198 msgid "refreshing wiki.." msgstr "obnovuji wiki..." diff --git a/po/da.po b/po/da.po index 3d0deca8a..6c3ed3e53 100644 --- a/po/da.po +++ b/po/da.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ikiwiki\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-10-26 15:03-0400\n" +"POT-Creation-Date: 2008-10-31 16:37-0400\n" "PO-Revision-Date: 2008-10-22 19:13+0100\n" "Last-Translator: Jonas Smedegaard \n" "Language-Team: None\n" @@ -132,7 +132,7 @@ msgstr "opretter ny side %s" msgid "deleting bucket.." msgstr "sletter bundt.." -#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:205 +#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:206 msgid "done" msgstr "færdig" @@ -250,22 +250,31 @@ msgstr "redigeringsskabelon %s registreret for %s" msgid "failed to process" msgstr "dannelsen mislykkedes" +#: ../IkiWiki/Plugin/format.pm:22 +msgid "must specify format and text" +msgstr "" + +#: ../IkiWiki/Plugin/format.pm:25 +#, fuzzy, perl-format +msgid "unsupported page format %s" +msgstr "revisionskontrolsystem %s ikke understøttet" + #: ../IkiWiki/Plugin/fortune.pm:27 msgid "fortune failed" msgstr "spådom (fortune) fejlede" -#: ../IkiWiki/Plugin/git.pm:617 ../IkiWiki/Plugin/git.pm:635 +#: ../IkiWiki/Plugin/git.pm:618 ../IkiWiki/Plugin/git.pm:636 #: ../IkiWiki/Receive.pm:129 #, fuzzy, perl-format msgid "you are not allowed to change %s" msgstr "du er ikke logget på som en administrator" -#: ../IkiWiki/Plugin/git.pm:657 +#: ../IkiWiki/Plugin/git.pm:658 #, perl-format msgid "you cannot act on a file with mode %s" msgstr "" -#: ../IkiWiki/Plugin/git.pm:661 +#: ../IkiWiki/Plugin/git.pm:662 #, fuzzy msgid "you are not allowed to change file modes" msgstr "du er ikke logget på som en administrator" @@ -669,18 +678,18 @@ msgstr "behøver Digest::SHA1 til indeks %s" msgid "search" msgstr "søg" -#: ../IkiWiki/Plugin/shortcut.pm:27 +#: ../IkiWiki/Plugin/shortcut.pm:28 msgid "shortcut plugin will not work without a shortcuts.mdwn" msgstr "genvejsudvidelsen vil ikke fungere uden en shortcuts.mdwn" -#: ../IkiWiki/Plugin/shortcut.pm:36 +#: ../IkiWiki/Plugin/shortcut.pm:38 msgid "missing name or url parameter" msgstr "manglende navn eller url parameter" #. translators: This is used to display what shortcuts are defined. #. translators: First parameter is the name of the shortcut, the second #. translators: is an URL. -#: ../IkiWiki/Plugin/shortcut.pm:45 +#: ../IkiWiki/Plugin/shortcut.pm:48 #, perl-format msgid "shortcut %s points to %s" msgstr "genvej %s viser til %s" @@ -949,11 +958,11 @@ msgstr "brug: --set var=værdi" msgid "generating wrappers.." msgstr "bygger wrappers.." -#: ../ikiwiki.in:194 +#: ../ikiwiki.in:195 msgid "rebuilding wiki.." msgstr "genopbygger wiki..." -#: ../ikiwiki.in:197 +#: ../ikiwiki.in:198 msgid "refreshing wiki.." msgstr "genopfrisker wiki..." diff --git a/po/de.po b/po/de.po index bef54ad89..022fbfef1 100644 --- a/po/de.po +++ b/po/de.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ikiwiki 2.40\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-10-26 15:03-0400\n" +"POT-Creation-Date: 2008-10-31 16:37-0400\n" "PO-Revision-Date: 2008-03-03 21:22+0100\n" "Last-Translator: Kai Wasserbäch \n" "Language-Team: German \n" @@ -128,7 +128,7 @@ msgstr "erstelle neue Seite %s" msgid "deleting bucket.." msgstr "" -#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:205 +#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:206 msgid "done" msgstr "fertig" @@ -247,22 +247,31 @@ msgstr "»edittemplate« %s registriert für %s" msgid "failed to process" msgstr "Bearbeitung fehlgeschlagen" +#: ../IkiWiki/Plugin/format.pm:22 +msgid "must specify format and text" +msgstr "" + +#: ../IkiWiki/Plugin/format.pm:25 +#, perl-format +msgid "unsupported page format %s" +msgstr "" + #: ../IkiWiki/Plugin/fortune.pm:27 msgid "fortune failed" msgstr "»fortune« fehlgeschlagen" -#: ../IkiWiki/Plugin/git.pm:617 ../IkiWiki/Plugin/git.pm:635 +#: ../IkiWiki/Plugin/git.pm:618 ../IkiWiki/Plugin/git.pm:636 #: ../IkiWiki/Receive.pm:129 #, perl-format msgid "you are not allowed to change %s" msgstr "" -#: ../IkiWiki/Plugin/git.pm:657 +#: ../IkiWiki/Plugin/git.pm:658 #, perl-format msgid "you cannot act on a file with mode %s" msgstr "" -#: ../IkiWiki/Plugin/git.pm:661 +#: ../IkiWiki/Plugin/git.pm:662 msgid "you are not allowed to change file modes" msgstr "" @@ -671,18 +680,18 @@ msgstr "" msgid "search" msgstr "" -#: ../IkiWiki/Plugin/shortcut.pm:27 +#: ../IkiWiki/Plugin/shortcut.pm:28 msgid "shortcut plugin will not work without a shortcuts.mdwn" msgstr "das »shortcut«-Plugin funktioniert nicht ohne eine »shortcuts.mdwn«" -#: ../IkiWiki/Plugin/shortcut.pm:36 +#: ../IkiWiki/Plugin/shortcut.pm:38 msgid "missing name or url parameter" msgstr "fehlender Name oder URL-Parameter" #. translators: This is used to display what shortcuts are defined. #. translators: First parameter is the name of the shortcut, the second #. translators: is an URL. -#: ../IkiWiki/Plugin/shortcut.pm:45 +#: ../IkiWiki/Plugin/shortcut.pm:48 #, perl-format msgid "shortcut %s points to %s" msgstr "Shortcut %s zeigt auf %s" @@ -946,11 +955,11 @@ msgstr "Benutzung: --set Variable=Wert" msgid "generating wrappers.." msgstr "erzeuge Wrapper.." -#: ../ikiwiki.in:194 +#: ../ikiwiki.in:195 msgid "rebuilding wiki.." msgstr "erzeuge Wiki neu.." -#: ../ikiwiki.in:197 +#: ../ikiwiki.in:198 msgid "refreshing wiki.." msgstr "aktualisiere Wiki.." diff --git a/po/es.po b/po/es.po index 7afb45c14..8dce2940f 100644 --- a/po/es.po +++ b/po/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: es\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-10-26 15:03-0400\n" +"POT-Creation-Date: 2008-10-31 16:37-0400\n" "PO-Revision-Date: 2008-10-22 13:54+0200\n" "Last-Translator: Víctor Moral \n" "Language-Team: Spanish \n" @@ -130,7 +130,7 @@ msgstr "creando nueva página %s" msgid "deleting bucket.." msgstr "borrando el directorio.." -#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:205 +#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:206 msgid "done" msgstr "completado" @@ -248,22 +248,31 @@ msgstr "plantilla de edición %s registrada para %s" msgid "failed to process" msgstr "fallo en el proceso" +#: ../IkiWiki/Plugin/format.pm:22 +msgid "must specify format and text" +msgstr "" + +#: ../IkiWiki/Plugin/format.pm:25 +#, fuzzy, perl-format +msgid "unsupported page format %s" +msgstr "el sistema de control de versiones %s no está soportado" + #: ../IkiWiki/Plugin/fortune.pm:27 msgid "fortune failed" msgstr "el programa fortune ha fallado" -#: ../IkiWiki/Plugin/git.pm:617 ../IkiWiki/Plugin/git.pm:635 +#: ../IkiWiki/Plugin/git.pm:618 ../IkiWiki/Plugin/git.pm:636 #: ../IkiWiki/Receive.pm:129 #, fuzzy, perl-format msgid "you are not allowed to change %s" msgstr "No está registrado como un administrador" -#: ../IkiWiki/Plugin/git.pm:657 +#: ../IkiWiki/Plugin/git.pm:658 #, perl-format msgid "you cannot act on a file with mode %s" msgstr "" -#: ../IkiWiki/Plugin/git.pm:661 +#: ../IkiWiki/Plugin/git.pm:662 #, fuzzy msgid "you are not allowed to change file modes" msgstr "No está registrado como un administrador" @@ -676,18 +685,18 @@ msgstr "se necesita la instalación de Digest::SHA1 para indexar %s" msgid "search" msgstr "buscar" -#: ../IkiWiki/Plugin/shortcut.pm:27 +#: ../IkiWiki/Plugin/shortcut.pm:28 msgid "shortcut plugin will not work without a shortcuts.mdwn" msgstr "el complemento shortcut no funciona sin una página shortcuts.mdwn" -#: ../IkiWiki/Plugin/shortcut.pm:36 +#: ../IkiWiki/Plugin/shortcut.pm:38 msgid "missing name or url parameter" msgstr "shortcut necesita el parámetro 'name' ó el parámetro 'url'" #. translators: This is used to display what shortcuts are defined. #. translators: First parameter is the name of the shortcut, the second #. translators: is an URL. -#: ../IkiWiki/Plugin/shortcut.pm:45 +#: ../IkiWiki/Plugin/shortcut.pm:48 #, perl-format msgid "shortcut %s points to %s" msgstr "El atajo %s apunta a %s" @@ -959,11 +968,11 @@ msgstr "uso: --set variable=valor" msgid "generating wrappers.." msgstr "generando programas auxiliares.." -#: ../ikiwiki.in:194 +#: ../ikiwiki.in:195 msgid "rebuilding wiki.." msgstr "reconstruyendo el wiki.." -#: ../ikiwiki.in:197 +#: ../ikiwiki.in:198 msgid "refreshing wiki.." msgstr "actualizando el wiki.." diff --git a/po/fr.po b/po/fr.po index c0c96c476..53095c5e1 100644 --- a/po/fr.po +++ b/po/fr.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-10-26 15:03-0400\n" +"POT-Creation-Date: 2008-10-31 16:37-0400\n" "PO-Revision-Date: 2008-10-11 10:34+0200\n" "Last-Translator: Julien Patriarca \n" "Language-Team: French \n" @@ -133,7 +133,7 @@ msgstr "Création de la nouvelle page %s" msgid "deleting bucket.." msgstr "suppression du compartiment (« bucket »)..." -#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:205 +#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:206 msgid "done" msgstr "Terminé" @@ -255,22 +255,31 @@ msgstr "edittemplate %s enregistré pour %s" msgid "failed to process" msgstr "Échec du traitement" +#: ../IkiWiki/Plugin/format.pm:22 +msgid "must specify format and text" +msgstr "" + +#: ../IkiWiki/Plugin/format.pm:25 +#, fuzzy, perl-format +msgid "unsupported page format %s" +msgstr "Système de contrôle de version non reconnu" + #: ../IkiWiki/Plugin/fortune.pm:27 msgid "fortune failed" msgstr "Échec du lancement de « fortune »" -#: ../IkiWiki/Plugin/git.pm:617 ../IkiWiki/Plugin/git.pm:635 +#: ../IkiWiki/Plugin/git.pm:618 ../IkiWiki/Plugin/git.pm:636 #: ../IkiWiki/Receive.pm:129 #, fuzzy, perl-format msgid "you are not allowed to change %s" msgstr "vous n'êtes pas authentifié comme administrateur" -#: ../IkiWiki/Plugin/git.pm:657 +#: ../IkiWiki/Plugin/git.pm:658 #, perl-format msgid "you cannot act on a file with mode %s" msgstr "" -#: ../IkiWiki/Plugin/git.pm:661 +#: ../IkiWiki/Plugin/git.pm:662 #, fuzzy msgid "you are not allowed to change file modes" msgstr "vous n'êtes pas authentifié comme administrateur" @@ -683,18 +692,18 @@ msgstr "Digest::SHA1 est nécessaire pour indexer %s" msgid "search" msgstr "recherche" -#: ../IkiWiki/Plugin/shortcut.pm:27 +#: ../IkiWiki/Plugin/shortcut.pm:28 msgid "shortcut plugin will not work without a shortcuts.mdwn" msgstr "Le greffon « shortcut » ne fonctionnera pas sans shortcuts.mdwn" -#: ../IkiWiki/Plugin/shortcut.pm:36 +#: ../IkiWiki/Plugin/shortcut.pm:38 msgid "missing name or url parameter" msgstr "Il manque le paramètre nom ou URL." #. translators: This is used to display what shortcuts are defined. #. translators: First parameter is the name of the shortcut, the second #. translators: is an URL. -#: ../IkiWiki/Plugin/shortcut.pm:45 +#: ../IkiWiki/Plugin/shortcut.pm:48 #, perl-format msgid "shortcut %s points to %s" msgstr "Le raccourci %s pointe vers %s" @@ -967,11 +976,11 @@ msgstr "Syntaxe : -- set var=valeur" msgid "generating wrappers.." msgstr "Création des fichiers CGI..." -#: ../ikiwiki.in:194 +#: ../ikiwiki.in:195 msgid "rebuilding wiki.." msgstr "Reconstruction du wiki..." -#: ../ikiwiki.in:197 +#: ../ikiwiki.in:198 msgid "refreshing wiki.." msgstr "Rafraîchissement du wiki..." diff --git a/po/gu.po b/po/gu.po index c48985eb5..13c68afc9 100644 --- a/po/gu.po +++ b/po/gu.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ikiwiki-gu\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-10-26 15:03-0400\n" +"POT-Creation-Date: 2008-10-31 16:37-0400\n" "PO-Revision-Date: 2007-01-11 16:05+0530\n" "Last-Translator: Kartik Mistry \n" "Language-Team: Gujarati \n" @@ -129,7 +129,7 @@ msgstr "નવું પાનું %s બનાવે છે" msgid "deleting bucket.." msgstr "" -#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:205 +#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:206 msgid "done" msgstr "સંપૂર્ણ" @@ -251,22 +251,31 @@ msgstr "" msgid "failed to process" msgstr "ક્રિયા કરવામાં નિષ્ફળ:" +#: ../IkiWiki/Plugin/format.pm:22 +msgid "must specify format and text" +msgstr "" + +#: ../IkiWiki/Plugin/format.pm:25 +#, perl-format +msgid "unsupported page format %s" +msgstr "" + #: ../IkiWiki/Plugin/fortune.pm:27 msgid "fortune failed" msgstr "ભવિષ્ય નિષ્ફળ" -#: ../IkiWiki/Plugin/git.pm:617 ../IkiWiki/Plugin/git.pm:635 +#: ../IkiWiki/Plugin/git.pm:618 ../IkiWiki/Plugin/git.pm:636 #: ../IkiWiki/Receive.pm:129 #, perl-format msgid "you are not allowed to change %s" msgstr "" -#: ../IkiWiki/Plugin/git.pm:657 +#: ../IkiWiki/Plugin/git.pm:658 #, perl-format msgid "you cannot act on a file with mode %s" msgstr "" -#: ../IkiWiki/Plugin/git.pm:661 +#: ../IkiWiki/Plugin/git.pm:662 msgid "you are not allowed to change file modes" msgstr "" @@ -675,18 +684,18 @@ msgstr "" msgid "search" msgstr "" -#: ../IkiWiki/Plugin/shortcut.pm:27 +#: ../IkiWiki/Plugin/shortcut.pm:28 msgid "shortcut plugin will not work without a shortcuts.mdwn" msgstr "" -#: ../IkiWiki/Plugin/shortcut.pm:36 +#: ../IkiWiki/Plugin/shortcut.pm:38 msgid "missing name or url parameter" msgstr "ખોવાયેલ નામ અથવા યુઆરએલ વિકલ્પ" #. translators: This is used to display what shortcuts are defined. #. translators: First parameter is the name of the shortcut, the second #. translators: is an URL. -#: ../IkiWiki/Plugin/shortcut.pm:45 +#: ../IkiWiki/Plugin/shortcut.pm:48 #, perl-format msgid "shortcut %s points to %s" msgstr "ટુંકોરસ્તો %s એ %s નો નિર્દેશ કરે છે" @@ -951,11 +960,11 @@ msgstr "" msgid "generating wrappers.." msgstr "આવરણ બનાવે છે.." -#: ../ikiwiki.in:194 +#: ../ikiwiki.in:195 msgid "rebuilding wiki.." msgstr "વીકી ફરીથી બનાવે છે.." -#: ../ikiwiki.in:197 +#: ../ikiwiki.in:198 msgid "refreshing wiki.." msgstr "વીકીને તાજી કરે છે.." diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot index ab28f956c..f3eb0eb55 100644 --- a/po/ikiwiki.pot +++ b/po/ikiwiki.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-10-29 17:42-0400\n" +"POT-Creation-Date: 2008-10-31 16:38-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -246,6 +246,15 @@ msgstr "" msgid "failed to process" msgstr "" +#: ../IkiWiki/Plugin/format.pm:22 +msgid "must specify format and text" +msgstr "" + +#: ../IkiWiki/Plugin/format.pm:25 +#, perl-format +msgid "unsupported page format %s" +msgstr "" + #: ../IkiWiki/Plugin/fortune.pm:27 msgid "fortune failed" msgstr "" @@ -671,7 +680,7 @@ msgstr "" #. translators: This is used to display what shortcuts are defined. #. translators: First parameter is the name of the shortcut, the second #. translators: is an URL. -#: ../IkiWiki/Plugin/shortcut.pm:47 +#: ../IkiWiki/Plugin/shortcut.pm:48 #, perl-format msgid "shortcut %s points to %s" msgstr "" diff --git a/po/pl.po b/po/pl.po index 6f262a2be..6f582c71f 100644 --- a/po/pl.po +++ b/po/pl.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ikiwiki 1.51\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-10-26 15:03-0400\n" +"POT-Creation-Date: 2008-10-31 16:37-0400\n" "PO-Revision-Date: 2007-04-27 22:05+0200\n" "Last-Translator: Pawel Tecza \n" "Language-Team: Debian L10n Polish \n" @@ -133,7 +133,7 @@ msgstr "tworzenie nowej strony %s" msgid "deleting bucket.." msgstr "" -#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:205 +#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:206 msgid "done" msgstr "gotowe" @@ -255,22 +255,31 @@ msgstr "" msgid "failed to process" msgstr "awaria w trakcie przetwarzania:" +#: ../IkiWiki/Plugin/format.pm:22 +msgid "must specify format and text" +msgstr "" + +#: ../IkiWiki/Plugin/format.pm:25 +#, perl-format +msgid "unsupported page format %s" +msgstr "" + #: ../IkiWiki/Plugin/fortune.pm:27 msgid "fortune failed" msgstr "awaria fortunki" -#: ../IkiWiki/Plugin/git.pm:617 ../IkiWiki/Plugin/git.pm:635 +#: ../IkiWiki/Plugin/git.pm:618 ../IkiWiki/Plugin/git.pm:636 #: ../IkiWiki/Receive.pm:129 #, perl-format msgid "you are not allowed to change %s" msgstr "" -#: ../IkiWiki/Plugin/git.pm:657 +#: ../IkiWiki/Plugin/git.pm:658 #, perl-format msgid "you cannot act on a file with mode %s" msgstr "" -#: ../IkiWiki/Plugin/git.pm:661 +#: ../IkiWiki/Plugin/git.pm:662 msgid "you are not allowed to change file modes" msgstr "" @@ -691,11 +700,11 @@ msgstr "" msgid "search" msgstr "" -#: ../IkiWiki/Plugin/shortcut.pm:27 +#: ../IkiWiki/Plugin/shortcut.pm:28 msgid "shortcut plugin will not work without a shortcuts.mdwn" msgstr "" -#: ../IkiWiki/Plugin/shortcut.pm:36 +#: ../IkiWiki/Plugin/shortcut.pm:38 #, fuzzy msgid "missing name or url parameter" msgstr "brakujący parametr name lub url" @@ -703,7 +712,7 @@ msgstr "brakujący parametr name lub url" #. translators: This is used to display what shortcuts are defined. #. translators: First parameter is the name of the shortcut, the second #. translators: is an URL. -#: ../IkiWiki/Plugin/shortcut.pm:45 +#: ../IkiWiki/Plugin/shortcut.pm:48 #, fuzzy, perl-format msgid "shortcut %s points to %s" msgstr "skrót %s wskazuje na adres %s" @@ -976,11 +985,11 @@ msgstr "" msgid "generating wrappers.." msgstr "tworzenie osłon..." -#: ../ikiwiki.in:194 +#: ../ikiwiki.in:195 msgid "rebuilding wiki.." msgstr "przebudowywanie wiki..." -#: ../ikiwiki.in:197 +#: ../ikiwiki.in:198 msgid "refreshing wiki.." msgstr "odświeżanie wiki..." diff --git a/po/sv.po b/po/sv.po index cc83869cf..6d3e263ee 100644 --- a/po/sv.po +++ b/po/sv.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ikiwiki\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-10-26 15:03-0400\n" +"POT-Creation-Date: 2008-10-31 16:37-0400\n" "PO-Revision-Date: 2007-01-10 23:47+0100\n" "Last-Translator: Daniel Nylander \n" "Language-Team: Swedish \n" @@ -130,7 +130,7 @@ msgstr "skapar nya sidan %s" msgid "deleting bucket.." msgstr "" -#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:205 +#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:206 msgid "done" msgstr "klar" @@ -252,22 +252,31 @@ msgstr "" msgid "failed to process" msgstr "misslyckades med att behandla mall:" +#: ../IkiWiki/Plugin/format.pm:22 +msgid "must specify format and text" +msgstr "" + +#: ../IkiWiki/Plugin/format.pm:25 +#, perl-format +msgid "unsupported page format %s" +msgstr "" + #: ../IkiWiki/Plugin/fortune.pm:27 msgid "fortune failed" msgstr "fortune misslyckades" -#: ../IkiWiki/Plugin/git.pm:617 ../IkiWiki/Plugin/git.pm:635 +#: ../IkiWiki/Plugin/git.pm:618 ../IkiWiki/Plugin/git.pm:636 #: ../IkiWiki/Receive.pm:129 #, perl-format msgid "you are not allowed to change %s" msgstr "" -#: ../IkiWiki/Plugin/git.pm:657 +#: ../IkiWiki/Plugin/git.pm:658 #, perl-format msgid "you cannot act on a file with mode %s" msgstr "" -#: ../IkiWiki/Plugin/git.pm:661 +#: ../IkiWiki/Plugin/git.pm:662 msgid "you are not allowed to change file modes" msgstr "" @@ -681,11 +690,11 @@ msgstr "" msgid "search" msgstr "" -#: ../IkiWiki/Plugin/shortcut.pm:27 +#: ../IkiWiki/Plugin/shortcut.pm:28 msgid "shortcut plugin will not work without a shortcuts.mdwn" msgstr "" -#: ../IkiWiki/Plugin/shortcut.pm:36 +#: ../IkiWiki/Plugin/shortcut.pm:38 #, fuzzy msgid "missing name or url parameter" msgstr "genväg saknar parameter för namn eller url" @@ -693,7 +702,7 @@ msgstr "genväg saknar parameter för namn eller url" #. translators: This is used to display what shortcuts are defined. #. translators: First parameter is the name of the shortcut, the second #. translators: is an URL. -#: ../IkiWiki/Plugin/shortcut.pm:45 +#: ../IkiWiki/Plugin/shortcut.pm:48 #, fuzzy, perl-format msgid "shortcut %s points to %s" msgstr "genvägen %s pekar på %s" @@ -965,11 +974,11 @@ msgstr "" msgid "generating wrappers.." msgstr "genererar wrappers.." -#: ../ikiwiki.in:194 +#: ../ikiwiki.in:195 msgid "rebuilding wiki.." msgstr "bygger om wiki.." -#: ../ikiwiki.in:197 +#: ../ikiwiki.in:198 msgid "refreshing wiki.." msgstr "uppdaterar wiki.." diff --git a/po/vi.po b/po/vi.po index 13d695880..4cc16e1d8 100644 --- a/po/vi.po +++ b/po/vi.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: ikiwiki\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-10-26 15:03-0400\n" +"POT-Creation-Date: 2008-10-31 16:37-0400\n" "PO-Revision-Date: 2007-01-13 15:31+1030\n" "Last-Translator: Clytie Siddall \n" "Language-Team: Vietnamese \n" @@ -131,7 +131,7 @@ msgstr "đang tạo trang mới %s" msgid "deleting bucket.." msgstr "" -#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:205 +#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:206 msgid "done" msgstr "xong" @@ -253,22 +253,31 @@ msgstr "" msgid "failed to process" msgstr "mẫu không xử lý được:" +#: ../IkiWiki/Plugin/format.pm:22 +msgid "must specify format and text" +msgstr "" + +#: ../IkiWiki/Plugin/format.pm:25 +#, perl-format +msgid "unsupported page format %s" +msgstr "" + #: ../IkiWiki/Plugin/fortune.pm:27 msgid "fortune failed" msgstr "fortune bị lỗi" -#: ../IkiWiki/Plugin/git.pm:617 ../IkiWiki/Plugin/git.pm:635 +#: ../IkiWiki/Plugin/git.pm:618 ../IkiWiki/Plugin/git.pm:636 #: ../IkiWiki/Receive.pm:129 #, perl-format msgid "you are not allowed to change %s" msgstr "" -#: ../IkiWiki/Plugin/git.pm:657 +#: ../IkiWiki/Plugin/git.pm:658 #, perl-format msgid "you cannot act on a file with mode %s" msgstr "" -#: ../IkiWiki/Plugin/git.pm:661 +#: ../IkiWiki/Plugin/git.pm:662 msgid "you are not allowed to change file modes" msgstr "" @@ -682,11 +691,11 @@ msgstr "" msgid "search" msgstr "" -#: ../IkiWiki/Plugin/shortcut.pm:27 +#: ../IkiWiki/Plugin/shortcut.pm:28 msgid "shortcut plugin will not work without a shortcuts.mdwn" msgstr "" -#: ../IkiWiki/Plugin/shortcut.pm:36 +#: ../IkiWiki/Plugin/shortcut.pm:38 #, fuzzy msgid "missing name or url parameter" msgstr "lối tắt thiếu tên hay tham số url" @@ -694,7 +703,7 @@ msgstr "lối tắt thiếu tên hay tham số url" #. translators: This is used to display what shortcuts are defined. #. translators: First parameter is the name of the shortcut, the second #. translators: is an URL. -#: ../IkiWiki/Plugin/shortcut.pm:45 +#: ../IkiWiki/Plugin/shortcut.pm:48 #, fuzzy, perl-format msgid "shortcut %s points to %s" msgstr "lối tắt %s chỉ tới %s" @@ -966,11 +975,11 @@ msgstr "" msgid "generating wrappers.." msgstr "đang tạo ra các bộ bao bọc.." -#: ../ikiwiki.in:194 +#: ../ikiwiki.in:195 msgid "rebuilding wiki.." msgstr "đang xây dựng lại wiki.." -#: ../ikiwiki.in:197 +#: ../ikiwiki.in:198 msgid "refreshing wiki.." msgstr "đang làm tươi wiki.." -- cgit v1.2.3 From efc1e4a3690a55b7b07d407ffff551e638f59151 Mon Sep 17 00:00:00 2001 From: alexander Date: Fri, 31 Oct 2008 17:52:42 -0400 Subject: --- doc/plugins/calendar/discussion.mdwn | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/calendar/discussion.mdwn b/doc/plugins/calendar/discussion.mdwn index 65c2459c6..148b83522 100644 --- a/doc/plugins/calendar/discussion.mdwn +++ b/doc/plugins/calendar/discussion.mdwn @@ -1,2 +1,4 @@ It would be nice if the "month" type calendar could collect all of the matching pages on a given date in some inline type way. --[[DavidBremner]] + +Is it possible to get the calendar to link to pages based not on their timestamp (as I understand that it does now, or have I misunderstood this?) and instead on for example their location in a directory hierarchy. That way the calendar could be used as a planning / timeline device which I think would be great. --[[Alexander]] -- cgit v1.2.3 From fd9192006b32498ab6c0badfb1806acb6ee893c8 Mon Sep 17 00:00:00 2001 From: alexander Date: Fri, 31 Oct 2008 17:53:57 -0400 Subject: --- doc/plugins/calendar/alexander.mdwn | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/plugins/calendar/alexander.mdwn (limited to 'doc/plugins') diff --git a/doc/plugins/calendar/alexander.mdwn b/doc/plugins/calendar/alexander.mdwn new file mode 100644 index 000000000..b2894a90c --- /dev/null +++ b/doc/plugins/calendar/alexander.mdwn @@ -0,0 +1 @@ +I use ikiwiki to organize information - projects, reading notes, outlines, todo lists, etc. -- cgit v1.2.3 From 8f7e6e76ace0ba0a402176518eca282fe356358b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 31 Oct 2008 18:02:03 -0400 Subject: rename --- doc/plugins/calendar/alexander.mdwn | 1 - doc/users/alexander.mdwn | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 doc/plugins/calendar/alexander.mdwn create mode 100644 doc/users/alexander.mdwn (limited to 'doc/plugins') diff --git a/doc/plugins/calendar/alexander.mdwn b/doc/plugins/calendar/alexander.mdwn deleted file mode 100644 index b2894a90c..000000000 --- a/doc/plugins/calendar/alexander.mdwn +++ /dev/null @@ -1 +0,0 @@ -I use ikiwiki to organize information - projects, reading notes, outlines, todo lists, etc. diff --git a/doc/users/alexander.mdwn b/doc/users/alexander.mdwn new file mode 100644 index 000000000..b2894a90c --- /dev/null +++ b/doc/users/alexander.mdwn @@ -0,0 +1 @@ +I use ikiwiki to organize information - projects, reading notes, outlines, todo lists, etc. -- cgit v1.2.3 From 8e451ecda4573284467c95a0b66ade3014fd1bd8 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 2 Nov 2008 20:13:14 +0100 Subject: po: now uses inject --- doc/plugins/contrib/po.mdwn | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index f60b8fbea..98cc07178 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -52,10 +52,13 @@ Any thoughts on this? >>> [[plugins/write]]. I think you can just inject wrappers about a few ikiwiki >>> functions, rather than adding hooks. The `inject` function is pretty >>> insane^Wlow level, but seems to work great. --[[Joey]] ->> +>>> >>>> Thanks a lot, it seems to be a nice interface for what I was trying to achieve. >>>> I may be forced to wait two long weeks before I have a chance to confirm >>>> this. Stay tuned. --[[intrigeri]] +>>>> +>>>>> I've updated the plugin to use `inject`. It is now fully self-contained, +>>>>> and does not modify the core anymore. --[[intrigeri]] >> >> The Discussion pages issue is something I am not sure about yet. But I will >> probably decide that "slave" pages, being only translations, don't deserve -- cgit v1.2.3 From b2aa69762d7f1950281d838ad0f13092f62f3962 Mon Sep 17 00:00:00 2001 From: neale Date: Mon, 3 Nov 2008 22:07:58 -0500 Subject: --- doc/plugins/img/discussion.mdwn | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/img/discussion.mdwn b/doc/plugins/img/discussion.mdwn index 02d46e380..7a70da65f 100644 --- a/doc/plugins/img/discussion.mdwn +++ b/doc/plugins/img/discussion.mdwn @@ -5,3 +5,5 @@ logo link to \[[hurd/logo]] / instead of linking to the PNG image file. --[[tschwinge]] > Done, use link=somepage --[[Joey]] + +It would be handy if the `class` and `id` tags were passed through to the surrounding `table` in the case of `caption` being present. Would this break anything? --[[Nea -- cgit v1.2.3 From 8903776a0938c0bec03b864b1aa63672ed096298 Mon Sep 17 00:00:00 2001 From: neale Date: Mon, 3 Nov 2008 22:08:49 -0500 Subject: trackpad registered a click on save --- doc/plugins/img/discussion.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/img/discussion.mdwn b/doc/plugins/img/discussion.mdwn index 7a70da65f..5bf340c56 100644 --- a/doc/plugins/img/discussion.mdwn +++ b/doc/plugins/img/discussion.mdwn @@ -6,4 +6,4 @@ instead of linking to the PNG image file. --[[tschwinge]] > Done, use link=somepage --[[Joey]] -It would be handy if the `class` and `id` tags were passed through to the surrounding `table` in the case of `caption` being present. Would this break anything? --[[Nea +It would be handy if the `class` and `id` tags were passed through to the surrounding `table` in the case of `caption` being present. Would this break anything? --[[neale]] -- cgit v1.2.3 From ab729c78b2c3f597d460adc63ab6c832059bafd2 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 5 Nov 2008 13:21:16 -0500 Subject: add a more useful example of a relative date ;-) --- doc/plugins/relativedate.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/relativedate.mdwn b/doc/plugins/relativedate.mdwn index 32f8c798b..3ada0864b 100644 --- a/doc/plugins/relativedate.mdwn +++ b/doc/plugins/relativedate.mdwn @@ -13,4 +13,4 @@ If this plugin is enabled, you may also add relative dates to pages in the wiki, by using html elements in the "relativedate" class. For example, this will display as a relative date: - Fri Oct 17 18:36:13 EDT 2008 + Tue Jan 20 12:00:00 EDT 2009 -- cgit v1.2.3 From f258902a2146e968aecc80ead6f74102c0418b66 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 5 Nov 2008 13:30:26 -0500 Subject: response --- doc/plugins/img/discussion.mdwn | 3 +++ 1 file changed, 3 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/img/discussion.mdwn b/doc/plugins/img/discussion.mdwn index 5bf340c56..e1bb2d15b 100644 --- a/doc/plugins/img/discussion.mdwn +++ b/doc/plugins/img/discussion.mdwn @@ -7,3 +7,6 @@ instead of linking to the PNG image file. --[[tschwinge]] > Done, use link=somepage --[[Joey]] It would be handy if the `class` and `id` tags were passed through to the surrounding `table` in the case of `caption` being present. Would this break anything? --[[neale]] + +> Seems unlikely to break *too* much. I can imagine css that styles the img +> unexpectedly applying the table. --[[Joey]] -- cgit v1.2.3 From d6ac704500edf682c6dac729ee4405f0ad1a081f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 5 Nov 2008 14:33:35 -0500 Subject: comments and questions --- doc/plugins/contrib/po.mdwn | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index 98cc07178..da060b7a1 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -64,3 +64,14 @@ Any thoughts on this? >> probably decide that "slave" pages, being only translations, don't deserve >> a discussion page: the discussion should happen in the language in which the >> pages are written for real, which is the "master" one. --[[intrigeri]] +>> +>> I think that's a good decision, you don't want to translate discussion, +>> and if the discussion page turns out multilingual, well, se la vi. ;-) +>> +>> Relatedly, what happens if a translated page has a broken link, and you +>> click on it to edit it? Seems you'd first have to create a master page +>> and could only then translate it, right? I wonder if this will be clear +>> though to the user. +>> +>> And also, is there any way to start a translation of a page into a new +>> lanauge using the web interface? --[[Joey]] -- cgit v1.2.3 From 466ceb13946699cbd6b0ef0cad8f3040804265ae Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 5 Nov 2008 14:35:41 -0500 Subject: response --- doc/plugins/contrib/po.mdwn | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index da060b7a1..af215a493 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -74,4 +74,9 @@ Any thoughts on this? >> though to the user. >> >> And also, is there any way to start a translation of a page into a new ->> lanauge using the web interface? --[[Joey]] +>> lanauge using the web interface? +>> +>> FWIW, I'm tracking your po branch in ikiwiki master git in the po +>> branch. One thing I'd like to try in there is setting up a translated +>> basewiki, which seems like it should be pretty easy to do, and would be +>> a great demo! --[[Joey]] -- cgit v1.2.3 From 256b3aeba8a1a9e41c2e89d9030a1a55be060540 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Thu, 6 Nov 2008 12:34:47 +0100 Subject: po: response Signed-off-by: intrigeri --- doc/plugins/contrib/po.mdwn | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index af215a493..d8edbc704 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -80,3 +80,7 @@ Any thoughts on this? >> branch. One thing I'd like to try in there is setting up a translated >> basewiki, which seems like it should be pretty easy to do, and would be >> a great demo! --[[Joey]] +>> +>>> I've merged your changes into my own branch. Please note my +>>> repository location has changed a few days ago, see my user page +>>> for the new one. --[[intrigeri]] -- cgit v1.2.3 From 725dae735334c5762f7f500a20d0ca65788cf137 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Thu, 6 Nov 2008 16:10:33 +0100 Subject: po: misc responses to Joey Signed-off-by: intrigeri --- doc/plugins/contrib/po.mdwn | 44 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 7 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index d8edbc704..c2e2b60f7 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -3,9 +3,11 @@ translated with gettext, using [po4a](http://po4a.alioth.debian.org/). More information: -* It can be found in [my "po" branch](http://repo.or.cz/w/ikiwiki/intrigeri.git?a=shortlog;h=refs/heads/po): `git clone git://repo.or.cz/ikiwiki/intrigeri.git` -* It involves adding three hooks to ikiwiki core. -* It is documented (including TODO and plans for next work steps) in `doc/plugins/po.mdwn`, which can be found in the same branch. +* It can be found in my "po" branch: + `git clone git://gaffer.ptitcanardnoir.org/ikiwiki.git` +* It is self-contained, *i.e.* it does not modify ikiwiki core at all. +* It is documented (including TODO and plans for next work steps) in + `doc/plugins/po.mdwn`, which can be found in the same branch. * No public demo site is available so far, I'm working on this. My plan is to get this plugin clean enough to be included in ikiwiki. @@ -73,14 +75,42 @@ Any thoughts on this? >> and could only then translate it, right? I wonder if this will be clear >> though to the user. >> +>>> Right: a broken link points to the URL that allows to create +>>> a page that can either be a new master page or a non-translatable +>>> page, depending on `po_translatable_pages` value. The best +>>> solution I can thing of is to use [[plugins/edittemplate]] to +>>> insert something like "Warning: this is a master page, that must +>>> be written in $MASTER_LANGUAGE" into newly created master pages, +>>> and maybe another warning message on newly created +>>> non-translatable pages. It seems quite doable to me, but in order +>>> to avoid breaking existing functionality, it implies to hack a bit +>>> [[plugins/edittemplate]] so that multiple templates can be +>>> inserted at page creation time. [[--intrigeri]] +>> >> And also, is there any way to start a translation of a page into a new >> lanauge using the web interface? ->> +>> +>>> When a new language is added to `po_slave_languages`, a rebuild is +>>> triggered, and all missing PO files are created and checked into +>>> VCS. An unpriviledged wiki user can not add a new language to +>>> `po_slave_languages`, though. One could thing of adding the needed +>>> interface to translate a page into a yet-unsupported slave +>>> language, and this would automagically add this new language to +>>> `po_slave_languages`. It would probably be useful in some +>>> usecases, but I'm not comfortable with letting unpriviledged wiki +>>> users change the wiki configuration as a side effect of their +>>> actions; if this were to be implemented, special care would be +>>> needed. [[--intrigeri]] + >> FWIW, I'm tracking your po branch in ikiwiki master git in the po >> branch. One thing I'd like to try in there is setting up a translated >> basewiki, which seems like it should be pretty easy to do, and would be >> a great demo! --[[Joey]] >> ->>> I've merged your changes into my own branch. Please note my ->>> repository location has changed a few days ago, see my user page ->>> for the new one. --[[intrigeri]] +>>> I've merged your changes into my own branch, and made great +>>> progress on the various todo items. Please note my repository +>>> location has changed a few days ago, my user page was updated +>>> accordingly, but I forgot to update this page at the same time. +>>> Hoping it's not too complicated to relocated an existing remote... +>>> (never done that, I'm a Git beginner as well as a Perl +>>> newbie) --[[intrigeri]] -- cgit v1.2.3 From 56fd048210d3606c98f69b72f978fbd06f5520ab Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 6 Nov 2008 13:51:01 -0500 Subject: response --- doc/plugins/contrib/po.mdwn | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index c2e2b60f7..cc19c53b3 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -101,6 +101,11 @@ Any thoughts on this? >>> users change the wiki configuration as a side effect of their >>> actions; if this were to be implemented, special care would be >>> needed. [[--intrigeri]] +>>> +>>>> Actually I meant into any of the currently supported languages. +>>>> I guess that if the template modification is made, it will list those +>>>> languages on the page, and if a translation to a language is missing, +>>>> the link will allow creating it? >> FWIW, I'm tracking your po branch in ikiwiki master git in the po >> branch. One thing I'd like to try in there is setting up a translated @@ -113,4 +118,6 @@ Any thoughts on this? >>> accordingly, but I forgot to update this page at the same time. >>> Hoping it's not too complicated to relocated an existing remote... >>> (never done that, I'm a Git beginner as well as a Perl ->>> newbie) --[[intrigeri]] +>>> newbie) --[[intrigeri]]a +>>>> +>>>> Just a matter of editing .git/config, thanks for the heads up. -- cgit v1.2.3 From db5ea4d4f01d7706c5397101ec860f8a471c1c55 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 6 Nov 2008 16:08:11 -0500 Subject: meta: Plugin is now enabled by default since the basewiki uses it. --- IkiWiki.pm | 2 +- IkiWiki/Plugin/goodstuff.pm | 1 - debian/changelog | 1 + ...asewiki_uses_meta_directives_but_meta_is_not_enabled_by_default.mdwn | 2 ++ doc/plugins/goodstuff.mdwn | 1 - doc/plugins/meta.mdwn | 2 +- 6 files changed, 5 insertions(+), 4 deletions(-) (limited to 'doc/plugins') diff --git a/IkiWiki.pm b/IkiWiki.pm index bab7b707a..91d2e6082 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -120,7 +120,7 @@ sub getsetup () { #{{{ }, default_plugins => { type => "internal", - default => [qw{mdwn link inline htmlscrubber passwordauth + default => [qw{mdwn link inline meta htmlscrubber passwordauth openid signinedit lockedit conditional recentchanges parentlinks editpage}], description => "plugins to enable by default", diff --git a/IkiWiki/Plugin/goodstuff.pm b/IkiWiki/Plugin/goodstuff.pm index ed1f4ddfc..a18e626d4 100644 --- a/IkiWiki/Plugin/goodstuff.pm +++ b/IkiWiki/Plugin/goodstuff.pm @@ -10,7 +10,6 @@ my @bundle=qw{ brokenlinks img map - meta more orphans pagecount diff --git a/debian/changelog b/debian/changelog index cd8ecba7c..a197369cc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,7 @@ ikiwiki (2.69) UNRELEASED; urgency=low links. Since this needs the just released XML::Feed 0.3, as well as a not yet released XML::RSS, it will fall back to the old method if no xml:base info is available. + * meta: Plugin is now enabled by default since the basewiki uses it. -- Joey Hess Thu, 06 Nov 2008 16:01:00 -0500 diff --git a/doc/bugs/basewiki_uses_meta_directives_but_meta_is_not_enabled_by_default.mdwn b/doc/bugs/basewiki_uses_meta_directives_but_meta_is_not_enabled_by_default.mdwn index a90227b7a..62931d8bc 100644 --- a/doc/bugs/basewiki_uses_meta_directives_but_meta_is_not_enabled_by_default.mdwn +++ b/doc/bugs/basewiki_uses_meta_directives_but_meta_is_not_enabled_by_default.mdwn @@ -1,3 +1,5 @@ [[plugins/meta]] is not enabled by default, yet some pages in the default basewiki include [[the_meta_directive|ikiwiki/directive/meta]], notably the [[ikiwiki]] heirarchy. This means that the default output of "ikiwiki src dest", for two empty directories src and dest, result in the meta directive being displayed inline with the page text. + +> [[done]], meta now enabled by default. diff --git a/doc/plugins/goodstuff.mdwn b/doc/plugins/goodstuff.mdwn index 83b60f4fa..ed57c0f01 100644 --- a/doc/plugins/goodstuff.mdwn +++ b/doc/plugins/goodstuff.mdwn @@ -12,7 +12,6 @@ Currently included: * [[brokenlinks]] * [[img]] * [[map]] -* [[meta]] * [[more]] * [[orphans]] * [[pagecount]] diff --git a/doc/plugins/meta.mdwn b/doc/plugins/meta.mdwn index afd554993..e49bdcc50 100644 --- a/doc/plugins/meta.mdwn +++ b/doc/plugins/meta.mdwn @@ -1,4 +1,4 @@ -[[!template id=plugin name=meta author="[[Joey]]"]] +[[!template id=plugin name=meta core=1 author="[[Joey]]"]] [[!tag type/meta]] This plugin provides the [[ikiwiki/directive/meta]] [[ikiwiki/directive]], -- cgit v1.2.3 From 4991cb441e6898a2d350c43c8618ce728331b9a4 Mon Sep 17 00:00:00 2001 From: AlexandreDupas Date: Sat, 8 Nov 2008 11:04:27 -0500 Subject: question about the format directive and relation with htmlize hooks --- doc/plugins/format/discussion.mdwn | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 doc/plugins/format/discussion.mdwn (limited to 'doc/plugins') diff --git a/doc/plugins/format/discussion.mdwn b/doc/plugins/format/discussion.mdwn new file mode 100644 index 000000000..b7d6ca71c --- /dev/null +++ b/doc/plugins/format/discussion.mdwn @@ -0,0 +1,5 @@ +Is there any way to tell if an htmlize hook have been called from a format directive? + +I am currently modifying the [[contrib/highlightcode]] plugin by [[sabr]] and I wanted to have a different behavior depending on the fact that the htmlize hook is called from a format directive or not. For instance, this could disable the raw copy of the highlighted code. Since I have enabled the keepextension option, I tried to rely on the page extension to decide whenever I have to create the raw file or not but this does not seems a reliable approach. + +One possible solution is to add an optional parameter to the htmlize hook (and thus to htmlize function in IkiWiki.pm) which could tell if this is the format directive that called the function but I am not sure that is a good way to do this. -- cgit v1.2.3 From 5c0d43999f1e9eb0814eed3ccc0a91b030bb6a3e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 10 Nov 2008 13:30:20 -0500 Subject: response --- doc/plugins/format/discussion.mdwn | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/format/discussion.mdwn b/doc/plugins/format/discussion.mdwn index b7d6ca71c..df8448ed6 100644 --- a/doc/plugins/format/discussion.mdwn +++ b/doc/plugins/format/discussion.mdwn @@ -3,3 +3,13 @@ Is there any way to tell if an htmlize hook have been called from a format direc I am currently modifying the [[contrib/highlightcode]] plugin by [[sabr]] and I wanted to have a different behavior depending on the fact that the htmlize hook is called from a format directive or not. For instance, this could disable the raw copy of the highlighted code. Since I have enabled the keepextension option, I tried to rely on the page extension to decide whenever I have to create the raw file or not but this does not seems a reliable approach. One possible solution is to add an optional parameter to the htmlize hook (and thus to htmlize function in IkiWiki.pm) which could tell if this is the format directive that called the function but I am not sure that is a good way to do this. + +> It's (probably) not just the format directive that has a potential problem here. +> Imagine a syntax highlighted source code file that contains some other +> directive, such as table or meta. Such a directive calls `htmlize` on the +> parameters passed to it. +> +> There is one way to detect this ATM. If `%IkiWiki::preprocessing` has +> anything in it, then ikiwiki is in the middle of handling a preprocessing +> directive. So you could check that. It's getting into internals, so not +> ideal.. --[[Joey]] -- cgit v1.2.3 From 8c47f16dccd8a4dd91f365233690bd8139431249 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 11 Nov 2008 04:39:26 +0100 Subject: po: help request Signed-off-by: intrigeri --- doc/plugins/contrib/po.mdwn | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index cc19c53b3..4ad0fa063 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -118,6 +118,10 @@ Any thoughts on this? >>> accordingly, but I forgot to update this page at the same time. >>> Hoping it's not too complicated to relocated an existing remote... >>> (never done that, I'm a Git beginner as well as a Perl ->>> newbie) --[[intrigeri]]a +>>> newbie) --[[intrigeri]] >>>> >>>> Just a matter of editing .git/config, thanks for the heads up. +>>>>> +>>>>> Joey, please have a look at my branch, your help would be really +>>>>> welcome for the security research, as I'm almost done with what +>>>>> I am able to do myself in this area. --[[intrigeri]] -- cgit v1.2.3 From fb9130c18c073d263d3eaa1dd5ef1e78b60f868a Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 11 Nov 2008 17:17:56 +0100 Subject: po: answered Joey's "create a new translation" question ... that I previously completely missed. Signed-off-by: intrigeri --- doc/plugins/contrib/po.mdwn | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index 4ad0fa063..3077b4858 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -93,7 +93,7 @@ Any thoughts on this? >>> When a new language is added to `po_slave_languages`, a rebuild is >>> triggered, and all missing PO files are created and checked into >>> VCS. An unpriviledged wiki user can not add a new language to ->>> `po_slave_languages`, though. One could thing of adding the needed +>>> `po_slave_languages`, though. One could think of adding the needed >>> interface to translate a page into a yet-unsupported slave >>> language, and this would automagically add this new language to >>> `po_slave_languages`. It would probably be useful in some @@ -106,6 +106,39 @@ Any thoughts on this? >>>> I guess that if the template modification is made, it will list those >>>> languages on the page, and if a translation to a language is missing, >>>> the link will allow creating it? +>>>> +>>>>> Any translation page always exist for every supported slave +>>>>> language, even if no string at all have been translated yet. +>>>>> This implies the po plugin is especially friendly to people who +>>>>> prefer reading in their native language if available, but don't +>>>>> mind reading in English else. +>>>>> +>>>>> While I'm at it, there is a remaining issue that needs to be +>>>>> sorted out: how painful it could be for non-English speakers +>>>>> (assuming the master language is English) to be perfectly able +>>>>> to navigate between translation pages supposed to be written in +>>>>> their own language, when their translation level is most +>>>>> often low. +>>>>> +>>>>> (It is currently easy to display this status on the translation +>>>>> page itself, but then it's too late, and how frustrating to load +>>>>> a page just to realize it's actually not translated enough for +>>>>> you. The "other languages" loop also allows displaying this +>>>>> information, but it is generally not the primary +>>>>> navigation tool.) +>>>>> +>>>>> IMHO, this is actually a social problem (i.e. it's no use adding +>>>>> a language to the supported slave ones if you don't have the +>>>>> manpower to actually do the translations), that can't be fully +>>>>> solved by technical solutions, but I can think of some hacks +>>>>> that would limit the negative impact: a given translation's +>>>>> status (currently = percent translated) could be displayed next +>>>>> to the link that leads to it; a color code could as well be used +>>>>> ("just" a matter of adding a CSS id or class to the links, +>>>>> depending on this variable). As there is already work to be done +>>>>> to have the links text generation more customizable through +>>>>> plugins, I could do both at the same time if we consider this +>>>>> matter to be important enough. --[[intrigeri]] >> FWIW, I'm tracking your po branch in ikiwiki master git in the po >> branch. One thing I'd like to try in there is setting up a translated -- cgit v1.2.3 From 50b95a0742d74a4f73f5a8ed9ffc50733080de77 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 11 Nov 2008 18:34:18 -0500 Subject: response --- doc/plugins/contrib/po.mdwn | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index 3077b4858..0fd06cb81 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -158,3 +158,5 @@ Any thoughts on this? >>>>> Joey, please have a look at my branch, your help would be really >>>>> welcome for the security research, as I'm almost done with what >>>>> I am able to do myself in this area. --[[intrigeri]] +>>>>>> +>>>>>> I came up with a patch for the WrapI18N issue --[[Joey]] -- cgit v1.2.3 From e7a840ed9a817cf4db59c90e680afd89e146b581 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sun, 16 Nov 2008 18:11:39 +0000 Subject: htmlbalance: new plugin that balances tags by parsing and re-serializing --- IkiWiki/Plugin/htmlbalance.pm | 57 +++++++++++++++++++++++++++++++++++++++++++ doc/plugins/aggregate.mdwn | 6 ++--- doc/plugins/htmlbalance.mdwn | 9 +++++++ doc/plugins/htmltidy.mdwn | 3 ++- t/htmlbalance.t | 13 ++++++++++ 5 files changed, 84 insertions(+), 4 deletions(-) create mode 100644 IkiWiki/Plugin/htmlbalance.pm create mode 100644 doc/plugins/htmlbalance.mdwn create mode 100755 t/htmlbalance.t (limited to 'doc/plugins') diff --git a/IkiWiki/Plugin/htmlbalance.pm b/IkiWiki/Plugin/htmlbalance.pm new file mode 100644 index 000000000..667d73b6c --- /dev/null +++ b/IkiWiki/Plugin/htmlbalance.pm @@ -0,0 +1,57 @@ +#!/usr/bin/perl +package IkiWiki::Plugin::htmlbalance; + +# htmlbalance: Parse and re-serialize HTML to ensure balanced tags +# +# Copyright 2008 Simon McVittie +# Licensed under the GNU GPL, version 2, or any later version published by the +# Free Software Foundation + +use warnings; +use strict; +use IkiWiki 2.00; + +sub import { #{{{ + hook(type => "getsetup", id => "htmlbalance", call => \&getsetup); + hook(type => "sanitize", id => "htmlbalance", call => \&sanitize); +} # }}} + +sub getsetup () { #{{{ + return + plugin => { + safe => 1, + rebuild => undef, + }, +} #}}} + +sub sanitize (@) { #{{{ + my %params=@_; + my $ret = ''; + + eval { + use HTML::TreeBuilder; + use XML::Atom::Util qw(encode_xml); + }; + + if ($@) { + error($@); + return $params{content}; + } + + my $tree = HTML::TreeBuilder->new_from_content($params{content}); + my @nodes = $tree->disembowel(); + foreach my $node (@nodes) { + if (ref $node) { + $ret .= $node->as_XML(); + chomp $ret; + $node->delete(); + } + else { + $ret .= encode_xml($node); + } + } + $tree->delete(); + return $ret; +} # }}} + +1 diff --git a/doc/plugins/aggregate.mdwn b/doc/plugins/aggregate.mdwn index c40a6dc22..6fc87853b 100644 --- a/doc/plugins/aggregate.mdwn +++ b/doc/plugins/aggregate.mdwn @@ -9,9 +9,9 @@ New users of aggregate should enable the `aggregateinternal => 1` option in the .setup file. If you don't do so, you will need to enable the [[html]] plugin as well as aggregate itself, since feed entries will be stored as HTML. -The [[meta]] and [[tag]] plugins are also recommended. The -[[htmltidy]] plugin is suggested, since feeds can easily contain html -problems, some of which tidy can fix. +The [[meta]] and [[tag]] plugins are also recommended. Either the +[[htmltidy]] or [[htmlbalance]] plugin is suggested, since feeds can easily +contain html problems, some of which these plugins can fix. You will need to run ikiwiki periodically from a cron job, passing it the --aggregate parameter, to make it check for new posts. Here's an example diff --git a/doc/plugins/htmlbalance.mdwn b/doc/plugins/htmlbalance.mdwn new file mode 100644 index 000000000..7cdb1f950 --- /dev/null +++ b/doc/plugins/htmlbalance.mdwn @@ -0,0 +1,9 @@ +[[!template id=plugin name=htmlbalance author="Simon McVittie"]] +[[!tag type/html]] + +This plugin ensures that the HTML emitted by ikiwiki contains well-balanced +HTML tags, by parsing it with HTML::TreeBuilder and re-serializing it. This +acts as a lighter-weight alternative to [[plugins/htmltidy]]; it doesn't +ensure validity, but it does at least ensure that formatting from a +blog post pulled in by \[[![[ikiwiki/directive/inline]]]] doesn't +leak into the rest of the page. diff --git a/doc/plugins/htmltidy.mdwn b/doc/plugins/htmltidy.mdwn index f675a01ae..580e56f59 100644 --- a/doc/plugins/htmltidy.mdwn +++ b/doc/plugins/htmltidy.mdwn @@ -7,4 +7,5 @@ emitted by ikiwiki. Besides being nicely formatted, this helps ensure that even if users enter suboptimal html, your wiki generates valid html. Note that since tidy is an external program, that is run each time a page -is built, this plugin will slow ikiwiki down somewhat. +is built, this plugin will slow ikiwiki down somewhat. [[plugins/htmlbalance]] +might provide a faster alternative. diff --git a/t/htmlbalance.t b/t/htmlbalance.t new file mode 100755 index 000000000..cd124e473 --- /dev/null +++ b/t/htmlbalance.t @@ -0,0 +1,13 @@ +#!/usr/bin/perl +use warnings; +use strict; +use Test::More tests => 7; + +BEGIN { use_ok("IkiWiki::Plugin::htmlbalance"); } + +is(IkiWiki::Plugin::htmlbalance::sanitize(content => "

"), "
"); +is(IkiWiki::Plugin::htmlbalance::sanitize(content => "

hello world

"), "

hello world

"); +is(IkiWiki::Plugin::htmlbalance::sanitize(content => ""), ""); +is(IkiWiki::Plugin::htmlbalance::sanitize(content => "foo "), "foo "); +is(IkiWiki::Plugin::htmlbalance::sanitize(content => " foo "), " foo "); +is(IkiWiki::Plugin::htmlbalance::sanitize(content => "a>"), "a>"); -- cgit v1.2.3 From 913b516b4ea710a77947fb988a76b7689fbebd62 Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Mon, 17 Nov 2008 06:13:46 -0500 Subject: Link to third-party htmlbalance plugin --- doc/plugins/contrib/htmlbalance.mdwn | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 doc/plugins/contrib/htmlbalance.mdwn (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/htmlbalance.mdwn b/doc/plugins/contrib/htmlbalance.mdwn new file mode 100644 index 000000000..462e4b8e9 --- /dev/null +++ b/doc/plugins/contrib/htmlbalance.mdwn @@ -0,0 +1,11 @@ +[[!template id=plugin name=htmlbalance author="[[Simon_McVittie|smcv]]"]] +[[!tag type/html]] + +This plugin ensures that the HTML emitted by ikiwiki contains well-balanced +HTML tags, by parsing it with [[!cpan HTML::TreeBuilder]] and re-serializing it. This +acts as a lighter-weight alternative to [[plugins/htmltidy]]; it doesn't +ensure validity, but it does at least ensure that formatting from a +blog post pulled in by the [[ikiwiki/directive/inline]] directive doesn't +leak into the rest of the page. + +htmlbalance is available from the 'htmlbalance' branch in [[smcv]]'s git repository. -- cgit v1.2.3 From 8f22c2454f8963071a28c7753c7b38f96b1649c5 Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Mon, 17 Nov 2008 06:14:51 -0500 Subject: Explicitly say that I'd like to get this into ikiwiki --- doc/plugins/contrib/htmlbalance.mdwn | 1 + 1 file changed, 1 insertion(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/htmlbalance.mdwn b/doc/plugins/contrib/htmlbalance.mdwn index 462e4b8e9..728e6afc2 100644 --- a/doc/plugins/contrib/htmlbalance.mdwn +++ b/doc/plugins/contrib/htmlbalance.mdwn @@ -9,3 +9,4 @@ blog post pulled in by the [[ikiwiki/directive/inline]] directive doesn't leak into the rest of the page. htmlbalance is available from the 'htmlbalance' branch in [[smcv]]'s git repository. +I'd like to get this plugin included in ikiwiki - any code review is welcome. -- cgit v1.2.3 From c59d9c64a3d8de6ea926953fe5298d6d9b4e1531 Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Mon, 17 Nov 2008 06:42:07 -0500 Subject: Publicise postcomment --- doc/plugins/contrib/postcomment.mdwn | 55 ++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 doc/plugins/contrib/postcomment.mdwn (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/postcomment.mdwn b/doc/plugins/contrib/postcomment.mdwn new file mode 100644 index 000000000..4d1db6c9b --- /dev/null +++ b/doc/plugins/contrib/postcomment.mdwn @@ -0,0 +1,55 @@ +[[!template id=plugin name=postcomment author="[[Simon_McVittie|smcv]]"]] +[[!tag type=useful]] + +This plugin adds "blog-style" comments. The intention is that on a non-wiki site +(like a blog) you can lock all pages for admin-only access, then allow otherwise +unprivileged (or perhaps even anonymous) users to comment on posts. + +Comments are saved as internal pages, so they can never be edited through the CGI, +only by direct committers. Currently, comments are always in [[ikiwiki/markdown]]. +Directives and raw HTML are filtered out by default, and comment authorship should +hopefully be unforgeable by CGI users. + +When comments have been enabled generally, you still need to mark which pages +can have comments, by including the `\[[!postcomment]]` directive in them. By default, +this directive expands to a "post a comment" link plus an `\[[!inline]]` with +the comments. + +The plugin adds a new [[ikiwiki/PageSpec]] match type, `postcomment`, for use +with `anonok_pagespec` from the [[plugins/anonok]] plugin or `locked_pages` from +the [[plugins/lockedit]] plugin. Typical usage would be something like: + + locked_pages => "!postcomment(*)" + +to allow non-admin users to comment on pages, but not edit anything. You can also do + + anonok_pages => "postcomment(*)" + +to allow anonymous comments (the IP address will be used as the "author"). + +Optional parameters to the postcomment directive: + +* `commit=no`: by default, comments are committed to version control. Use this to + disable commits. +* `allowhtml=yes`: by default, raw HTML is filtered out. Use this to allow HTML + (you should enable [[plugins/htmlscrubber]] and either [[plugins/htmltidy]] or + [[plugins/contrib/htmlbalance]] if you do this). +* `allowdirectives=yes`: by default, IkiWiki directives are filtered out. Use this + to allow directives (avoid enabling any [[plugins/type/slow]] directives if you + do this). +* `closed=yes`: use this to prevent new comments while still displaying existing ones. +* `atom`, `rss`, `feeds`, `feedshow`, `timeformat`, `feedonly`: the same as for [[plugins/inline]] + +This plugin aims to close the [[todo]] item "[[todo/supporting_comments_via_disussion_pages]]", +and is currently available from [[smcv]]'s git repository on git.pseudorandom.co.uk. + +Known issues: + +* Needs code review +* The access control via postcomment() is rather strange +* There is some common code cargo-culted from other plugins (notably inline and editpage) which + should probably be shared +* If the postcomment directive is removed from a page, comments can still be made on that page, + and will be committed but not displayed; to disable comments properly you have to set the + closed="yes" directive parameter (and refresh the wiki), *then* remove the directive if + desired -- cgit v1.2.3 From e204a2c2027e3c593aae0c3e334634587e286e8d Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Mon, 17 Nov 2008 06:44:50 -0500 Subject: Fix tag directive --- doc/plugins/contrib/postcomment.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/postcomment.mdwn b/doc/plugins/contrib/postcomment.mdwn index 4d1db6c9b..9875feaae 100644 --- a/doc/plugins/contrib/postcomment.mdwn +++ b/doc/plugins/contrib/postcomment.mdwn @@ -1,5 +1,5 @@ [[!template id=plugin name=postcomment author="[[Simon_McVittie|smcv]]"]] -[[!tag type=useful]] +[[!tag type/useful]] This plugin adds "blog-style" comments. The intention is that on a non-wiki site (like a blog) you can lock all pages for admin-only access, then allow otherwise -- cgit v1.2.3 From c0f4735f1fb93b47f508c18c2f94cf24f147cea5 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 17 Nov 2008 14:09:53 -0500 Subject: adding htmlbalance; housekeeping Used the contrib version of the plugin page since it seemed better than the other one. --- debian/changelog | 6 ++++++ debian/control | 2 +- debian/copyright | 4 ++++ doc/plugins/contrib/htmlbalance.mdwn | 12 ------------ doc/plugins/htmlbalance.mdwn | 6 +++--- 5 files changed, 14 insertions(+), 16 deletions(-) delete mode 100644 doc/plugins/contrib/htmlbalance.mdwn (limited to 'doc/plugins') diff --git a/debian/changelog b/debian/changelog index dd19c1463..ef46370d6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +ikiwiki (2.71) UNRELEASED; urgency=low + + * htmlbalance: New plugin contributed by Simon McVittie. + + -- Joey Hess Mon, 17 Nov 2008 14:02:10 -0500 + ikiwiki (2.70) unstable; urgency=low * Avoid crash on malformed utf-8 discovered by intrigeri. diff --git a/debian/control b/debian/control index fdf2a3a36..fb85551de 100644 --- a/debian/control +++ b/debian/control @@ -14,7 +14,7 @@ Package: ikiwiki Architecture: all Depends: ${perl:Depends}, markdown | libtext-markdown-perl, libhtml-scrubber-perl, libhtml-template-perl, libhtml-parser-perl, liburi-perl Recommends: gcc | c-compiler, libc6-dev | libc-dev, subversion | git-core (>= 1:1.5.0) | tla | bzr (>= 0.91) | mercurial | monotone (>= 0.38), libxml-simple-perl, libnet-openid-consumer-perl, liblwpx-paranoidagent-perl, libtimedate-perl, libcgi-formbuilder-perl (>= 3.05), libcgi-session-perl (>= 4.14-1), libmail-sendmail-perl, libauthen-passphrase-perl -Suggests: viewvc | gitweb | viewcvs, libsearch-xapian-perl, xapian-omega (>= 1.0.5), librpc-xml-perl, libtext-wikiformat-perl, python, python-docutils, polygen, tidy, libxml-feed-perl, libmailtools-perl, perlmagick, libfile-mimeinfo-perl, libcrypt-ssleay-perl, liblocale-gettext-perl (>= 1.05-1), libtext-typography-perl, libtext-csv-perl, libdigest-sha1-perl, graphviz, libnet-amazon-s3-perl, sparkline-php, texlive, dvipng +Suggests: viewvc | gitweb | viewcvs, libsearch-xapian-perl, xapian-omega (>= 1.0.5), librpc-xml-perl, libtext-wikiformat-perl, python, python-docutils, polygen, tidy, libhtml-tree-perl, libxml-atom-perl, libxml-feed-perl, libmailtools-perl, perlmagick, libfile-mimeinfo-perl, libcrypt-ssleay-perl, liblocale-gettext-perl (>= 1.05-1), libtext-typography-perl, libtext-csv-perl, libdigest-sha1-perl, graphviz, libnet-amazon-s3-perl, sparkline-php, texlive, dvipng Conflicts: ikiwiki-plugin-table Replaces: ikiwiki-plugin-table Provides: ikiwiki-plugin-table diff --git a/debian/copyright b/debian/copyright index f257234dd..546836226 100644 --- a/debian/copyright +++ b/debian/copyright @@ -76,6 +76,10 @@ Files: htmltidy.pm Copyright: © 2006 Faidon Liambotis License: GPL-2+ +Files: htmlbalance.pm +Copyright: © 2008 Simon McVittie +License: GPL-2+ + Files: polygen.pm, pagestats.pm, cutpaste.pm Copyright: © 2006 Enrico Zini License: GPL-2+ diff --git a/doc/plugins/contrib/htmlbalance.mdwn b/doc/plugins/contrib/htmlbalance.mdwn deleted file mode 100644 index 728e6afc2..000000000 --- a/doc/plugins/contrib/htmlbalance.mdwn +++ /dev/null @@ -1,12 +0,0 @@ -[[!template id=plugin name=htmlbalance author="[[Simon_McVittie|smcv]]"]] -[[!tag type/html]] - -This plugin ensures that the HTML emitted by ikiwiki contains well-balanced -HTML tags, by parsing it with [[!cpan HTML::TreeBuilder]] and re-serializing it. This -acts as a lighter-weight alternative to [[plugins/htmltidy]]; it doesn't -ensure validity, but it does at least ensure that formatting from a -blog post pulled in by the [[ikiwiki/directive/inline]] directive doesn't -leak into the rest of the page. - -htmlbalance is available from the 'htmlbalance' branch in [[smcv]]'s git repository. -I'd like to get this plugin included in ikiwiki - any code review is welcome. diff --git a/doc/plugins/htmlbalance.mdwn b/doc/plugins/htmlbalance.mdwn index 7cdb1f950..f4e2298ee 100644 --- a/doc/plugins/htmlbalance.mdwn +++ b/doc/plugins/htmlbalance.mdwn @@ -1,9 +1,9 @@ -[[!template id=plugin name=htmlbalance author="Simon McVittie"]] +[[!template id=plugin name=htmlbalance author="[[Simon_McVittie|smcv]]"]] [[!tag type/html]] This plugin ensures that the HTML emitted by ikiwiki contains well-balanced -HTML tags, by parsing it with HTML::TreeBuilder and re-serializing it. This +HTML tags, by parsing it with [[!cpan HTML::TreeBuilder]] and re-serializing it. This acts as a lighter-weight alternative to [[plugins/htmltidy]]; it doesn't ensure validity, but it does at least ensure that formatting from a -blog post pulled in by \[[![[ikiwiki/directive/inline]]]] doesn't +blog post pulled in by the [[ikiwiki/directive/inline]] directive doesn't leak into the rest of the page. -- cgit v1.2.3 From 87f360dee4673eda5e54dfb9aaf41d0de6daa422 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 17 Nov 2008 14:10:25 -0500 Subject: thoughts --- doc/plugins/htmlbalance/discussion.mdwn | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 doc/plugins/htmlbalance/discussion.mdwn (limited to 'doc/plugins') diff --git a/doc/plugins/htmlbalance/discussion.mdwn b/doc/plugins/htmlbalance/discussion.mdwn new file mode 100644 index 000000000..bad052f1c --- /dev/null +++ b/doc/plugins/htmlbalance/discussion.mdwn @@ -0,0 +1,8 @@ +Would it be possible to use [[!cpan HTML::Entities]] rather than +`XML::Atom::Util` for encoding entities? The former is already an ikiwiki +dependency (via [[!cpan HTML::Parser]]). + +I also wonder if there's any benefit to using this plugin aside from with +aggregate. Perhaps a small one but aggregate seems like the main case.. +wondering if it would be better to just have aggregate balanace the html +automatically and do away with the separate plugin. --[[Joey]] -- cgit v1.2.3 From 181bdbe1a9a8a1eb07259466361d98bdc1378499 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 17 Nov 2008 14:27:11 -0500 Subject: use HTML::Entities --- IkiWiki/Plugin/htmlbalance.pm | 4 ++-- doc/plugins/htmlbalance/discussion.mdwn | 2 ++ t/htmlbalance.t | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'doc/plugins') diff --git a/IkiWiki/Plugin/htmlbalance.pm b/IkiWiki/Plugin/htmlbalance.pm index 8f43d5dac..3a2d62d15 100644 --- a/IkiWiki/Plugin/htmlbalance.pm +++ b/IkiWiki/Plugin/htmlbalance.pm @@ -11,7 +11,7 @@ use warnings; use strict; use IkiWiki 2.00; use HTML::TreeBuilder; -use XML::Atom::Util qw(encode_xml); +use HTML::Entities; sub import { #{{{ hook(type => "getsetup", id => "htmlbalance", call => \&getsetup); @@ -39,7 +39,7 @@ sub sanitize (@) { #{{{ $node->delete(); } else { - $ret .= encode_xml($node); + $ret .= encode_entities($node); } } $tree->delete(); diff --git a/doc/plugins/htmlbalance/discussion.mdwn b/doc/plugins/htmlbalance/discussion.mdwn index bad052f1c..c66528a4f 100644 --- a/doc/plugins/htmlbalance/discussion.mdwn +++ b/doc/plugins/htmlbalance/discussion.mdwn @@ -2,6 +2,8 @@ Would it be possible to use [[!cpan HTML::Entities]] rather than `XML::Atom::Util` for encoding entities? The former is already an ikiwiki dependency (via [[!cpan HTML::Parser]]). +> Now switched to HTML::Entities --[[Joey]] + I also wonder if there's any benefit to using this plugin aside from with aggregate. Perhaps a small one but aggregate seems like the main case.. wondering if it would be better to just have aggregate balanace the html diff --git a/t/htmlbalance.t b/t/htmlbalance.t index 783ed9841..e5a5db0ee 100755 --- a/t/htmlbalance.t +++ b/t/htmlbalance.t @@ -5,10 +5,9 @@ use strict; BEGIN { eval q{ use HTML::TreeBuilder; - use XML::Atom::Util qw(encode_xml); }; if ($@) { - eval q{use Test::More skip_all => "HTML::TreeBuilder or XML::Atom::Util not available"}; + eval q{use Test::More skip_all => "HTML::TreeBuilder not available"}; } else { eval q{use Test::More tests => 7}; -- cgit v1.2.3 From 2e8c0bce31ed5b447c031addc00f6a0c28dbc2e1 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 17 Nov 2008 15:00:33 -0500 Subject: initial comments Done inline on the page, `scuse. --- doc/plugins/contrib/postcomment.mdwn | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/postcomment.mdwn b/doc/plugins/contrib/postcomment.mdwn index 9875feaae..9934baa95 100644 --- a/doc/plugins/contrib/postcomment.mdwn +++ b/doc/plugins/contrib/postcomment.mdwn @@ -7,14 +7,29 @@ unprivileged (or perhaps even anonymous) users to comment on posts. Comments are saved as internal pages, so they can never be edited through the CGI, only by direct committers. Currently, comments are always in [[ikiwiki/markdown]]. + +> So, why do it this way, instead of using regular wiki pages in a +> namespace, such as `$page/comments/*`? Then you could use [[plugins/lockedit]] to +> limit editing of comments in more powerful ways. --[[Joey]] + Directives and raw HTML are filtered out by default, and comment authorship should hopefully be unforgeable by CGI users. +> I'm not sure that raw html should be a problem, as long as the +> htmlsanitizer and htmlbalanced plugins are enabled. I can see filtering +> out directives, as a special case. --[[Joey]] + When comments have been enabled generally, you still need to mark which pages can have comments, by including the `\[[!postcomment]]` directive in them. By default, this directive expands to a "post a comment" link plus an `\[[!inline]]` with the comments. +> I don't like this, because it's hard to explain to someone why they have +> to insert this into every post to their blog. Seems that the model used +> for discussion pages could work -- if comments are enabled, automatically +> add the comment posting form and comments to the end of each page. +> --[[Joey]] + The plugin adds a new [[ikiwiki/PageSpec]] match type, `postcomment`, for use with `anonok_pagespec` from the [[plugins/anonok]] plugin or `locked_pages` from the [[plugins/lockedit]] plugin. Typical usage would be something like: @@ -53,3 +68,6 @@ Known issues: and will be committed but not displayed; to disable comments properly you have to set the closed="yes" directive parameter (and refresh the wiki), *then* remove the directive if desired + +> I haven't done a detailed code review, but I will say I'm pleased you +> avoided re-implementing inline! --[[Joey]] -- cgit v1.2.3 From 2953b9d850718f2b27badc5d204b930fa23872cc Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Tue, 18 Nov 2008 04:15:58 -0500 Subject: response --- doc/plugins/contrib/postcomment.mdwn | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/postcomment.mdwn b/doc/plugins/contrib/postcomment.mdwn index 9934baa95..2e501995f 100644 --- a/doc/plugins/contrib/postcomment.mdwn +++ b/doc/plugins/contrib/postcomment.mdwn @@ -12,6 +12,19 @@ only by direct committers. Currently, comments are always in [[ikiwiki/markdown] > namespace, such as `$page/comments/*`? Then you could use [[plugins/lockedit]] to > limit editing of comments in more powerful ways. --[[Joey]] +>> Er... I suppose so. I'd assumed that these pages ought to only exist as inlines +>> rather than as individual pages (same reasoning as aggregated posts), though. +>> +>> lockedit is actually somewhat insufficient, since `check_canedit()` +>> doesn't distinguish between creation and editing; I'd have to continue to use +>> some sort of odd hack to allow creation but not editing. +>> +>> I also can't think of any circumstance where you'd want a user other than +>> admins (~= git committers) and possibly the commenter (who we can't check for +>> at the moment anyway, I don't think?) to be able to edit comments - I think +>> user expectations for something that looks like ordinary blog comments are +>> likely to include "others can't put words into my mouth". --[[smcv]] + Directives and raw HTML are filtered out by default, and comment authorship should hopefully be unforgeable by CGI users. @@ -19,6 +32,13 @@ hopefully be unforgeable by CGI users. > htmlsanitizer and htmlbalanced plugins are enabled. I can see filtering > out directives, as a special case. --[[Joey]] +>> Right, if I sanitize each post individually, with htmlscrubber and either htmltidy +>> or htmlbalance turned on, then there should be no way the user can forge a comment; +>> I was initially wary of allowing meta directives, but I think those are OK, as long +>> as the comment template puts the \[[!meta author]] at the *end*. Disallowing +>> directives is more a way to avoid commenters causing expensive processing than +>> anything else, at this point. --[[smcv]] + When comments have been enabled generally, you still need to mark which pages can have comments, by including the `\[[!postcomment]]` directive in them. By default, this directive expands to a "post a comment" link plus an `\[[!inline]]` with @@ -30,6 +50,16 @@ the comments. > add the comment posting form and comments to the end of each page. > --[[Joey]] +>> I don't think I'd want comments on *every* page (particularly, not the +>> front page). Perhaps a pagespec in the setup file, where the default is "*"? +>> Then control freaks like me could use "link(tags/comments)" and tag pages +>> as allowing comments. +>> +>> The model used for discussion pages does require patching the existing +>> page template, which I was trying to avoid - I'm not convinced that having +>> every possible feature hard-coded there really scales (and obviously it's +>> rather annoying while this plugin is on a branch). --[[smcv]] + The plugin adds a new [[ikiwiki/PageSpec]] match type, `postcomment`, for use with `anonok_pagespec` from the [[plugins/anonok]] plugin or `locked_pages` from the [[plugins/lockedit]] plugin. Typical usage would be something like: -- cgit v1.2.3 From 75a333539929f12b465071f9203f58f2eacd5f3f Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Tue, 18 Nov 2008 05:12:44 -0500 Subject: rename plugins/contrib/postcomment.mdwn to plugins/contrib/comments.mdwn --- doc/plugins/contrib/comments.mdwn | 103 +++++++++++++++++++++++++++++++++++ doc/plugins/contrib/postcomment.mdwn | 103 ----------------------------------- 2 files changed, 103 insertions(+), 103 deletions(-) create mode 100644 doc/plugins/contrib/comments.mdwn delete mode 100644 doc/plugins/contrib/postcomment.mdwn (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/comments.mdwn b/doc/plugins/contrib/comments.mdwn new file mode 100644 index 000000000..2e501995f --- /dev/null +++ b/doc/plugins/contrib/comments.mdwn @@ -0,0 +1,103 @@ +[[!template id=plugin name=postcomment author="[[Simon_McVittie|smcv]]"]] +[[!tag type/useful]] + +This plugin adds "blog-style" comments. The intention is that on a non-wiki site +(like a blog) you can lock all pages for admin-only access, then allow otherwise +unprivileged (or perhaps even anonymous) users to comment on posts. + +Comments are saved as internal pages, so they can never be edited through the CGI, +only by direct committers. Currently, comments are always in [[ikiwiki/markdown]]. + +> So, why do it this way, instead of using regular wiki pages in a +> namespace, such as `$page/comments/*`? Then you could use [[plugins/lockedit]] to +> limit editing of comments in more powerful ways. --[[Joey]] + +>> Er... I suppose so. I'd assumed that these pages ought to only exist as inlines +>> rather than as individual pages (same reasoning as aggregated posts), though. +>> +>> lockedit is actually somewhat insufficient, since `check_canedit()` +>> doesn't distinguish between creation and editing; I'd have to continue to use +>> some sort of odd hack to allow creation but not editing. +>> +>> I also can't think of any circumstance where you'd want a user other than +>> admins (~= git committers) and possibly the commenter (who we can't check for +>> at the moment anyway, I don't think?) to be able to edit comments - I think +>> user expectations for something that looks like ordinary blog comments are +>> likely to include "others can't put words into my mouth". --[[smcv]] + +Directives and raw HTML are filtered out by default, and comment authorship should +hopefully be unforgeable by CGI users. + +> I'm not sure that raw html should be a problem, as long as the +> htmlsanitizer and htmlbalanced plugins are enabled. I can see filtering +> out directives, as a special case. --[[Joey]] + +>> Right, if I sanitize each post individually, with htmlscrubber and either htmltidy +>> or htmlbalance turned on, then there should be no way the user can forge a comment; +>> I was initially wary of allowing meta directives, but I think those are OK, as long +>> as the comment template puts the \[[!meta author]] at the *end*. Disallowing +>> directives is more a way to avoid commenters causing expensive processing than +>> anything else, at this point. --[[smcv]] + +When comments have been enabled generally, you still need to mark which pages +can have comments, by including the `\[[!postcomment]]` directive in them. By default, +this directive expands to a "post a comment" link plus an `\[[!inline]]` with +the comments. + +> I don't like this, because it's hard to explain to someone why they have +> to insert this into every post to their blog. Seems that the model used +> for discussion pages could work -- if comments are enabled, automatically +> add the comment posting form and comments to the end of each page. +> --[[Joey]] + +>> I don't think I'd want comments on *every* page (particularly, not the +>> front page). Perhaps a pagespec in the setup file, where the default is "*"? +>> Then control freaks like me could use "link(tags/comments)" and tag pages +>> as allowing comments. +>> +>> The model used for discussion pages does require patching the existing +>> page template, which I was trying to avoid - I'm not convinced that having +>> every possible feature hard-coded there really scales (and obviously it's +>> rather annoying while this plugin is on a branch). --[[smcv]] + +The plugin adds a new [[ikiwiki/PageSpec]] match type, `postcomment`, for use +with `anonok_pagespec` from the [[plugins/anonok]] plugin or `locked_pages` from +the [[plugins/lockedit]] plugin. Typical usage would be something like: + + locked_pages => "!postcomment(*)" + +to allow non-admin users to comment on pages, but not edit anything. You can also do + + anonok_pages => "postcomment(*)" + +to allow anonymous comments (the IP address will be used as the "author"). + +Optional parameters to the postcomment directive: + +* `commit=no`: by default, comments are committed to version control. Use this to + disable commits. +* `allowhtml=yes`: by default, raw HTML is filtered out. Use this to allow HTML + (you should enable [[plugins/htmlscrubber]] and either [[plugins/htmltidy]] or + [[plugins/contrib/htmlbalance]] if you do this). +* `allowdirectives=yes`: by default, IkiWiki directives are filtered out. Use this + to allow directives (avoid enabling any [[plugins/type/slow]] directives if you + do this). +* `closed=yes`: use this to prevent new comments while still displaying existing ones. +* `atom`, `rss`, `feeds`, `feedshow`, `timeformat`, `feedonly`: the same as for [[plugins/inline]] + +This plugin aims to close the [[todo]] item "[[todo/supporting_comments_via_disussion_pages]]", +and is currently available from [[smcv]]'s git repository on git.pseudorandom.co.uk. + +Known issues: + +* Needs code review +* The access control via postcomment() is rather strange +* There is some common code cargo-culted from other plugins (notably inline and editpage) which + should probably be shared +* If the postcomment directive is removed from a page, comments can still be made on that page, + and will be committed but not displayed; to disable comments properly you have to set the + closed="yes" directive parameter (and refresh the wiki), *then* remove the directive if + desired + +> I haven't done a detailed code review, but I will say I'm pleased you +> avoided re-implementing inline! --[[Joey]] diff --git a/doc/plugins/contrib/postcomment.mdwn b/doc/plugins/contrib/postcomment.mdwn deleted file mode 100644 index 2e501995f..000000000 --- a/doc/plugins/contrib/postcomment.mdwn +++ /dev/null @@ -1,103 +0,0 @@ -[[!template id=plugin name=postcomment author="[[Simon_McVittie|smcv]]"]] -[[!tag type/useful]] - -This plugin adds "blog-style" comments. The intention is that on a non-wiki site -(like a blog) you can lock all pages for admin-only access, then allow otherwise -unprivileged (or perhaps even anonymous) users to comment on posts. - -Comments are saved as internal pages, so they can never be edited through the CGI, -only by direct committers. Currently, comments are always in [[ikiwiki/markdown]]. - -> So, why do it this way, instead of using regular wiki pages in a -> namespace, such as `$page/comments/*`? Then you could use [[plugins/lockedit]] to -> limit editing of comments in more powerful ways. --[[Joey]] - ->> Er... I suppose so. I'd assumed that these pages ought to only exist as inlines ->> rather than as individual pages (same reasoning as aggregated posts), though. ->> ->> lockedit is actually somewhat insufficient, since `check_canedit()` ->> doesn't distinguish between creation and editing; I'd have to continue to use ->> some sort of odd hack to allow creation but not editing. ->> ->> I also can't think of any circumstance where you'd want a user other than ->> admins (~= git committers) and possibly the commenter (who we can't check for ->> at the moment anyway, I don't think?) to be able to edit comments - I think ->> user expectations for something that looks like ordinary blog comments are ->> likely to include "others can't put words into my mouth". --[[smcv]] - -Directives and raw HTML are filtered out by default, and comment authorship should -hopefully be unforgeable by CGI users. - -> I'm not sure that raw html should be a problem, as long as the -> htmlsanitizer and htmlbalanced plugins are enabled. I can see filtering -> out directives, as a special case. --[[Joey]] - ->> Right, if I sanitize each post individually, with htmlscrubber and either htmltidy ->> or htmlbalance turned on, then there should be no way the user can forge a comment; ->> I was initially wary of allowing meta directives, but I think those are OK, as long ->> as the comment template puts the \[[!meta author]] at the *end*. Disallowing ->> directives is more a way to avoid commenters causing expensive processing than ->> anything else, at this point. --[[smcv]] - -When comments have been enabled generally, you still need to mark which pages -can have comments, by including the `\[[!postcomment]]` directive in them. By default, -this directive expands to a "post a comment" link plus an `\[[!inline]]` with -the comments. - -> I don't like this, because it's hard to explain to someone why they have -> to insert this into every post to their blog. Seems that the model used -> for discussion pages could work -- if comments are enabled, automatically -> add the comment posting form and comments to the end of each page. -> --[[Joey]] - ->> I don't think I'd want comments on *every* page (particularly, not the ->> front page). Perhaps a pagespec in the setup file, where the default is "*"? ->> Then control freaks like me could use "link(tags/comments)" and tag pages ->> as allowing comments. ->> ->> The model used for discussion pages does require patching the existing ->> page template, which I was trying to avoid - I'm not convinced that having ->> every possible feature hard-coded there really scales (and obviously it's ->> rather annoying while this plugin is on a branch). --[[smcv]] - -The plugin adds a new [[ikiwiki/PageSpec]] match type, `postcomment`, for use -with `anonok_pagespec` from the [[plugins/anonok]] plugin or `locked_pages` from -the [[plugins/lockedit]] plugin. Typical usage would be something like: - - locked_pages => "!postcomment(*)" - -to allow non-admin users to comment on pages, but not edit anything. You can also do - - anonok_pages => "postcomment(*)" - -to allow anonymous comments (the IP address will be used as the "author"). - -Optional parameters to the postcomment directive: - -* `commit=no`: by default, comments are committed to version control. Use this to - disable commits. -* `allowhtml=yes`: by default, raw HTML is filtered out. Use this to allow HTML - (you should enable [[plugins/htmlscrubber]] and either [[plugins/htmltidy]] or - [[plugins/contrib/htmlbalance]] if you do this). -* `allowdirectives=yes`: by default, IkiWiki directives are filtered out. Use this - to allow directives (avoid enabling any [[plugins/type/slow]] directives if you - do this). -* `closed=yes`: use this to prevent new comments while still displaying existing ones. -* `atom`, `rss`, `feeds`, `feedshow`, `timeformat`, `feedonly`: the same as for [[plugins/inline]] - -This plugin aims to close the [[todo]] item "[[todo/supporting_comments_via_disussion_pages]]", -and is currently available from [[smcv]]'s git repository on git.pseudorandom.co.uk. - -Known issues: - -* Needs code review -* The access control via postcomment() is rather strange -* There is some common code cargo-culted from other plugins (notably inline and editpage) which - should probably be shared -* If the postcomment directive is removed from a page, comments can still be made on that page, - and will be committed but not displayed; to disable comments properly you have to set the - closed="yes" directive parameter (and refresh the wiki), *then* remove the directive if - desired - -> I haven't done a detailed code review, but I will say I'm pleased you -> avoided re-implementing inline! --[[Joey]] -- cgit v1.2.3 From bd14203c0b8ca9b736a73e70440c4ee3b571618f Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Tue, 18 Nov 2008 05:37:36 -0500 Subject: update --- doc/plugins/contrib/comments.mdwn | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/comments.mdwn b/doc/plugins/contrib/comments.mdwn index 2e501995f..3e6dcfd76 100644 --- a/doc/plugins/contrib/comments.mdwn +++ b/doc/plugins/contrib/comments.mdwn @@ -1,4 +1,4 @@ -[[!template id=plugin name=postcomment author="[[Simon_McVittie|smcv]]"]] +[[!template id=plugin name=comments author="[[Simon_McVittie|smcv]]"]] [[!tag type/useful]] This plugin adds "blog-style" comments. The intention is that on a non-wiki site @@ -23,7 +23,12 @@ only by direct committers. Currently, comments are always in [[ikiwiki/markdown] >> admins (~= git committers) and possibly the commenter (who we can't check for >> at the moment anyway, I don't think?) to be able to edit comments - I think >> user expectations for something that looks like ordinary blog comments are ->> likely to include "others can't put words into my mouth". --[[smcv]] +>> likely to include "others can't put words into my mouth". +>> +>> My other objection to using a namespace is that I'm not particularly happy about +>> plugins consuming arbitrary pieces of the wiki namespace - /discussion is bad +>> enough already. Indeed, this very page would accidentally get matched by rules +>> aiming to control comment-posting... :-) --[[smcv]] Directives and raw HTML are filtered out by default, and comment authorship should hopefully be unforgeable by CGI users. @@ -37,10 +42,14 @@ hopefully be unforgeable by CGI users. >> I was initially wary of allowing meta directives, but I think those are OK, as long >> as the comment template puts the \[[!meta author]] at the *end*. Disallowing >> directives is more a way to avoid commenters causing expensive processing than ->> anything else, at this point. --[[smcv]] +>> anything else, at this point. +>> +>> I've rebased the plugin on master and made it sanitize individual posts' content now. +>> Disallowing HTML is still optional and on by default, but it's trivial to remove +>> the code. --[[smcv]] When comments have been enabled generally, you still need to mark which pages -can have comments, by including the `\[[!postcomment]]` directive in them. By default, +can have comments, by including the `\[[!comments]]` directive in them. By default, this directive expands to a "post a comment" link plus an `\[[!inline]]` with the comments. @@ -72,7 +81,10 @@ to allow non-admin users to comment on pages, but not edit anything. You can als to allow anonymous comments (the IP address will be used as the "author"). -Optional parameters to the postcomment directive: +> This is still called postcomment, although I've renamed the rest of the plugin +> to comments as suggested on #ikiwiki --[[smcv]] + +Optional parameters to the comments directive: * `commit=no`: by default, comments are committed to version control. Use this to disable commits. @@ -86,7 +98,8 @@ Optional parameters to the postcomment directive: * `atom`, `rss`, `feeds`, `feedshow`, `timeformat`, `feedonly`: the same as for [[plugins/inline]] This plugin aims to close the [[todo]] item "[[todo/supporting_comments_via_disussion_pages]]", -and is currently available from [[smcv]]'s git repository on git.pseudorandom.co.uk. +and is currently available from [[smcv]]'s git repository on git.pseudorandom.co.uk (it's the +`postcomment` branch). Known issues: @@ -94,7 +107,7 @@ Known issues: * The access control via postcomment() is rather strange * There is some common code cargo-culted from other plugins (notably inline and editpage) which should probably be shared -* If the postcomment directive is removed from a page, comments can still be made on that page, +* If the comments directive is removed from a page, comments can still be made on that page, and will be committed but not displayed; to disable comments properly you have to set the closed="yes" directive parameter (and refresh the wiki), *then* remove the directive if desired -- cgit v1.2.3 From c66a3f9ca7bc3ae827e9cfe19ee0aef728218d0e Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Tue, 18 Nov 2008 05:40:23 -0500 Subject: Fix link to htmlbalance --- doc/plugins/contrib/comments.mdwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/comments.mdwn b/doc/plugins/contrib/comments.mdwn index 3e6dcfd76..6e6202993 100644 --- a/doc/plugins/contrib/comments.mdwn +++ b/doc/plugins/contrib/comments.mdwn @@ -89,8 +89,8 @@ Optional parameters to the comments directive: * `commit=no`: by default, comments are committed to version control. Use this to disable commits. * `allowhtml=yes`: by default, raw HTML is filtered out. Use this to allow HTML - (you should enable [[plugins/htmlscrubber]] and either [[plugins/htmltidy]] or - [[plugins/contrib/htmlbalance]] if you do this). + (you should enable [[htmlscrubber]] and either [[htmltidy]] or + [[htmlbalance]] if you do this). * `allowdirectives=yes`: by default, IkiWiki directives are filtered out. Use this to allow directives (avoid enabling any [[plugins/type/slow]] directives if you do this). -- cgit v1.2.3 From c5a7d98b54623cf501bd2cd6c188641c406318ff Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Tue, 18 Nov 2008 06:14:08 -0500 Subject: Raw HTML now allowed, joeyh convinced me :-) --- doc/plugins/contrib/comments.mdwn | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/comments.mdwn b/doc/plugins/contrib/comments.mdwn index 6e6202993..6ba181232 100644 --- a/doc/plugins/contrib/comments.mdwn +++ b/doc/plugins/contrib/comments.mdwn @@ -30,8 +30,10 @@ only by direct committers. Currently, comments are always in [[ikiwiki/markdown] >> enough already. Indeed, this very page would accidentally get matched by rules >> aiming to control comment-posting... :-) --[[smcv]] -Directives and raw HTML are filtered out by default, and comment authorship should -hopefully be unforgeable by CGI users. +When using this plugin, you should also enable [[htmlscrubber]] and either [[htmltidy]] +or [[htmlbalance]]. Directives are filtered out by default, to avoid commenters slowing +down the wiki by causing time-consuming processing. As long as the recommended plugins +are enabled, comment authorship should hopefully be unforgeable by CGI users. > I'm not sure that raw html should be a problem, as long as the > htmlsanitizer and htmlbalanced plugins are enabled. I can see filtering @@ -44,9 +46,8 @@ hopefully be unforgeable by CGI users. >> directives is more a way to avoid commenters causing expensive processing than >> anything else, at this point. >> ->> I've rebased the plugin on master and made it sanitize individual posts' content now. ->> Disallowing HTML is still optional and on by default, but it's trivial to remove ->> the code. --[[smcv]] +>> I've rebased the plugin on master, made it sanitize individual posts' content +>> and removed the option to disallow raw HTML. --[[smcv]] When comments have been enabled generally, you still need to mark which pages can have comments, by including the `\[[!comments]]` directive in them. By default, @@ -88,9 +89,6 @@ Optional parameters to the comments directive: * `commit=no`: by default, comments are committed to version control. Use this to disable commits. -* `allowhtml=yes`: by default, raw HTML is filtered out. Use this to allow HTML - (you should enable [[htmlscrubber]] and either [[htmltidy]] or - [[htmlbalance]] if you do this). * `allowdirectives=yes`: by default, IkiWiki directives are filtered out. Use this to allow directives (avoid enabling any [[plugins/type/slow]] directives if you do this). -- cgit v1.2.3 From 28ffff103045a75b984a6cb8aa6958c736cc8cb4 Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Tue, 18 Nov 2008 07:07:25 -0500 Subject: --- doc/plugins/contrib/comments.mdwn | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/comments.mdwn b/doc/plugins/contrib/comments.mdwn index 6ba181232..d56de4466 100644 --- a/doc/plugins/contrib/comments.mdwn +++ b/doc/plugins/contrib/comments.mdwn @@ -97,7 +97,8 @@ Optional parameters to the comments directive: This plugin aims to close the [[todo]] item "[[todo/supporting_comments_via_disussion_pages]]", and is currently available from [[smcv]]'s git repository on git.pseudorandom.co.uk (it's the -`postcomment` branch). +`postcomment` branch). A demo wiki with the plugin enabled is running at +. Known issues: -- cgit v1.2.3 From 9b1be757ddb2f1982cb0ca89bff11a78d76faa00 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 18 Nov 2008 14:03:44 -0500 Subject: responses --- doc/plugins/contrib/comments.mdwn | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/comments.mdwn b/doc/plugins/contrib/comments.mdwn index d56de4466..41bfa0004 100644 --- a/doc/plugins/contrib/comments.mdwn +++ b/doc/plugins/contrib/comments.mdwn @@ -30,6 +30,11 @@ only by direct committers. Currently, comments are always in [[ikiwiki/markdown] >> enough already. Indeed, this very page would accidentally get matched by rules >> aiming to control comment-posting... :-) --[[smcv]] +>> The best reason to keep the pages internal seems to me to be that you +>> don't want the overhead of every comment spawning its own wiki page. +>> The worst problem with it though is that you have to assume the pages +>> are mdwn (or `default_pageext`) and not support other formats. --[[Joey]] + When using this plugin, you should also enable [[htmlscrubber]] and either [[htmltidy]] or [[htmlbalance]]. Directives are filtered out by default, to avoid commenters slowing down the wiki by causing time-consuming processing. As long as the recommended plugins @@ -49,6 +54,16 @@ are enabled, comment authorship should hopefully be unforgeable by CGI users. >> I've rebased the plugin on master, made it sanitize individual posts' content >> and removed the option to disallow raw HTML. --[[smcv]] +>> There might be some use cases for other directives, such as img, in +>> comments. +>> +>> I don't know if meta is "safe" (ie, guaranteed to be inexpensive and not +>> allow users to do annoying things) or if it will continue to be in the +>> future. Hard to predict really, all that can be said with certainty is +>> 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]] + When comments have been enabled generally, you still need to mark which pages can have comments, by including the `\[[!comments]]` directive in them. By default, this directive expands to a "post a comment" link plus an `\[[!inline]]` with @@ -65,11 +80,16 @@ the comments. >> Then control freaks like me could use "link(tags/comments)" and tag pages >> as allowing comments. >> +>>> Yes, I think a pagespec is the way to go. --[[Joey]] +>> >> The model used for discussion pages does require patching the existing >> page template, which I was trying to avoid - I'm not convinced that having >> every possible feature hard-coded there really scales (and obviously it's >> rather annoying while this plugin is on a branch). --[[smcv]] +>>> Using the template would allow customising the html around the comments +>>> which seems like a good thing? + The plugin adds a new [[ikiwiki/PageSpec]] match type, `postcomment`, for use with `anonok_pagespec` from the [[plugins/anonok]] plugin or `locked_pages` from the [[plugins/lockedit]] plugin. Typical usage would be something like: -- cgit v1.2.3 From 23f5874a56f66c0bb5d5921d21418c7363786b1b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 18 Nov 2008 14:12:52 -0500 Subject: another thought --- doc/plugins/contrib/comments.mdwn | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/comments.mdwn b/doc/plugins/contrib/comments.mdwn index 41bfa0004..0957e74fa 100644 --- a/doc/plugins/contrib/comments.mdwn +++ b/doc/plugins/contrib/comments.mdwn @@ -33,7 +33,13 @@ only by direct committers. Currently, comments are always in [[ikiwiki/markdown] >> The best reason to keep the pages internal seems to me to be that you >> don't want the overhead of every comment spawning its own wiki page. >> The worst problem with it though is that you have to assume the pages ->> are mdwn (or `default_pageext`) and not support other formats. --[[Joey]] +>> are mdwn (or `default_pageext`) and not support other formats. + +>> By the way, I think that who can post comments should be controllable by +>> the existing plugins opendiscussion, anonok, signinedit, and lockedit. Allowing +>> posting comments w/o any login, while a nice capability, can lead to +>> spam problems. So, use `check_canedit` as at least a first-level check? +>> --[[Joey]] When using this plugin, you should also enable [[htmlscrubber]] and either [[htmltidy]] or [[htmlbalance]]. Directives are filtered out by default, to avoid commenters slowing -- cgit v1.2.3 From 1ecb72160b1bb6bfa37c7417e398871a381e8771 Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Wed, 19 Nov 2008 05:30:27 -0500 Subject: respond to joey, some more suggestions --- doc/plugins/contrib/comments.mdwn | 71 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 3 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/comments.mdwn b/doc/plugins/contrib/comments.mdwn index 0957e74fa..89566d051 100644 --- a/doc/plugins/contrib/comments.mdwn +++ b/doc/plugins/contrib/comments.mdwn @@ -30,10 +30,34 @@ only by direct committers. Currently, comments are always in [[ikiwiki/markdown] >> enough already. Indeed, this very page would accidentally get matched by rules >> aiming to control comment-posting... :-) --[[smcv]] +>> Thinking about it, perhaps one way to address this would be to have the suffix +>> (e.g. whether commenting on Sandbox creates sandbox/comment1 or sandbox/c1 or +>> what) be configurable by the wiki admin, in the same way that recentchanges has +>> recentchangespage => 'recentchanges'? I'd like to see fewer hard-coded page +>> names in general, really - it seems odd to me that shortcuts and smileys +>> hard-code the name of the page to look at. Perhaps I could add +>> discussionpage => 'discussion' too? --[[smcv]] + >> The best reason to keep the pages internal seems to me to be that you >> don't want the overhead of every comment spawning its own wiki page. >> The worst problem with it though is that you have to assume the pages ->> are mdwn (or `default_pageext`) and not support other formats. +>> are mdwn (or `default_pageext`) and not support other formats. --[[Joey]] + +>> Well, you could always have `comment1._mdwn`, `comment2._creole` etc. and +>> alter the htmlize logic so that the `mdwn` hook is called for both `mdwn` +>> and `_mdwn` (assuming this is not already the case). I'm not convinced +>> that multi-format comments are a killer feature, though - part of the point +>> of this plugin, in my mind, is that it's less flexible than the full power +>> of ikiwiki and gives users fewer options. This could be construed +>> to be a feature, for people who don't care how flexible the technology is +>> and just want a simple way to leave a comment. The FormattingHelp page +>> assumes you're writing 100% Markdown in any case... +>> +>> Internal pages do too many things, perhaps: they suppress generation of +>> HTML pages, they disable editing over the web, and they have a different +>> namespace of htmlize hooks. I think the first two of those are useful +>> for this plugin, and the last is harmless; you seem to think the first +>> is useful, and the other two are harmful. --[[smcv]] >> By the way, I think that who can post comments should be controllable by >> the existing plugins opendiscussion, anonok, signinedit, and lockedit. Allowing @@ -41,6 +65,29 @@ only by direct committers. Currently, comments are always in [[ikiwiki/markdown] >> spam problems. So, use `check_canedit` as at least a first-level check? >> --[[Joey]] +>> This plugin already uses `check_canedit`, but that function doesn't have a concept +>> of different actions. The hack I use is that when a user comments on, say, sandbox, +>> I call `check_canedit` for the pseudo-page "sandbox[postcomment]". The +>> special `postcomment(glob)` [[ikiwiki/pagespec]] returns true if the page ends with +>> "[postcomment]" and the part before (e.g. sandbox) matches the glob. So, you can +>> have postcomment(blog/*) or something. (Perhaps instead of taking a glob, postcomment +>> should take a pagespec, so you can have postcomment(link(tags/commentable))?) +>> +>> This is why `anonok_pages => 'postcomment(*)'` and `locked_pages => '!postcomment(*)'` +>> are necessary to allow anonymous and logged-in editing (respectively). +>> +>> This is ugly - one alternative would be to add `check_permission()` that takes a +>> page and a verb (create, edit, rename, remove and maybe comment are the ones I +>> can think of so far), use that, and port the plugins you mentioned to use that +>> API too. This plugin could either call `check_can("$page/comment1", 'create')` or +>> call `check_can($page, 'comment')`. +>> +>> One odd effect of the code structure I've used is that we check for the ability to +>> create the page before we actually know what page name we're going to use - when +>> posting the comment I just increment a number until I reach an unused one - so +>> either the code needs restructuring, or the permission check for 'create' would +>> always be for 'comment1' and never 'comment123'. --[[smcv]] + When using this plugin, you should also enable [[htmlscrubber]] and either [[htmltidy]] or [[htmlbalance]]. Directives are filtered out by default, to avoid commenters slowing down the wiki by causing time-consuming processing. As long as the recommended plugins @@ -58,7 +105,10 @@ are enabled, comment authorship should hopefully be unforgeable by CGI users. >> anything else, at this point. >> >> I've rebased the plugin on master, made it sanitize individual posts' content ->> and removed the option to disallow raw HTML. --[[smcv]] +>> and removed the option to disallow raw HTML. Sanitizing individual posts before +>> they've been htmlized required me to preserve whitespace in the htmlbalance +>> plugin, so I did that. Alternatively, we could htmlize immediately and always +>> save out raw HTML? --[[smcv]] >> There might be some use cases for other directives, such as img, in >> comments. @@ -94,7 +144,20 @@ the comments. >> rather annoying while this plugin is on a branch). --[[smcv]] >>> Using the template would allow customising the html around the comments ->>> which seems like a good thing? +>>> which seems like a good thing? --[[Joey]] + +>>> The \[[!comments]] directive is already template-friendly - it expands to +>>> the contents of the template `comments_embed.tmpl`, possibly with the +>>> result of an \[[!inline]] appended. I should change `comments_embed.tmpl` +>>> so it uses a template variable `INLINE` for the inline result rather than +>>> having the perl code concatenate it, which would allow a bit more +>>> customization (whether the "post" link was before or after the inline). +>>> Even if you want comments in page.tmpl, keeping the separate comments_embed.tmpl +>>> and having a `COMMENTS` variable in page.tmpl might be the way forward, +>>> since the smaller each templates is, the easier it will be for users +>>> to maintain a patched set of templates. (I think so, anyway, based on what happens +>>> with dpkg prompts in Debian packages with monolithic vs split +>>> conffiles.) --[[smcv]] The plugin adds a new [[ikiwiki/PageSpec]] match type, `postcomment`, for use with `anonok_pagespec` from the [[plugins/anonok]] plugin or `locked_pages` from @@ -121,6 +184,8 @@ Optional parameters to the comments directive: * `closed=yes`: use this to prevent new comments while still displaying existing ones. * `atom`, `rss`, `feeds`, `feedshow`, `timeformat`, `feedonly`: the same as for [[plugins/inline]] +>> I don't think feedonly actually makes sense here, so I'll remove it. --[[smcv]] + This plugin aims to close the [[todo]] item "[[todo/supporting_comments_via_disussion_pages]]", and is currently available from [[smcv]]'s git repository on git.pseudorandom.co.uk (it's the `postcomment` branch). A demo wiki with the plugin enabled is running at -- cgit v1.2.3 From 4dc7143b5a020dcc881ea595ac678d3e845b5b9a Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Wed, 19 Nov 2008 05:39:23 -0500 Subject: wishlist from IRC --- doc/plugins/contrib/comments.mdwn | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/comments.mdwn b/doc/plugins/contrib/comments.mdwn index 89566d051..75a329b51 100644 --- a/doc/plugins/contrib/comments.mdwn +++ b/doc/plugins/contrib/comments.mdwn @@ -204,3 +204,12 @@ Known issues: > I haven't done a detailed code review, but I will say I'm pleased you > avoided re-implementing inline! --[[Joey]] + +Wishlist: + +* tbm would like anonymous people to be able to enter their name and possibly email + address +* smcv would like an indication of who you're posting as / the ability to log in + as someone else (even if anonymous comments are allowed, it'd be nice to be + able to choose to log in with a username or OpenID, like in Livejournal); + perhaps editpage needs this too -- cgit v1.2.3 From a10533fe7cd72e1c5a3f030c09cef4412b2e83f0 Mon Sep 17 00:00:00 2001 From: "http://schmonz.livejournal.com/" Date: Wed, 19 Nov 2008 22:52:36 -0500 Subject: does change to ikiwiki.cgi locking help? --- doc/plugins/contrib/unixauth/discussion.mdwn | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/unixauth/discussion.mdwn b/doc/plugins/contrib/unixauth/discussion.mdwn index dfa4fe6cc..46f86d351 100644 --- a/doc/plugins/contrib/unixauth/discussion.mdwn +++ b/doc/plugins/contrib/unixauth/discussion.mdwn @@ -32,3 +32,5 @@ I've added support for [checkpassword](http://cr.yp.to/checkpwd/interface.html), > to disentangle the two locks. --[[Joey]] >> Ah, ok, I misunderstood your comment. I'll see what I can figure out. --[[schmonz]] + +>>> My time's been limited for this, but I just saw [[todo/avoid_thrashing]]. How does that interact with pwauth or checkpassword? --[[schmonz]] -- cgit v1.2.3 From 17659599f3ea76c3c2e88de625e40265a20a93d7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 20 Nov 2008 12:44:23 -0500 Subject: response --- doc/plugins/contrib/unixauth/discussion.mdwn | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/unixauth/discussion.mdwn b/doc/plugins/contrib/unixauth/discussion.mdwn index 46f86d351..232649863 100644 --- a/doc/plugins/contrib/unixauth/discussion.mdwn +++ b/doc/plugins/contrib/unixauth/discussion.mdwn @@ -34,3 +34,5 @@ I've added support for [checkpassword](http://cr.yp.to/checkpwd/interface.html), >> Ah, ok, I misunderstood your comment. I'll see what I can figure out. --[[schmonz]] >>> My time's been limited for this, but I just saw [[todo/avoid_thrashing]]. How does that interact with pwauth or checkpassword? --[[schmonz]] + +>>>> The DOS still happens, it just uses less memory. --[[Joey]] -- cgit v1.2.3 From bf808c2f52d3572583d489de8ae6409b879fe685 Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Sun, 23 Nov 2008 13:53:18 -0500 Subject: --- doc/plugins/contrib/comments.mdwn | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/comments.mdwn b/doc/plugins/contrib/comments.mdwn index 75a329b51..1a6e7f465 100644 --- a/doc/plugins/contrib/comments.mdwn +++ b/doc/plugins/contrib/comments.mdwn @@ -38,6 +38,8 @@ only by direct committers. Currently, comments are always in [[ikiwiki/markdown] >> hard-code the name of the page to look at. Perhaps I could add >> discussionpage => 'discussion' too? --[[smcv]] +>> (I've now implemented this in my branch. --[[smcv]]) + >> The best reason to keep the pages internal seems to me to be that you >> don't want the overhead of every comment spawning its own wiki page. >> The worst problem with it though is that you have to assume the pages @@ -88,6 +90,11 @@ only by direct committers. Currently, comments are always in [[ikiwiki/markdown] >> either the code needs restructuring, or the permission check for 'create' would >> always be for 'comment1' and never 'comment123'. --[[smcv]] +>> Another possibility is to just check for permission to edit (e.g.) `sandbox/comment1`. +>> However, this makes the "comments can only be created, not edited" feature completely +>> reliant on the fact that internal pages can't be edited. Perhaps there should be a +>> `editable_pages` pagespec, defaulting to `'*'`? + When using this plugin, you should also enable [[htmlscrubber]] and either [[htmltidy]] or [[htmlbalance]]. Directives are filtered out by default, to avoid commenters slowing down the wiki by causing time-consuming processing. As long as the recommended plugins @@ -123,7 +130,7 @@ are enabled, comment authorship should hopefully be unforgeable by CGI users. When comments have been enabled generally, you still need to mark which pages can have comments, by including the `\[[!comments]]` directive in them. By default, this directive expands to a "post a comment" link plus an `\[[!inline]]` with -the comments. +the comments. [This requirement has now been removed --[[smcv]]] > I don't like this, because it's hard to explain to someone why they have > to insert this into every post to their blog. Seems that the model used @@ -137,6 +144,9 @@ the comments. >> as allowing comments. >> >>> Yes, I think a pagespec is the way to go. --[[Joey]] + +>>> Implemented --[[smcv]] + >> >> The model used for discussion pages does require patching the existing >> page template, which I was trying to avoid - I'm not convinced that having @@ -159,6 +169,8 @@ the comments. >>> with dpkg prompts in Debian packages with monolithic vs split >>> conffiles.) --[[smcv]] +>>> I've switched my branch to use page.tmpl instead; see what you think? --[[smcv]] + The plugin adds a new [[ikiwiki/PageSpec]] match type, `postcomment`, for use with `anonok_pagespec` from the [[plugins/anonok]] plugin or `locked_pages` from the [[plugins/lockedit]] plugin. Typical usage would be something like: @@ -174,17 +186,18 @@ to allow anonymous comments (the IP address will be used as the "author"). > This is still called postcomment, although I've renamed the rest of the plugin > to comments as suggested on #ikiwiki --[[smcv]] -Optional parameters to the comments directive: - -* `commit=no`: by default, comments are committed to version control. Use this to - disable commits. -* `allowdirectives=yes`: by default, IkiWiki directives are filtered out. Use this - to allow directives (avoid enabling any [[plugins/type/slow]] directives if you - do this). -* `closed=yes`: use this to prevent new comments while still displaying existing ones. -* `atom`, `rss`, `feeds`, `feedshow`, `timeformat`, `feedonly`: the same as for [[plugins/inline]] +There are some global options for the setup file: ->> I don't think feedonly actually makes sense here, so I'll remove it. --[[smcv]] +* comments_shown_pagespec: pages where comments will be displayed inline, e.g. `blog/*` + or `*/discussion`. +* comments_open_pagespec: pages where new comments can be posted, e.g. + `blog/* and created_after(close_old_comments)` or `*/discussion` +* comments_pagename: if this is e.g. `comment_` (the default), then comments on the + [[sandbox]] will be called something like `sandbox/comment_12` +* comments_allowdirectives: if true (default false), comments may contain IkiWiki + directives +* comments_commit: if true (default true), comments will be committed to the version + control system This plugin aims to close the [[todo]] item "[[todo/supporting_comments_via_disussion_pages]]", and is currently available from [[smcv]]'s git repository on git.pseudorandom.co.uk (it's the @@ -197,10 +210,6 @@ Known issues: * The access control via postcomment() is rather strange * There is some common code cargo-culted from other plugins (notably inline and editpage) which should probably be shared -* If the comments directive is removed from a page, comments can still be made on that page, - and will be committed but not displayed; to disable comments properly you have to set the - closed="yes" directive parameter (and refresh the wiki), *then* remove the directive if - desired > I haven't done a detailed code review, but I will say I'm pleased you > avoided re-implementing inline! --[[Joey]] -- cgit v1.2.3 From da7cc0408d1c2a7a1dc4f1d286c0c85237603f5f Mon Sep 17 00:00:00 2001 From: "http://yam655.livejournal.com/" Date: Wed, 26 Nov 2008 11:41:27 -0500 Subject: Relative previous months? --- doc/plugins/calendar/discussion.mdwn | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/calendar/discussion.mdwn b/doc/plugins/calendar/discussion.mdwn index 148b83522..49826e4d9 100644 --- a/doc/plugins/calendar/discussion.mdwn +++ b/doc/plugins/calendar/discussion.mdwn @@ -2,3 +2,5 @@ It would be nice if the "month" type calendar could collect all of the matching pages on a given date in some inline type way. --[[DavidBremner]] Is it possible to get the calendar to link to pages based not on their timestamp (as I understand that it does now, or have I misunderstood this?) and instead on for example their location in a directory hierarchy. That way the calendar could be used as a planning / timeline device which I think would be great. --[[Alexander]] + +I would like the ability to specify relative previous months. This way I could have a sidebar with the last three months by specifying no month, then 'month="-1"' and 'month="-2"'. Negative numbers for the month would otherwise be invalid, so this shouldn't produce any conflicts with expected behavior. (Right?) -- [[StevneBlack]] -- cgit v1.2.3 From 0a15052262b22eb6349a653a2999ec79430a041b Mon Sep 17 00:00:00 2001 From: "http://yam655.livejournal.com/" Date: Wed, 26 Nov 2008 11:42:10 -0500 Subject: --- doc/plugins/calendar/discussion.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/calendar/discussion.mdwn b/doc/plugins/calendar/discussion.mdwn index 49826e4d9..9d57b7a1e 100644 --- a/doc/plugins/calendar/discussion.mdwn +++ b/doc/plugins/calendar/discussion.mdwn @@ -3,4 +3,4 @@ matching pages on a given date in some inline type way. --[[DavidBremner]] Is it possible to get the calendar to link to pages based not on their timestamp (as I understand that it does now, or have I misunderstood this?) and instead on for example their location in a directory hierarchy. That way the calendar could be used as a planning / timeline device which I think would be great. --[[Alexander]] -I would like the ability to specify relative previous months. This way I could have a sidebar with the last three months by specifying no month, then 'month="-1"' and 'month="-2"'. Negative numbers for the month would otherwise be invalid, so this shouldn't produce any conflicts with expected behavior. (Right?) -- [[StevneBlack]] +I would like the ability to specify relative previous months. This way I could have a sidebar with the last three months by specifying no month, then 'month="-1"' and 'month="-2"'. Negative numbers for the month would otherwise be invalid, so this shouldn't produce any conflicts with expected behavior. (Right?) -- [[StevenBlack]] -- cgit v1.2.3 From 7a7f4a3cb60376dc46756e968161acb8e73ff88f Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Thu, 27 Nov 2008 05:38:37 -0500 Subject: Move some discussion from comments page to here --- doc/plugins/contrib/comments/discussion.mdwn | 139 +++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 doc/plugins/contrib/comments/discussion.mdwn (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/comments/discussion.mdwn b/doc/plugins/contrib/comments/discussion.mdwn new file mode 100644 index 000000000..8f98c1cb5 --- /dev/null +++ b/doc/plugins/contrib/comments/discussion.mdwn @@ -0,0 +1,139 @@ +# Why internal pages? (unresolved) + +Comments are saved as internal pages, so they can never be edited through the CGI, +only by direct committers. Currently, comments are always in [[ikiwiki/markdown]]. + +> So, why do it this way, instead of using regular wiki pages in a +> namespace, such as `$page/comments/*`? Then you could use [[plugins/lockedit]] to +> limit editing of comments in more powerful ways. --[[Joey]] + +>> Er... I suppose so. I'd assumed that these pages ought to only exist as inlines +>> rather than as individual pages (same reasoning as aggregated posts), though. +>> +>> lockedit is actually somewhat insufficient, since `check_canedit()` +>> doesn't distinguish between creation and editing; I'd have to continue to use +>> some sort of odd hack to allow creation but not editing. +>> +>> I also can't think of any circumstance where you'd want a user other than +>> admins (~= git committers) and possibly the commenter (who we can't check for +>> at the moment anyway, I don't think?) to be able to edit comments - I think +>> user expectations for something that looks like ordinary blog comments are +>> likely to include "others can't put words into my mouth". +>> +>> My other objection to using a namespace is that I'm not particularly happy about +>> plugins consuming arbitrary pieces of the wiki namespace - /discussion is bad +>> enough already. Indeed, this very page would accidentally get matched by rules +>> aiming to control comment-posting... :-) --[[smcv]] + +>>> Thinking about it, perhaps one way to address this would be to have the suffix +>>> (e.g. whether commenting on Sandbox creates sandbox/comment1 or sandbox/c1 or +>>> what) be configurable by the wiki admin, in the same way that recentchanges has +>>> recentchangespage => 'recentchanges'? I'd like to see fewer hard-coded page +>>> names in general, really - it seems odd to me that shortcuts and smileys +>>> hard-code the name of the page to look at. Perhaps I could add +>>> discussionpage => 'discussion' too? --[[smcv]] + +>>> (I've now implemented this in my branch. --[[smcv]]) + +>> The best reason to keep the pages internal seems to me to be that you +>> don't want the overhead of every comment spawning its own wiki page. +>> The worst problem with it though is that you have to assume the pages +>> are mdwn (or `default_pageext`) and not support other formats. --[[Joey]] + +>>> Well, you could always have `comment1._mdwn`, `comment2._creole` etc. and +>>> alter the htmlize logic so that the `mdwn` hook is called for both `mdwn` +>>> and `_mdwn` (assuming this is not already the case). I'm not convinced +>>> that multi-format comments are a killer feature, though - part of the point +>>> of this plugin, in my mind, is that it's less flexible than the full power +>>> of ikiwiki and gives users fewer options. This could be construed +>>> to be a feature, for people who don't care how flexible the technology is +>>> and just want a simple way to leave a comment. The FormattingHelp page +>>> assumes you're writing 100% Markdown in any case... +>>> +>>> Internal pages do too many things, perhaps: they suppress generation of +>>> HTML pages, they disable editing over the web, and they have a different +>>> namespace of htmlize hooks. I think the first two of those are useful +>>> for this plugin, and the last is harmless; you seem to think the first +>>> is useful, and the other two are harmful. --[[smcv]] + +# Access control (unresolved?) + +By the way, I think that who can post comments should be controllable by +the existing plugins opendiscussion, anonok, signinedit, and lockedit. Allowing +posting comments w/o any login, while a nice capability, can lead to +spam problems. So, use `check_canedit` as at least a first-level check? +--[[Joey]] + +> This plugin already uses `check_canedit`, but that function doesn't have a concept +> of different actions. The hack I use is that when a user comments on, say, sandbox, +> I call `check_canedit` for the pseudo-page "sandbox[postcomment]". The +> special `postcomment(glob)` [[ikiwiki/pagespec]] returns true if the page ends with +> "[postcomment]" and the part before (e.g. sandbox) matches the glob. So, you can +> have postcomment(blog/*) or something. (Perhaps instead of taking a glob, postcomment +> should take a pagespec, so you can have postcomment(link(tags/commentable))?) +> +> This is why `anonok_pages => 'postcomment(*)'` and `locked_pages => '!postcomment(*)'` +> are necessary to allow anonymous and logged-in editing (respectively). +> +> This is ugly - one alternative would be to add `check_permission()` that takes a +> page and a verb (create, edit, rename, remove and maybe comment are the ones I +> can think of so far), use that, and port the plugins you mentioned to use that +> API too. This plugin could either call `check_can("$page/comment1", 'create')` or +> call `check_can($page, 'comment')`. +> +> One odd effect of the code structure I've used is that we check for the ability to +> create the page before we actually know what page name we're going to use - when +> posting the comment I just increment a number until I reach an unused one - so +> either the code needs restructuring, or the permission check for 'create' would +> always be for 'comment1' and never 'comment123'. + +> Another possibility is to just check for permission to edit (e.g.) `sandbox/comment1`. +> However, this makes the "comments can only be created, not edited" feature completely +> reliant on the fact that internal pages can't be edited. Perhaps there should be a +> `editable_pages` pagespec, defaulting to `'*'`? --[[smcv]] + +# comments directive vs global setting (resolved?) + +When comments have been enabled generally, you still need to mark which pages +can have comments, by including the `\[[!comments]]` directive in them. By default, +this directive expands to a "post a comment" link plus an `\[[!inline]]` with +the comments. [This requirement has now been removed --[[smcv]]] + +> I don't like this, because it's hard to explain to someone why they have +> to insert this into every post to their blog. Seems that the model used +> for discussion pages could work -- if comments are enabled, automatically +> add the comment posting form and comments to the end of each page. +> --[[Joey]] + +>> I don't think I'd want comments on *every* page (particularly, not the +>> front page). Perhaps a pagespec in the setup file, where the default is "*"? +>> Then control freaks like me could use "link(tags/comments)" and tag pages +>> as allowing comments. +>> +>>> Yes, I think a pagespec is the way to go. --[[Joey]] + +>>>> Implemented --[[smcv]] + +>> +>> The model used for discussion pages does require patching the existing +>> page template, which I was trying to avoid - I'm not convinced that having +>> every possible feature hard-coded there really scales (and obviously it's +>> rather annoying while this plugin is on a branch). --[[smcv]] + +>>> Using the template would allow customising the html around the comments +>>> which seems like a good thing? --[[Joey]] + +>>>> The \[[!comments]] directive is already template-friendly - it expands to +>>>> the contents of the template `comments_embed.tmpl`, possibly with the +>>>> result of an \[[!inline]] appended. I should change `comments_embed.tmpl` +>>>> so it uses a template variable `INLINE` for the inline result rather than +>>>> having the perl code concatenate it, which would allow a bit more +>>>> customization (whether the "post" link was before or after the inline). +>>>> Even if you want comments in page.tmpl, keeping the separate comments_embed.tmpl +>>>> and having a `COMMENTS` variable in page.tmpl might be the way forward, +>>>> since the smaller each templates is, the easier it will be for users +>>>> to maintain a patched set of templates. (I think so, anyway, based on what happens +>>>> with dpkg prompts in Debian packages with monolithic vs split +>>>> conffiles.) --[[smcv]] + +>>>>> I've switched my branch to use page.tmpl instead; see what you think? --[[smcv]] -- cgit v1.2.3 From 92efb9c000825e1f16af4a27c51fb3e82a490a3f Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Thu, 27 Nov 2008 05:39:16 -0500 Subject: Move some discussion to discussion/ --- doc/plugins/contrib/comments.mdwn | 147 ++------------------------------------ 1 file changed, 5 insertions(+), 142 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/comments.mdwn b/doc/plugins/contrib/comments.mdwn index 1a6e7f465..891d3dee5 100644 --- a/doc/plugins/contrib/comments.mdwn +++ b/doc/plugins/contrib/comments.mdwn @@ -5,96 +5,6 @@ This plugin adds "blog-style" comments. The intention is that on a non-wiki site (like a blog) you can lock all pages for admin-only access, then allow otherwise unprivileged (or perhaps even anonymous) users to comment on posts. -Comments are saved as internal pages, so they can never be edited through the CGI, -only by direct committers. Currently, comments are always in [[ikiwiki/markdown]]. - -> So, why do it this way, instead of using regular wiki pages in a -> namespace, such as `$page/comments/*`? Then you could use [[plugins/lockedit]] to -> limit editing of comments in more powerful ways. --[[Joey]] - ->> Er... I suppose so. I'd assumed that these pages ought to only exist as inlines ->> rather than as individual pages (same reasoning as aggregated posts), though. ->> ->> lockedit is actually somewhat insufficient, since `check_canedit()` ->> doesn't distinguish between creation and editing; I'd have to continue to use ->> some sort of odd hack to allow creation but not editing. ->> ->> I also can't think of any circumstance where you'd want a user other than ->> admins (~= git committers) and possibly the commenter (who we can't check for ->> at the moment anyway, I don't think?) to be able to edit comments - I think ->> user expectations for something that looks like ordinary blog comments are ->> likely to include "others can't put words into my mouth". ->> ->> My other objection to using a namespace is that I'm not particularly happy about ->> plugins consuming arbitrary pieces of the wiki namespace - /discussion is bad ->> enough already. Indeed, this very page would accidentally get matched by rules ->> aiming to control comment-posting... :-) --[[smcv]] - ->> Thinking about it, perhaps one way to address this would be to have the suffix ->> (e.g. whether commenting on Sandbox creates sandbox/comment1 or sandbox/c1 or ->> what) be configurable by the wiki admin, in the same way that recentchanges has ->> recentchangespage => 'recentchanges'? I'd like to see fewer hard-coded page ->> names in general, really - it seems odd to me that shortcuts and smileys ->> hard-code the name of the page to look at. Perhaps I could add ->> discussionpage => 'discussion' too? --[[smcv]] - ->> (I've now implemented this in my branch. --[[smcv]]) - ->> The best reason to keep the pages internal seems to me to be that you ->> don't want the overhead of every comment spawning its own wiki page. ->> The worst problem with it though is that you have to assume the pages ->> are mdwn (or `default_pageext`) and not support other formats. --[[Joey]] - ->> Well, you could always have `comment1._mdwn`, `comment2._creole` etc. and ->> alter the htmlize logic so that the `mdwn` hook is called for both `mdwn` ->> and `_mdwn` (assuming this is not already the case). I'm not convinced ->> that multi-format comments are a killer feature, though - part of the point ->> of this plugin, in my mind, is that it's less flexible than the full power ->> of ikiwiki and gives users fewer options. This could be construed ->> to be a feature, for people who don't care how flexible the technology is ->> and just want a simple way to leave a comment. The FormattingHelp page ->> assumes you're writing 100% Markdown in any case... ->> ->> Internal pages do too many things, perhaps: they suppress generation of ->> HTML pages, they disable editing over the web, and they have a different ->> namespace of htmlize hooks. I think the first two of those are useful ->> for this plugin, and the last is harmless; you seem to think the first ->> is useful, and the other two are harmful. --[[smcv]] - ->> By the way, I think that who can post comments should be controllable by ->> the existing plugins opendiscussion, anonok, signinedit, and lockedit. Allowing ->> posting comments w/o any login, while a nice capability, can lead to ->> spam problems. So, use `check_canedit` as at least a first-level check? ->> --[[Joey]] - ->> This plugin already uses `check_canedit`, but that function doesn't have a concept ->> of different actions. The hack I use is that when a user comments on, say, sandbox, ->> I call `check_canedit` for the pseudo-page "sandbox[postcomment]". The ->> special `postcomment(glob)` [[ikiwiki/pagespec]] returns true if the page ends with ->> "[postcomment]" and the part before (e.g. sandbox) matches the glob. So, you can ->> have postcomment(blog/*) or something. (Perhaps instead of taking a glob, postcomment ->> should take a pagespec, so you can have postcomment(link(tags/commentable))?) ->> ->> This is why `anonok_pages => 'postcomment(*)'` and `locked_pages => '!postcomment(*)'` ->> are necessary to allow anonymous and logged-in editing (respectively). ->> ->> This is ugly - one alternative would be to add `check_permission()` that takes a ->> page and a verb (create, edit, rename, remove and maybe comment are the ones I ->> can think of so far), use that, and port the plugins you mentioned to use that ->> API too. This plugin could either call `check_can("$page/comment1", 'create')` or ->> call `check_can($page, 'comment')`. ->> ->> One odd effect of the code structure I've used is that we check for the ability to ->> create the page before we actually know what page name we're going to use - when ->> posting the comment I just increment a number until I reach an unused one - so ->> either the code needs restructuring, or the permission check for 'create' would ->> always be for 'comment1' and never 'comment123'. --[[smcv]] - ->> Another possibility is to just check for permission to edit (e.g.) `sandbox/comment1`. ->> However, this makes the "comments can only be created, not edited" feature completely ->> reliant on the fact that internal pages can't be edited. Perhaps there should be a ->> `editable_pages` pagespec, defaulting to `'*'`? - When using this plugin, you should also enable [[htmlscrubber]] and either [[htmltidy]] or [[htmlbalance]]. Directives are filtered out by default, to avoid commenters slowing down the wiki by causing time-consuming processing. As long as the recommended plugins @@ -127,50 +37,6 @@ are enabled, comment authorship should hopefully be unforgeable by CGI users. >> sensible to allow users to (ab)use them on open wikis. >> --[[Joey]] -When comments have been enabled generally, you still need to mark which pages -can have comments, by including the `\[[!comments]]` directive in them. By default, -this directive expands to a "post a comment" link plus an `\[[!inline]]` with -the comments. [This requirement has now been removed --[[smcv]]] - -> I don't like this, because it's hard to explain to someone why they have -> to insert this into every post to their blog. Seems that the model used -> for discussion pages could work -- if comments are enabled, automatically -> add the comment posting form and comments to the end of each page. -> --[[Joey]] - ->> I don't think I'd want comments on *every* page (particularly, not the ->> front page). Perhaps a pagespec in the setup file, where the default is "*"? ->> Then control freaks like me could use "link(tags/comments)" and tag pages ->> as allowing comments. ->> ->>> Yes, I think a pagespec is the way to go. --[[Joey]] - ->>> Implemented --[[smcv]] - ->> ->> The model used for discussion pages does require patching the existing ->> page template, which I was trying to avoid - I'm not convinced that having ->> every possible feature hard-coded there really scales (and obviously it's ->> rather annoying while this plugin is on a branch). --[[smcv]] - ->>> Using the template would allow customising the html around the comments ->>> which seems like a good thing? --[[Joey]] - ->>> The \[[!comments]] directive is already template-friendly - it expands to ->>> the contents of the template `comments_embed.tmpl`, possibly with the ->>> result of an \[[!inline]] appended. I should change `comments_embed.tmpl` ->>> so it uses a template variable `INLINE` for the inline result rather than ->>> having the perl code concatenate it, which would allow a bit more ->>> customization (whether the "post" link was before or after the inline). ->>> Even if you want comments in page.tmpl, keeping the separate comments_embed.tmpl ->>> and having a `COMMENTS` variable in page.tmpl might be the way forward, ->>> since the smaller each templates is, the easier it will be for users ->>> to maintain a patched set of templates. (I think so, anyway, based on what happens ->>> with dpkg prompts in Debian packages with monolithic vs split ->>> conffiles.) --[[smcv]] - ->>> I've switched my branch to use page.tmpl instead; see what you think? --[[smcv]] - The plugin adds a new [[ikiwiki/PageSpec]] match type, `postcomment`, for use with `anonok_pagespec` from the [[plugins/anonok]] plugin or `locked_pages` from the [[plugins/lockedit]] plugin. Typical usage would be something like: @@ -183,20 +49,17 @@ to allow non-admin users to comment on pages, but not edit anything. You can als to allow anonymous comments (the IP address will be used as the "author"). -> This is still called postcomment, although I've renamed the rest of the plugin -> to comments as suggested on #ikiwiki --[[smcv]] - There are some global options for the setup file: -* comments_shown_pagespec: pages where comments will be displayed inline, e.g. `blog/*` +* `comments_shown_pagespec`: pages where comments will be displayed inline, e.g. `blog/*` or `*/discussion`. -* comments_open_pagespec: pages where new comments can be posted, e.g. +* `comments_open_pagespec`: pages where new comments can be posted, e.g. `blog/* and created_after(close_old_comments)` or `*/discussion` -* comments_pagename: if this is e.g. `comment_` (the default), then comments on the +* `comments_pagename`: if this is e.g. `comment_` (the default), then comments on the [[sandbox]] will be called something like `sandbox/comment_12` -* comments_allowdirectives: if true (default false), comments may contain IkiWiki +* `comments_allowdirectives`: if true (default false), comments may contain IkiWiki directives -* comments_commit: if true (default true), comments will be committed to the version +* `comments_commit`: if true (default true), comments will be committed to the version control system This plugin aims to close the [[todo]] item "[[todo/supporting_comments_via_disussion_pages]]", -- cgit v1.2.3 From ec03c89f3e01a2b1d374e1ae66d3f5fb0370ca99 Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Thu, 27 Nov 2008 05:42:07 -0500 Subject: Move some more discussion here --- doc/plugins/contrib/comments/discussion.mdwn | 37 +++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/comments/discussion.mdwn b/doc/plugins/contrib/comments/discussion.mdwn index 8f98c1cb5..a054dd55d 100644 --- a/doc/plugins/contrib/comments/discussion.mdwn +++ b/doc/plugins/contrib/comments/discussion.mdwn @@ -1,4 +1,4 @@ -# Why internal pages? (unresolved) +## Why internal pages? (unresolved) Comments are saved as internal pages, so they can never be edited through the CGI, only by direct committers. Currently, comments are always in [[ikiwiki/markdown]]. @@ -56,7 +56,7 @@ only by direct committers. Currently, comments are always in [[ikiwiki/markdown] >>> for this plugin, and the last is harmless; you seem to think the first >>> is useful, and the other two are harmful. --[[smcv]] -# Access control (unresolved?) +## Access control (unresolved?) By the way, I think that who can post comments should be controllable by the existing plugins opendiscussion, anonok, signinedit, and lockedit. Allowing @@ -92,7 +92,7 @@ spam problems. So, use `check_canedit` as at least a first-level check? > reliant on the fact that internal pages can't be edited. Perhaps there should be a > `editable_pages` pagespec, defaulting to `'*'`? --[[smcv]] -# comments directive vs global setting (resolved?) +## comments directive vs global setting (resolved?) When comments have been enabled generally, you still need to mark which pages can have comments, by including the `\[[!comments]]` directive in them. By default, @@ -137,3 +137,34 @@ the comments. [This requirement has now been removed --[[smcv]]] >>>> conffiles.) --[[smcv]] >>>>> I've switched my branch to use page.tmpl instead; see what you think? --[[smcv]] + +## Raw HTML (resolved?) + +Raw HTML was not initially allowed by default (this was configurable). + +> I'm not sure that raw html should be a problem, as long as the +> htmlsanitizer and htmlbalanced plugins are enabled. I can see filtering +> out directives, as a special case. --[[Joey]] + +>> Right, if I sanitize each post individually, with htmlscrubber and either htmltidy +>> or htmlbalance turned on, then there should be no way the user can forge a comment; +>> I was initially wary of allowing meta directives, but I think those are OK, as long +>> as the comment template puts the \[[!meta author]] at the *end*. Disallowing +>> directives is more a way to avoid commenters causing expensive processing than +>> anything else, at this point. +>> +>> I've rebased the plugin on master, made it sanitize individual posts' content +>> and removed the option to disallow raw HTML. Sanitizing individual posts before +>> they've been htmlized required me to preserve whitespace in the htmlbalance +>> plugin, so I did that. Alternatively, we could htmlize immediately and always +>> save out raw HTML? --[[smcv]] + +>>> There might be some use cases for other directives, such as img, in +>>> comments. +>>> +>>> I don't know if meta is "safe" (ie, guaranteed to be inexpensive and not +>>> allow users to do annoying things) or if it will continue to be in the +>>> future. Hard to predict really, all that can be said with certainty is +>>> 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]] -- cgit v1.2.3 From e69095504cb36705494b43d134cea6745755e4ba Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Thu, 27 Nov 2008 05:56:36 -0500 Subject: --- doc/plugins/contrib/comments.mdwn | 36 ++++++++---------------------------- 1 file changed, 8 insertions(+), 28 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/comments.mdwn b/doc/plugins/contrib/comments.mdwn index 891d3dee5..ef067f4d0 100644 --- a/doc/plugins/contrib/comments.mdwn +++ b/doc/plugins/contrib/comments.mdwn @@ -10,33 +10,6 @@ or [[htmlbalance]]. Directives are filtered out by default, to avoid commenters down the wiki by causing time-consuming processing. As long as the recommended plugins are enabled, comment authorship should hopefully be unforgeable by CGI users. -> I'm not sure that raw html should be a problem, as long as the -> htmlsanitizer and htmlbalanced plugins are enabled. I can see filtering -> out directives, as a special case. --[[Joey]] - ->> Right, if I sanitize each post individually, with htmlscrubber and either htmltidy ->> or htmlbalance turned on, then there should be no way the user can forge a comment; ->> I was initially wary of allowing meta directives, but I think those are OK, as long ->> as the comment template puts the \[[!meta author]] at the *end*. Disallowing ->> directives is more a way to avoid commenters causing expensive processing than ->> anything else, at this point. ->> ->> I've rebased the plugin on master, made it sanitize individual posts' content ->> and removed the option to disallow raw HTML. Sanitizing individual posts before ->> they've been htmlized required me to preserve whitespace in the htmlbalance ->> plugin, so I did that. Alternatively, we could htmlize immediately and always ->> save out raw HTML? --[[smcv]] - ->> There might be some use cases for other directives, such as img, in ->> comments. ->> ->> I don't know if meta is "safe" (ie, guaranteed to be inexpensive and not ->> allow users to do annoying things) or if it will continue to be in the ->> future. Hard to predict really, all that can be said with certainty is ->> 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]] - The plugin adds a new [[ikiwiki/PageSpec]] match type, `postcomment`, for use with `anonok_pagespec` from the [[plugins/anonok]] plugin or `locked_pages` from the [[plugins/lockedit]] plugin. Typical usage would be something like: @@ -70,9 +43,10 @@ and is currently available from [[smcv]]'s git repository on git.pseudorandom.co Known issues: * Needs code review -* The access control via postcomment() is rather strange +* The access control via postcomment() is rather strange (see [[discussion]] for more details) * There is some common code cargo-culted from other plugins (notably inline and editpage) which should probably be shared +* Joey doesn't think it should necessarily use internal pages (see [[discussion]]) > I haven't done a detailed code review, but I will say I'm pleased you > avoided re-implementing inline! --[[Joey]] @@ -85,3 +59,9 @@ Wishlist: as someone else (even if anonymous comments are allowed, it'd be nice to be able to choose to log in with a username or OpenID, like in Livejournal); perhaps editpage needs this too + +Fixed issues: + +* Joey didn't think the `\[[!comments]]` directive was appropriate; comments now appear + on pages selected with a [[ikiwiki/pagespec]] +* Joey thought that raw HTML should always be allowed; it now is -- cgit v1.2.3 From b8fb77b093e2496979b94b3e2b5099e7768cc40c Mon Sep 17 00:00:00 2001 From: "http://alcopop.org/me/openid/" Date: Tue, 2 Dec 2008 10:00:47 -0500 Subject: update for rename of users/jondowland.mdwn to users/jon.mdwn --- doc/plugins/write/discussion.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/write/discussion.mdwn b/doc/plugins/write/discussion.mdwn index 9a36d7b0b..24a556ffe 100644 --- a/doc/plugins/write/discussion.mdwn +++ b/doc/plugins/write/discussion.mdwn @@ -43,4 +43,4 @@ distributed wiki. --- -I would find this page clearer split up into sub-pages. Does anyone agree/disagree? -- [[JonDowland]] +I would find this page clearer split up into sub-pages. Does anyone agree/disagree? -- [[users/Jon]] -- cgit v1.2.3 From a6b9fadc9a06b669e367dcde5f9d52570efa245e Mon Sep 17 00:00:00 2001 From: "http://john.choffee.co.uk/" Date: Tue, 9 Dec 2008 08:27:59 -0500 Subject: Fixed the pagespec link --- doc/plugins/htmlscrubber.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/htmlscrubber.mdwn b/doc/plugins/htmlscrubber.mdwn index 7db372e1b..b9f7e6d22 100644 --- a/doc/plugins/htmlscrubber.mdwn +++ b/doc/plugins/htmlscrubber.mdwn @@ -32,7 +32,7 @@ other HTML-related functionality, such as whether [[meta]] allows potentially unsafe HTML tags. The `htmlscrubber_skip` configuration setting can be used to skip scrubbing -of some pages. Set it to a [[PageSpec]], such as "!*/Discussion", and pages +of some pages. Set it to a [[ikiwiki/PageSpec]], such as "!*/Discussion", and pages matching that can have all the evil CSS, JavsScript, and unsafe html elements you like. One safe way to use this is to use [[lockedit]] to lock those pages, so only admins can edit them. -- cgit v1.2.3 From d6b87bd25ec6f466c6d3c486b4e923377ad8ee2a Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Wed, 10 Dec 2008 21:44:50 -0500 Subject: Update with today's changes --- doc/plugins/contrib/comments.mdwn | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/comments.mdwn b/doc/plugins/contrib/comments.mdwn index ef067f4d0..a7a509ebb 100644 --- a/doc/plugins/contrib/comments.mdwn +++ b/doc/plugins/contrib/comments.mdwn @@ -34,10 +34,28 @@ There are some global options for the setup file: directives * `comments_commit`: if true (default true), comments will be committed to the version control system +* `comments_allowauthor`: if true (default false), anonymous commenters may specify a + name for themselves, and the \[[!meta author]] and \[[!meta authorurl]] directives + will not be overridden by the comments plugin + +Templates that will display comments (by default that means `comments_display.tmpl`) +can use the following additional ``s: + +* `COMMENTUSER`: the authenticated/verified user name, or undefined if the user was not signed in +* `COMMENTIP`: the remote IP address, or undefined if not known (this is not currently recorded + for users who are signed in, who are assumed to be vaguely accountable) +* `COMMENTAUTHOR`: a "prettier" version of the authenticated/verified user name (e.g. OpenIDs are + formatted the same way as in [[RecentChanges]]), or the result of localizing "Anonymous" if the + user was not signed in +* `COMMENTAUTHORURL`: if the user was signed in with an OpenID, that URL; if the user was signed + in with some other username, a CGI URL that redirects to their user page (if any) + +This plugin also adds a `\[[!comment]]` directive which is used when storing comments. This +directive shouldn't be used on pages that are edited in the usual way. This plugin aims to close the [[todo]] item "[[todo/supporting_comments_via_disussion_pages]]", and is currently available from [[smcv]]'s git repository on git.pseudorandom.co.uk (it's the -`postcomment` branch). A demo wiki with the plugin enabled is running at +`comments-rebase1` branch). A demo wiki with the plugin enabled is running at . Known issues: @@ -47,21 +65,19 @@ Known issues: * There is some common code cargo-culted from other plugins (notably inline and editpage) which should probably be shared * Joey doesn't think it should necessarily use internal pages (see [[discussion]]) +* `\[[!comment]]` should perhaps be `\[[!_comment]], or a special filter/htmlize hook rather + than being a directive at all > I haven't done a detailed code review, but I will say I'm pleased you > avoided re-implementing inline! --[[Joey]] -Wishlist: - -* tbm would like anonymous people to be able to enter their name and possibly email - address -* smcv would like an indication of who you're posting as / the ability to log in - as someone else (even if anonymous comments are allowed, it'd be nice to be - able to choose to log in with a username or OpenID, like in Livejournal); - perhaps editpage needs this too - Fixed issues: * Joey didn't think the `\[[!comments]]` directive was appropriate; comments now appear on pages selected with a [[ikiwiki/pagespec]] * Joey thought that raw HTML should always be allowed; it now is +* tbm wanted anonymous people to be able to enter their name and possibly email + address; a name and website can now be supplied +* There is now an indication of who you're signed in as +* Each comment is now one big \[[!comment]] directive invocation, avoiding previous + issues with unambiguous and un-spoofable metadata -- cgit v1.2.3 From 59c29b532e5bb728cd7c6fa62642cdeeef369ad7 Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Wed, 10 Dec 2008 21:50:15 -0500 Subject: multiple formats now supported --- doc/plugins/contrib/comments/discussion.mdwn | 32 ++++++++++------------------ 1 file changed, 11 insertions(+), 21 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/comments/discussion.mdwn b/doc/plugins/contrib/comments/discussion.mdwn index a054dd55d..59740ec37 100644 --- a/doc/plugins/contrib/comments/discussion.mdwn +++ b/doc/plugins/contrib/comments/discussion.mdwn @@ -1,7 +1,7 @@ ## Why internal pages? (unresolved) Comments are saved as internal pages, so they can never be edited through the CGI, -only by direct committers. Currently, comments are always in [[ikiwiki/markdown]]. +only by direct committers. > So, why do it this way, instead of using regular wiki pages in a > namespace, such as `$page/comments/*`? Then you could use [[plugins/lockedit]] to @@ -36,25 +36,13 @@ only by direct committers. Currently, comments are always in [[ikiwiki/markdown] >>> (I've now implemented this in my branch. --[[smcv]]) >> The best reason to keep the pages internal seems to me to be that you ->> don't want the overhead of every comment spawning its own wiki page. ->> The worst problem with it though is that you have to assume the pages ->> are mdwn (or `default_pageext`) and not support other formats. --[[Joey]] - ->>> Well, you could always have `comment1._mdwn`, `comment2._creole` etc. and ->>> alter the htmlize logic so that the `mdwn` hook is called for both `mdwn` ->>> and `_mdwn` (assuming this is not already the case). I'm not convinced ->>> that multi-format comments are a killer feature, though - part of the point ->>> of this plugin, in my mind, is that it's less flexible than the full power ->>> of ikiwiki and gives users fewer options. This could be construed ->>> to be a feature, for people who don't care how flexible the technology is ->>> and just want a simple way to leave a comment. The FormattingHelp page ->>> assumes you're writing 100% Markdown in any case... ->>> ->>> Internal pages do too many things, perhaps: they suppress generation of ->>> HTML pages, they disable editing over the web, and they have a different ->>> namespace of htmlize hooks. I think the first two of those are useful ->>> for this plugin, and the last is harmless; you seem to think the first ->>> is useful, and the other two are harmful. --[[smcv]] +>> don't want the overhead of every comment spawning its own wiki page. --[[Joey]] + +## Formats (resolved) + +The plugin now allows multiple comment formats while still using internal +pages; each comment is saved as a page containing one `\[[!comment]]` directive, +which has a superset of the functionality of [[ikiwiki/directives/format]]. ## Access control (unresolved?) @@ -85,7 +73,9 @@ spam problems. So, use `check_canedit` as at least a first-level check? > create the page before we actually know what page name we're going to use - when > posting the comment I just increment a number until I reach an unused one - so > either the code needs restructuring, or the permission check for 'create' would -> always be for 'comment1' and never 'comment123'. +> always be for 'comment1' and never 'comment123'. --[[smcv]] + +>> Now resolved, in fact --[[smcv]] > Another possibility is to just check for permission to edit (e.g.) `sandbox/comment1`. > However, this makes the "comments can only be created, not edited" feature completely -- cgit v1.2.3 From 52bd18aafc0410c6da04d2e893d61cce3d9449f4 Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Wed, 10 Dec 2008 22:12:11 -0500 Subject: Link to sandbox on my demo of the plugin --- doc/plugins/contrib/comments.mdwn | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/comments.mdwn b/doc/plugins/contrib/comments.mdwn index a7a509ebb..5a7aa7d16 100644 --- a/doc/plugins/contrib/comments.mdwn +++ b/doc/plugins/contrib/comments.mdwn @@ -56,7 +56,9 @@ directive shouldn't be used on pages that are edited in the usual way. This plugin aims to close the [[todo]] item "[[todo/supporting_comments_via_disussion_pages]]", and is currently available from [[smcv]]'s git repository on git.pseudorandom.co.uk (it's the `comments-rebase1` branch). A demo wiki with the plugin enabled is running at -. +; the +[sandbox page](http://www.pseudorandom.co.uk/2008/ikiwiki/demo/sandbox/#comments) has some +examples of comments. Known issues: -- cgit v1.2.3 From 50ae0dcd8c167b20a7b3eab46f60439ad07f0642 Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Thu, 11 Dec 2008 06:07:37 -0500 Subject: some issues joeyh reported on IRC --- doc/plugins/contrib/comments.mdwn | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/comments.mdwn b/doc/plugins/contrib/comments.mdwn index 5a7aa7d16..a832c571a 100644 --- a/doc/plugins/contrib/comments.mdwn +++ b/doc/plugins/contrib/comments.mdwn @@ -67,8 +67,11 @@ Known issues: * There is some common code cargo-culted from other plugins (notably inline and editpage) which should probably be shared * Joey doesn't think it should necessarily use internal pages (see [[discussion]]) -* `\[[!comment]]` should perhaps be `\[[!_comment]], or a special filter/htmlize hook rather +* `\[[!comment]]` should perhaps be `\[[!_comment]]`, or a special filter/htmlize hook rather than being a directive at all +* Previews always say "unknown IP address" +* [[todo/inline_plugin:_ability_to_override_the_feed_name]] +* [[todo/inline_plugin:_hide_feed_buttons_if_empty]] > I haven't done a detailed code review, but I will say I'm pleased you > avoided re-implementing inline! --[[Joey]] -- cgit v1.2.3 From b67632cdcdd333cf0a88d03c0f7e6e62921f32c3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 11 Dec 2008 15:01:26 -0500 Subject: inline: Support feedfile option to change the filename of the feed generated. --- IkiWiki.pm | 8 ++- IkiWiki/Plugin/inline.pm | 63 ++++++++++-------- debian/changelog | 2 + doc/ikiwiki/directive/inline.mdwn | 5 ++ doc/plugins/write.mdwn | 6 +- ...line_plugin:_ability_to_override_feed_name.mdwn | 2 + po/de.po | 74 +++++++++++----------- po/fr.po | 71 +++++++++++---------- po/ikiwiki.pot | 52 +++++++-------- 9 files changed, 156 insertions(+), 127 deletions(-) (limited to 'doc/plugins') diff --git a/IkiWiki.pm b/IkiWiki.pm index 2ad2f792d..1c68c2cb3 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -666,11 +666,15 @@ sub newpagefile ($$) { #{{{ } } #}}} -sub targetpage ($$) { #{{{ +sub targetpage ($$;$) { #{{{ my $page=shift; my $ext=shift; + my $filename=shift; - if (! $config{usedirs} || $page eq 'index') { + if (defined $filename) { + return $page."/".$filename.".".$ext; + } + elsif (! $config{usedirs} || $page eq 'index') { return $page.".".$ext; } else { diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 5e4df95f4..17cc46e0e 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -26,8 +26,7 @@ sub import { #{{{ # Hook to change to do pinging since it's called late. # This ensures each page only pings once and prevents slow # pings interrupting page builds. - hook(type => "change", id => "inline", - call => \&IkiWiki::pingurl); + hook(type => "change", id => "inline", call => \&IkiWiki::pingurl); } # }}} sub getopt () { #{{{ @@ -238,28 +237,46 @@ sub preprocess_inline (@) { #{{{ @feedlist=grep { pagespec_match($_, $params{feedpages}, location => $params{page}) } @feedlist; } - my $feednum=""; - - my $feedid=join("\0", map { $_."\0".$params{$_} } sort keys %params); - if (exists $knownfeeds{$feedid}) { - $feednum=$knownfeeds{$feedid}; - } - else { - if (exists $page_numfeeds{$params{destpage}}) { - if ($feeds) { - $feednum=$knownfeeds{$feedid}=++$page_numfeeds{$params{destpage}}; + my ($feedbase, $feednum); + if ($feeds) { + # Ensure that multiple feeds on a page go to unique files. + + # Feedfile can lead to conflicts if usedirs is not enabled, + # so avoid supporting it in that case. + delete $params{feedfile} if ! $config{usedirs}; + # Tight limits on legal feedfiles, to avoid security issues + # and conflicts. + if (defined $params{feedfile}) { + if ($params{feedfile} =~ /\// || + $params{feedfile} !~ /$config{wiki_file_regexp}/) { + error("illegal feedfile"); } + $params{feedfile}=possibly_foolish_untaint($params{feedfile}); + } + $feedbase=targetpage($params{destpage}, "", $params{feedfile}); + + my $feedid=join("\0", $feedbase, map { $_."\0".$params{$_} } sort keys %params); + if (exists $knownfeeds{$feedid}) { + $feednum=$knownfeeds{$feedid}; } else { - $feednum=$knownfeeds{$feedid}=""; - if ($feeds) { - $page_numfeeds{$params{destpage}}=1; + if (exists $page_numfeeds{$params{destpage}}{$feedbase}) { + if ($feeds) { + $feednum=$knownfeeds{$feedid}=++$page_numfeeds{$params{destpage}}{$feedbase}; + } + } + else { + $feednum=$knownfeeds{$feedid}=""; + if ($feeds) { + $page_numfeeds{$params{destpage}}{$feedbase}=1; + } } } } - my $rssurl=basename(rsspage($params{destpage}).$feednum) if $feeds && $rss; - my $atomurl=basename(atompage($params{destpage}).$feednum) if $feeds && $atom; + my $rssurl=basename($feedbase."rss".$feednum) if $feeds && $rss; + my $atomurl=basename($feedbase."atom".$feednum) if $feeds && $atom; + my $ret=""; if (length $config{cgiurl} && ! $params{preview} && (exists $params{rootpage} || @@ -375,7 +392,7 @@ sub preprocess_inline (@) { #{{{ if ($feeds && ! (! $emptyfeeds && ! @feedlist)) { if ($rss) { - my $rssp=rsspage($params{destpage}).$feednum; + my $rssp=$feedbase."rss".$feednum; will_render($params{destpage}, $rssp); if (! $params{preview}) { writefile($rssp, $config{destdir}, @@ -386,7 +403,7 @@ sub preprocess_inline (@) { #{{{ } } if ($atom) { - my $atomp=atompage($params{destpage}).$feednum; + my $atomp=$feedbase."atom".$feednum; will_render($params{destpage}, $atomp); if (! $params{preview}) { writefile($atomp, $config{destdir}, @@ -475,14 +492,6 @@ sub absolute_urls ($$) { #{{{ return $content; } #}}} -sub rsspage ($) { #{{{ - return targetpage(shift, "rss"); -} #}}} - -sub atompage ($) { #{{{ - return targetpage(shift, "atom"); -} #}}} - sub genfeed ($$$$$@) { #{{{ my $feedtype=shift; my $feedurl=shift; diff --git a/debian/changelog b/debian/changelog index 7f6844366..1ff78d749 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,8 @@ ikiwiki (2.71) UNRELEASED; urgency=low * Correct --dumpsetup to include the srcdir in the setup file. * German translation update from Kai Wasserbäch. Closes: #507056 * inline: Support emptyfeeds=no option to skip generating empty feeds. + * inline: Support feedfile option to change the filename of the feed + generated. -- Joey Hess Mon, 17 Nov 2008 14:02:10 -0500 diff --git a/doc/ikiwiki/directive/inline.mdwn b/doc/ikiwiki/directive/inline.mdwn index 82b532e0c..40670e1e7 100644 --- a/doc/ikiwiki/directive/inline.mdwn +++ b/doc/ikiwiki/directive/inline.mdwn @@ -104,6 +104,11 @@ Here are some less often needed parameters: * `guid` - If a URI is given here (perhaps a UUID prefixed with `urn:uuid:`), the Atom feed will have this as its ``. The default is to use the URL of the page containing the `inline` directive. +* `feedfile` - Can be used to change the name of the file generated for the + feed. This is particularly useful if a page contains multiple feeds. + For example, set "feedfile=feed" to cause it to generate `page/feed.atom` + and/or `page/feed.rss`. This option is not supported if the wiki is + configured not to use `usedirs`. [[!meta robots="noindex, follow"]] diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index abcabbdc3..b6fa96f91 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -696,11 +696,15 @@ This can be called when creating a new page, to determine what filename to save the page to. It's passed a page name, and its type, and returns the name of the file to create, relative to the srcdir. -#### `targetpage($$)` +#### `targetpage($$;$)` Passed a page and an extension, returns the filename that page will be rendered to. +Optionally, a third parameter can be passed, to specify the preferred +filename of the page. For example, `targetpage("foo", "rss", "feed")` +will yield something like `foo/feed.rss`. + ## Miscellaneous ### Internal use pages diff --git a/doc/todo/inline_plugin:_ability_to_override_feed_name.mdwn b/doc/todo/inline_plugin:_ability_to_override_feed_name.mdwn index 71bc3bdd6..df5bf9194 100644 --- a/doc/todo/inline_plugin:_ability_to_override_feed_name.mdwn +++ b/doc/todo/inline_plugin:_ability_to_override_feed_name.mdwn @@ -25,3 +25,5 @@ could perhaps change it to `/sandbox-comments.atom` or > Particularly for the non-usedirs case, where a page `sandbox/comments` > would produce the same feed as sandbox with `feedname=comments`. > --[[Joey]] + +> [[done]] as feedfile option --[[Joey]] diff --git a/po/de.po b/po/de.po index 55234a909..d49d0c6ca 100644 --- a/po/de.po +++ b/po/de.po @@ -5,8 +5,8 @@ msgid "" msgstr "" "Project-Id-Version: ikiwiki 2.70\n" -"Report-Msgid-Bugs-To: ikiwiki@packages.debian.org\n" -"POT-Creation-Date: 2008-10-31 16:37-0400\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2008-12-11 14:46-0500\n" "PO-Revision-Date: 2008-11-20 19:58+0100\n" "Last-Translator: Kai Wasserbäch \n" "Language-Team: German \n" @@ -47,7 +47,7 @@ msgstr "Einstellungen gespeichert." msgid "You are banned." msgstr "Sie sind ausgeschlossen worden." -#: ../IkiWiki/CGI.pm:385 ../IkiWiki/CGI.pm:386 ../IkiWiki.pm:1182 +#: ../IkiWiki/CGI.pm:385 ../IkiWiki/CGI.pm:386 ../IkiWiki.pm:1204 msgid "Error" msgstr "Fehler" @@ -110,16 +110,16 @@ msgstr "Feed nicht gefunden" msgid "(invalid UTF-8 stripped from feed)" msgstr "(ungültiges UTF-8-Zeichen wurde aus dem Feed entfernt)" -#: ../IkiWiki/Plugin/aggregate.pm:504 +#: ../IkiWiki/Plugin/aggregate.pm:506 #, perl-format msgid "(feed entities escaped)" msgstr "(Feed-Entitäten maskiert)" -#: ../IkiWiki/Plugin/aggregate.pm:510 +#: ../IkiWiki/Plugin/aggregate.pm:514 msgid "feed crashed XML::Feed!" msgstr "Feed führte zum Absturz von XML::Feed!" -#: ../IkiWiki/Plugin/aggregate.pm:590 +#: ../IkiWiki/Plugin/aggregate.pm:595 #, perl-format msgid "creating new page %s" msgstr "erstelle neue Seite %s" @@ -128,7 +128,7 @@ msgstr "erstelle neue Seite %s" msgid "deleting bucket.." msgstr "Lösche Bucket..." -#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:206 +#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:208 msgid "done" msgstr "fertig" @@ -171,7 +171,7 @@ msgid "automatic index generation" msgstr "automatische Index-Erstellung" #: ../IkiWiki/Plugin/brokenlinks.pm:33 ../IkiWiki/Plugin/editpage.pm:261 -#: ../IkiWiki/Plugin/inline.pm:327 ../IkiWiki/Plugin/opendiscussion.pm:26 +#: ../IkiWiki/Plugin/inline.pm:344 ../IkiWiki/Plugin/opendiscussion.pm:26 #: ../IkiWiki/Plugin/orphans.pm:37 ../IkiWiki/Render.pm:79 #: ../IkiWiki/Render.pm:149 msgid "discussion" @@ -245,11 +245,11 @@ msgstr "»edittemplate« %s registriert für %s" msgid "failed to process" msgstr "Bearbeitung fehlgeschlagen" -#: ../IkiWiki/Plugin/format.pm:22 +#: ../IkiWiki/Plugin/format.pm:20 msgid "must specify format and text" msgstr "Format und Text muss spezifiziert werden" -#: ../IkiWiki/Plugin/format.pm:25 +#: ../IkiWiki/Plugin/format.pm:23 #, perl-format msgid "unsupported page format %s" msgstr "nicht unterstütztes Seitenformat %s" @@ -276,7 +276,8 @@ msgstr "Es ist Ihnen nicht erlaubt, Dateizugriffsrechte zu ändern" #: ../IkiWiki/Plugin/google.pm:27 #, perl-format msgid "Must specify %s when using the google search plugin" -msgstr "%s muss angegeben werden, wenn die Google-Sucherweiterung verwandt wird" +msgstr "" +"%s muss angegeben werden, wenn die Google-Sucherweiterung verwandt wird" #: ../IkiWiki/Plugin/google.pm:31 msgid "Failed to parse url, cannot determine domain name" @@ -320,17 +321,17 @@ msgstr "Größenänderung fehlgeschlagen: %s" msgid "failed to determine size of image %s" msgstr "Größe des Bildes %s konnte nicht festgestellt werden." -#: ../IkiWiki/Plugin/inline.pm:93 +#: ../IkiWiki/Plugin/inline.pm:92 msgid "Must specify url to wiki with --url when using --rss or --atom" msgstr "" "Die URL zum Wiki muss mit --url angegeben werden, wenn --rss oder --atom " "genutzt wird" -#: ../IkiWiki/Plugin/inline.pm:139 +#: ../IkiWiki/Plugin/inline.pm:138 msgid "page editing not allowed" msgstr "Seitenbearbeitungen sind nicht erlaubt" -#: ../IkiWiki/Plugin/inline.pm:156 +#: ../IkiWiki/Plugin/inline.pm:155 msgid "missing pages parameter" msgstr "Fehlender Seitenparameter" @@ -339,20 +340,20 @@ msgstr "Fehlender Seitenparameter" msgid "unknown sort type %s" msgstr "Unbekannter Sortierungstyp %s" -#: ../IkiWiki/Plugin/inline.pm:285 +#: ../IkiWiki/Plugin/inline.pm:297 msgid "Add a new post titled:" msgstr "Füge einen neuen Beitrag hinzu. Titel:" -#: ../IkiWiki/Plugin/inline.pm:301 +#: ../IkiWiki/Plugin/inline.pm:318 #, perl-format msgid "nonexistant template %s" msgstr "nicht-vorhandene Vorlage %s" -#: ../IkiWiki/Plugin/inline.pm:335 ../IkiWiki/Render.pm:83 +#: ../IkiWiki/Plugin/inline.pm:352 ../IkiWiki/Render.pm:83 msgid "Discussion" msgstr "Diskussion" -#: ../IkiWiki/Plugin/inline.pm:572 +#: ../IkiWiki/Plugin/inline.pm:577 msgid "RPC::XML::Client not found, not pinging" msgstr "RPC::XML::Client nicht gefunden, führe Ping nicht aus" @@ -568,20 +569,18 @@ msgstr "Unzulässiger Prozentwert (%s)" #: ../IkiWiki/Plugin/progress.pm:59 msgid "need either `percent` or `totalpages` and `donepages` parameters" -msgstr "" -"Benötige entweder »percent«- oder »totalpages«- und " -"»donepages«-Parameter" +msgstr "Benötige entweder »percent«- oder »totalpages«- und »donepages«-Parameter" -#: ../IkiWiki/Plugin/recentchanges.pm:100 +#: ../IkiWiki/Plugin/recentchanges.pm:101 msgid "missing page" msgstr "fehlende Seite" -#: ../IkiWiki/Plugin/recentchanges.pm:102 +#: ../IkiWiki/Plugin/recentchanges.pm:103 #, perl-format msgid "The page %s does not exist." msgstr "Die Seite %s existiert nicht." -#: ../IkiWiki/Plugin/recentchangesdiff.pm:36 +#: ../IkiWiki/Plugin/recentchangesdiff.pm:37 msgid "(Diff truncated)" msgstr "(Diff beschnitten)" @@ -593,7 +592,8 @@ msgstr "%s existiert nicht" #: ../IkiWiki/Plugin/remove.pm:38 #, perl-format msgid "%s is not in the srcdir, so it cannot be deleted" -msgstr "%s ist nicht im Quellverzeichnis und kann deshalb nicht gelöscht werden" +msgstr "" +"%s ist nicht im Quellverzeichnis und kann deshalb nicht gelöscht werden" #: ../IkiWiki/Plugin/remove.pm:41 ../IkiWiki/Plugin/rename.pm:45 #, perl-format @@ -928,19 +928,19 @@ msgstr "Dateiname des Wrappers nicht angegeben" #. translators: The first parameter is a filename, and the second is #. translators: a (probably not translated) error message. -#: ../IkiWiki/Wrapper.pm:79 +#: ../IkiWiki/Wrapper.pm:97 #, perl-format msgid "failed to write %s: %s" msgstr "Schreiben von %s fehlgeschlagen: %s" #. translators: The parameter is a C filename. -#: ../IkiWiki/Wrapper.pm:135 +#: ../IkiWiki/Wrapper.pm:154 #, perl-format msgid "failed to compile %s" msgstr "Erzeugen von %s fehlgeschlagen" #. translators: The parameter is a filename. -#: ../IkiWiki/Wrapper.pm:155 +#: ../IkiWiki/Wrapper.pm:174 #, perl-format msgid "successfully generated %s" msgstr "%s wurde erfolgreich erstellt" @@ -953,43 +953,43 @@ msgstr "Benutzung: ikiwiki [Optionen] Quelle Ziel" msgid " ikiwiki --setup configfile" msgstr " ikiwiki --setup Konfigurationsdatei " -#: ../ikiwiki.in:90 +#: ../ikiwiki.in:91 msgid "usage: --set var=value" msgstr "Benutzung: --set Variable=Wert" -#: ../ikiwiki.in:138 +#: ../ikiwiki.in:139 msgid "generating wrappers.." msgstr "erzeuge Wrapper..." -#: ../ikiwiki.in:195 +#: ../ikiwiki.in:197 msgid "rebuilding wiki.." msgstr "erzeuge Wiki neu..." -#: ../ikiwiki.in:198 +#: ../ikiwiki.in:200 msgid "refreshing wiki.." msgstr "aktualisiere Wiki..." -#: ../IkiWiki.pm:466 +#: ../IkiWiki.pm:480 msgid "Must specify url to wiki with --url when using --cgi" msgstr "" "Es muss eine URL zum Wiki mit --url angegeben werden, wenn --cgi verwandt " "wird" -#: ../IkiWiki.pm:512 +#: ../IkiWiki.pm:526 msgid "cannot use multiple rcs plugins" msgstr "Kann nicht mehrere Versionskontrollsystem-Erweiterungen verwenden" -#: ../IkiWiki.pm:541 +#: ../IkiWiki.pm:555 #, perl-format msgid "failed to load external plugin needed for %s plugin: %s" msgstr "Laden der für %s benötigten externen Erweiterung fehlgeschlagen: %s" -#: ../IkiWiki.pm:1165 +#: ../IkiWiki.pm:1187 #, perl-format msgid "preprocessing loop detected on %s at depth %i" msgstr "Präprozessorschleife auf %s in Tiefe %i erkannt" -#: ../IkiWiki.pm:1678 +#: ../IkiWiki.pm:1688 msgid "yes" msgstr "ja" diff --git a/po/fr.po b/po/fr.po index b8e84f930..ebc21fd9a 100644 --- a/po/fr.po +++ b/po/fr.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: ikiwiki 2.70 \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-10-31 16:37-0400\n" +"POT-Creation-Date: 2008-12-11 14:46-0500\n" "PO-Revision-Date: 2008-11-19 21:53+0100\n" "Last-Translator: Philippe Batailler \n" "Language-Team: French \n" @@ -49,7 +49,7 @@ msgstr "Les préférences ont été enregistrées." msgid "You are banned." msgstr "Vous avez été banni." -#: ../IkiWiki/CGI.pm:385 ../IkiWiki/CGI.pm:386 ../IkiWiki.pm:1182 +#: ../IkiWiki/CGI.pm:385 ../IkiWiki/CGI.pm:386 ../IkiWiki.pm:1204 msgid "Error" msgstr "Erreur" @@ -112,16 +112,16 @@ msgstr "Flux introuvable " msgid "(invalid UTF-8 stripped from feed)" msgstr "(chaîne UTF-8 non valable supprimée du flux)" -#: ../IkiWiki/Plugin/aggregate.pm:504 +#: ../IkiWiki/Plugin/aggregate.pm:506 #, perl-format msgid "(feed entities escaped)" msgstr "(échappement des entités de flux)" -#: ../IkiWiki/Plugin/aggregate.pm:510 +#: ../IkiWiki/Plugin/aggregate.pm:514 msgid "feed crashed XML::Feed!" msgstr "Plantage du flux XML::Feed !" -#: ../IkiWiki/Plugin/aggregate.pm:590 +#: ../IkiWiki/Plugin/aggregate.pm:595 #, perl-format msgid "creating new page %s" msgstr "Création de la nouvelle page %s" @@ -130,7 +130,7 @@ msgstr "Création de la nouvelle page %s" msgid "deleting bucket.." msgstr "suppression du compartiment S3 (« bucket »)..." -#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:206 +#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:208 msgid "done" msgstr "Terminé" @@ -173,7 +173,7 @@ msgid "automatic index generation" msgstr "génération de l'index automatique" #: ../IkiWiki/Plugin/brokenlinks.pm:33 ../IkiWiki/Plugin/editpage.pm:261 -#: ../IkiWiki/Plugin/inline.pm:327 ../IkiWiki/Plugin/opendiscussion.pm:26 +#: ../IkiWiki/Plugin/inline.pm:344 ../IkiWiki/Plugin/opendiscussion.pm:26 #: ../IkiWiki/Plugin/orphans.pm:37 ../IkiWiki/Render.pm:79 #: ../IkiWiki/Render.pm:149 msgid "discussion" @@ -247,11 +247,11 @@ msgstr "edittemplate %s enregistré pour %s" msgid "failed to process" msgstr "Échec du traitement" -#: ../IkiWiki/Plugin/format.pm:22 +#: ../IkiWiki/Plugin/format.pm:20 msgid "must specify format and text" msgstr "le format et le texte doivent être indiqués" -#: ../IkiWiki/Plugin/format.pm:25 +#: ../IkiWiki/Plugin/format.pm:23 #, perl-format msgid "unsupported page format %s" msgstr "format de page non reconnu %s" @@ -321,17 +321,17 @@ msgstr "Échec du redimensionnement : %s" msgid "failed to determine size of image %s" msgstr "Échec de la détermination de la taille de l'image : %s" -#: ../IkiWiki/Plugin/inline.pm:93 +#: ../IkiWiki/Plugin/inline.pm:92 msgid "Must specify url to wiki with --url when using --rss or --atom" msgstr "" "Vous devez indiquer l'URL du wiki par --url lors de l'utilisation de --rss " "ou --atom" -#: ../IkiWiki/Plugin/inline.pm:139 +#: ../IkiWiki/Plugin/inline.pm:138 msgid "page editing not allowed" msgstr "Modification de page interdite" -#: ../IkiWiki/Plugin/inline.pm:156 +#: ../IkiWiki/Plugin/inline.pm:155 msgid "missing pages parameter" msgstr "paramètre « pages » manquant" @@ -340,20 +340,20 @@ msgstr "paramètre « pages » manquant" msgid "unknown sort type %s" msgstr "Type de tri %s inconnu" -#: ../IkiWiki/Plugin/inline.pm:285 +#: ../IkiWiki/Plugin/inline.pm:297 msgid "Add a new post titled:" msgstr "Ajouter un nouvel article dont le titre est :" -#: ../IkiWiki/Plugin/inline.pm:301 +#: ../IkiWiki/Plugin/inline.pm:318 #, perl-format msgid "nonexistant template %s" msgstr "Le modèle de page %s n'existe pas" -#: ../IkiWiki/Plugin/inline.pm:335 ../IkiWiki/Render.pm:83 +#: ../IkiWiki/Plugin/inline.pm:352 ../IkiWiki/Render.pm:83 msgid "Discussion" msgstr "Discussion" -#: ../IkiWiki/Plugin/inline.pm:572 +#: ../IkiWiki/Plugin/inline.pm:577 msgid "RPC::XML::Client not found, not pinging" msgstr "RPC::XML::Client introuvable, pas de réponse au ping" @@ -573,16 +573,16 @@ msgid "need either `percent` or `totalpages` and `donepages` parameters" msgstr "" "L'un des paramètres « percent », « totalpages » ou « donepages » est nécessaire." -#: ../IkiWiki/Plugin/recentchanges.pm:100 +#: ../IkiWiki/Plugin/recentchanges.pm:101 msgid "missing page" msgstr "Page manquante" -#: ../IkiWiki/Plugin/recentchanges.pm:102 +#: ../IkiWiki/Plugin/recentchanges.pm:103 #, perl-format msgid "The page %s does not exist." msgstr "La page %s n'existe pas." -#: ../IkiWiki/Plugin/recentchangesdiff.pm:36 +#: ../IkiWiki/Plugin/recentchangesdiff.pm:37 msgid "(Diff truncated)" msgstr "(fichier de différences tronqué)" @@ -820,12 +820,14 @@ msgstr "" #: ../IkiWiki/Plugin/websetup.pm:433 #, perl-format msgid "

Error: %s exited nonzero (%s)" -msgstr "

Erreur : %s s'est terminé, valeur de sortie nonzero (%s)" +msgstr "" +"

Erreur : %s s'est terminé, valeur de sortie nonzero (%s)" #: ../IkiWiki/Receive.pm:35 #, perl-format msgid "cannot determine id of untrusted committer %s" -msgstr "Impossible de déterminer l'identifiant de %s, (enregistrement non fiable)" +msgstr "" +"Impossible de déterminer l'identifiant de %s, (enregistrement non fiable)" #: ../IkiWiki/Receive.pm:85 #, perl-format @@ -929,19 +931,19 @@ msgstr "Le nom du fichier CGI n'a pas été indiqué" #. translators: The first parameter is a filename, and the second is #. translators: a (probably not translated) error message. -#: ../IkiWiki/Wrapper.pm:79 +#: ../IkiWiki/Wrapper.pm:97 #, perl-format msgid "failed to write %s: %s" msgstr "Échec de l'écriture de %s : %s" #. translators: The parameter is a C filename. -#: ../IkiWiki/Wrapper.pm:135 +#: ../IkiWiki/Wrapper.pm:154 #, perl-format msgid "failed to compile %s" msgstr "Échec de la compilation de %s" #. translators: The parameter is a filename. -#: ../IkiWiki/Wrapper.pm:155 +#: ../IkiWiki/Wrapper.pm:174 #, perl-format msgid "successfully generated %s" msgstr "%s a été créé avec succès" @@ -954,41 +956,42 @@ msgstr "Syntaxe : ikiwiki [options] source destination" msgid " ikiwiki --setup configfile" msgstr " ikiwiki --setup fichier de configuration" -#: ../ikiwiki.in:90 +#: ../ikiwiki.in:91 msgid "usage: --set var=value" msgstr "Syntaxe : -- set var=valeur" -#: ../ikiwiki.in:138 +#: ../ikiwiki.in:139 msgid "generating wrappers.." msgstr "Création des fichiers CGI..." -#: ../ikiwiki.in:195 +#: ../ikiwiki.in:197 msgid "rebuilding wiki.." msgstr "Reconstruction du wiki..." -#: ../ikiwiki.in:198 +#: ../ikiwiki.in:200 msgid "refreshing wiki.." msgstr "Rafraîchissement du wiki..." -#: ../IkiWiki.pm:466 +#: ../IkiWiki.pm:480 msgid "Must specify url to wiki with --url when using --cgi" -msgstr "Vous devez indiquer l'URL du wiki par --url lors de l'utilisation de --cgi" +msgstr "" +"Vous devez indiquer l'URL du wiki par --url lors de l'utilisation de --cgi" -#: ../IkiWiki.pm:512 +#: ../IkiWiki.pm:526 msgid "cannot use multiple rcs plugins" msgstr "impossible d'utiliser plusieurs systèmes de contrôle des versions" -#: ../IkiWiki.pm:541 +#: ../IkiWiki.pm:555 #, perl-format msgid "failed to load external plugin needed for %s plugin: %s" msgstr "Impossible de charger le greffon externe nécessaire au greffon %s : %s" -#: ../IkiWiki.pm:1165 +#: ../IkiWiki.pm:1187 #, perl-format msgid "preprocessing loop detected on %s at depth %i" msgstr "une boucle de pré traitement a été détectée sur %s à hauteur de %i" -#: ../IkiWiki.pm:1678 +#: ../IkiWiki.pm:1688 msgid "yes" msgstr "oui" diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot index feb36c742..11c865363 100644 --- a/po/ikiwiki.pot +++ b/po/ikiwiki.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-11-11 20:48-0500\n" +"POT-Creation-Date: 2008-12-11 14:46-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -48,7 +48,7 @@ msgstr "" msgid "You are banned." msgstr "" -#: ../IkiWiki/CGI.pm:385 ../IkiWiki/CGI.pm:386 ../IkiWiki.pm:1189 +#: ../IkiWiki/CGI.pm:385 ../IkiWiki/CGI.pm:386 ../IkiWiki.pm:1204 msgid "Error" msgstr "" @@ -111,16 +111,16 @@ msgstr "" msgid "(invalid UTF-8 stripped from feed)" msgstr "" -#: ../IkiWiki/Plugin/aggregate.pm:504 +#: ../IkiWiki/Plugin/aggregate.pm:506 #, perl-format msgid "(feed entities escaped)" msgstr "" -#: ../IkiWiki/Plugin/aggregate.pm:510 +#: ../IkiWiki/Plugin/aggregate.pm:514 msgid "feed crashed XML::Feed!" msgstr "" -#: ../IkiWiki/Plugin/aggregate.pm:591 +#: ../IkiWiki/Plugin/aggregate.pm:595 #, perl-format msgid "creating new page %s" msgstr "" @@ -129,7 +129,7 @@ msgstr "" msgid "deleting bucket.." msgstr "" -#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:206 +#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:208 msgid "done" msgstr "" @@ -172,7 +172,7 @@ msgid "automatic index generation" msgstr "" #: ../IkiWiki/Plugin/brokenlinks.pm:33 ../IkiWiki/Plugin/editpage.pm:261 -#: ../IkiWiki/Plugin/inline.pm:327 ../IkiWiki/Plugin/opendiscussion.pm:26 +#: ../IkiWiki/Plugin/inline.pm:344 ../IkiWiki/Plugin/opendiscussion.pm:26 #: ../IkiWiki/Plugin/orphans.pm:37 ../IkiWiki/Render.pm:79 #: ../IkiWiki/Render.pm:149 msgid "discussion" @@ -320,15 +320,15 @@ msgstr "" msgid "failed to determine size of image %s" msgstr "" -#: ../IkiWiki/Plugin/inline.pm:93 +#: ../IkiWiki/Plugin/inline.pm:92 msgid "Must specify url to wiki with --url when using --rss or --atom" msgstr "" -#: ../IkiWiki/Plugin/inline.pm:139 +#: ../IkiWiki/Plugin/inline.pm:138 msgid "page editing not allowed" msgstr "" -#: ../IkiWiki/Plugin/inline.pm:156 +#: ../IkiWiki/Plugin/inline.pm:155 msgid "missing pages parameter" msgstr "" @@ -337,20 +337,20 @@ msgstr "" msgid "unknown sort type %s" msgstr "" -#: ../IkiWiki/Plugin/inline.pm:285 +#: ../IkiWiki/Plugin/inline.pm:297 msgid "Add a new post titled:" msgstr "" -#: ../IkiWiki/Plugin/inline.pm:301 +#: ../IkiWiki/Plugin/inline.pm:318 #, perl-format msgid "nonexistant template %s" msgstr "" -#: ../IkiWiki/Plugin/inline.pm:335 ../IkiWiki/Render.pm:83 +#: ../IkiWiki/Plugin/inline.pm:352 ../IkiWiki/Render.pm:83 msgid "Discussion" msgstr "" -#: ../IkiWiki/Plugin/inline.pm:572 +#: ../IkiWiki/Plugin/inline.pm:577 msgid "RPC::XML::Client not found, not pinging" msgstr "" @@ -563,16 +563,16 @@ msgstr "" msgid "need either `percent` or `totalpages` and `donepages` parameters" msgstr "" -#: ../IkiWiki/Plugin/recentchanges.pm:100 +#: ../IkiWiki/Plugin/recentchanges.pm:101 msgid "missing page" msgstr "" -#: ../IkiWiki/Plugin/recentchanges.pm:102 +#: ../IkiWiki/Plugin/recentchanges.pm:103 #, perl-format msgid "The page %s does not exist." msgstr "" -#: ../IkiWiki/Plugin/recentchangesdiff.pm:36 +#: ../IkiWiki/Plugin/recentchangesdiff.pm:37 msgid "(Diff truncated)" msgstr "" @@ -935,41 +935,41 @@ msgstr "" msgid " ikiwiki --setup configfile" msgstr "" -#: ../ikiwiki.in:90 +#: ../ikiwiki.in:91 msgid "usage: --set var=value" msgstr "" -#: ../ikiwiki.in:138 +#: ../ikiwiki.in:139 msgid "generating wrappers.." msgstr "" -#: ../ikiwiki.in:195 +#: ../ikiwiki.in:197 msgid "rebuilding wiki.." msgstr "" -#: ../ikiwiki.in:198 +#: ../ikiwiki.in:200 msgid "refreshing wiki.." msgstr "" -#: ../IkiWiki.pm:473 +#: ../IkiWiki.pm:480 msgid "Must specify url to wiki with --url when using --cgi" msgstr "" -#: ../IkiWiki.pm:519 +#: ../IkiWiki.pm:526 msgid "cannot use multiple rcs plugins" msgstr "" -#: ../IkiWiki.pm:548 +#: ../IkiWiki.pm:555 #, perl-format msgid "failed to load external plugin needed for %s plugin: %s" msgstr "" -#: ../IkiWiki.pm:1172 +#: ../IkiWiki.pm:1187 #, perl-format msgid "preprocessing loop detected on %s at depth %i" msgstr "" -#: ../IkiWiki.pm:1673 +#: ../IkiWiki.pm:1688 msgid "yes" msgstr "" -- cgit v1.2.3 From 574640b06943939d08ff99833f8028e091a6daf2 Mon Sep 17 00:00:00 2001 From: tschwinge Date: Thu, 11 Dec 2008 19:36:36 -0500 Subject: Fix cut'n'past-o. --- doc/plugins/cutpaste.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/cutpaste.mdwn b/doc/plugins/cutpaste.mdwn index 1b78e60fc..f74f8a269 100644 --- a/doc/plugins/cutpaste.mdwn +++ b/doc/plugins/cutpaste.mdwn @@ -1,4 +1,4 @@ -[[!template id=plugin name=toggle author="[[Enrico]]"]] +[[!template id=plugin name=cutpaste author="[[Enrico]]"]] [[!tag type/chrome]] This plugin provides the [[ikiwiki/directive/cut]], -- cgit v1.2.3 From b8c16705006a8f4562bd2f2b525a9d978ed18a8b Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Fri, 12 Dec 2008 06:29:02 -0500 Subject: update with some more code improvements --- doc/plugins/contrib/comments.mdwn | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/comments.mdwn b/doc/plugins/contrib/comments.mdwn index a832c571a..47295ebe1 100644 --- a/doc/plugins/contrib/comments.mdwn +++ b/doc/plugins/contrib/comments.mdwn @@ -50,12 +50,12 @@ can use the following additional ``s: * `COMMENTAUTHORURL`: if the user was signed in with an OpenID, that URL; if the user was signed in with some other username, a CGI URL that redirects to their user page (if any) -This plugin also adds a `\[[!comment]]` directive which is used when storing comments. This -directive shouldn't be used on pages that are edited in the usual way. +This plugin also adds a `\[[!_comment]]` directive which is used when storing comments. This +directive is for internal use only and shouldn't be used on pages that are edited in the usual way. This plugin aims to close the [[todo]] item "[[todo/supporting_comments_via_disussion_pages]]", and is currently available from [[smcv]]'s git repository on git.pseudorandom.co.uk (it's the -`comments-rebase1` branch). A demo wiki with the plugin enabled is running at +`comments-rebase2` branch). A demo wiki with the plugin enabled is running at ; the [sandbox page](http://www.pseudorandom.co.uk/2008/ikiwiki/demo/sandbox/#comments) has some examples of comments. @@ -67,11 +67,8 @@ Known issues: * There is some common code cargo-culted from other plugins (notably inline and editpage) which should probably be shared * Joey doesn't think it should necessarily use internal pages (see [[discussion]]) -* `\[[!comment]]` should perhaps be `\[[!_comment]]`, or a special filter/htmlize hook rather - than being a directive at all * Previews always say "unknown IP address" -* [[todo/inline_plugin:_ability_to_override_the_feed_name]] -* [[todo/inline_plugin:_hide_feed_buttons_if_empty]] +* Add `COMMENTOPENID`: the authenticated/verified user name, if and only if it was an OpenID > I haven't done a detailed code review, but I will say I'm pleased you > avoided re-implementing inline! --[[Joey]] @@ -84,5 +81,9 @@ Fixed issues: * tbm wanted anonymous people to be able to enter their name and possibly email address; a name and website can now be supplied * There is now an indication of who you're signed in as -* Each comment is now one big \[[!comment]] directive invocation, avoiding previous +* Each comment is now one big \[[!_comment]] directive invocation, avoiding previous issues with unambiguous and un-spoofable metadata +* `\[[!comment]]` should be `\[[!_comment]]`, or a special filter/htmlize hook rather + than being a directive at all +* [[todo/inline_plugin:_ability_to_override_the_feed_name]] +* [[todo/inline_plugin:_hide_feed_buttons_if_empty]] -- cgit v1.2.3 From 5625be3bcd76b5990cb7799437def3521cc53a9d Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Fri, 12 Dec 2008 06:34:51 -0500 Subject: Another TODO item --- doc/plugins/contrib/comments.mdwn | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/comments.mdwn b/doc/plugins/contrib/comments.mdwn index 47295ebe1..d2ca8d17d 100644 --- a/doc/plugins/contrib/comments.mdwn +++ b/doc/plugins/contrib/comments.mdwn @@ -69,6 +69,8 @@ Known issues: * Joey doesn't think it should necessarily use internal pages (see [[discussion]]) * Previews always say "unknown IP address" * Add `COMMENTOPENID`: the authenticated/verified user name, if and only if it was an OpenID +* The default template should have a (?) icon next to unauthenticated users (with the IP address + as title) and an OpenID icon next to OpenIDs > I haven't done a detailed code review, but I will say I'm pleased you > avoided re-implementing inline! --[[Joey]] -- cgit v1.2.3 From 9d5075ab521a24d718a2b663e11856c8cc80eb03 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 12 Dec 2008 14:52:05 -0500 Subject: first pass through comments documentation Moved documentation out of contrib. Mostly tweaked some wording. Moved documentation of various bits to other pages (pagespec, etc), and linked to those. Documented the new templates in wikitemplates. Small quantities of documentation were removed. Particularly the list of template variables, which I think is fairly obvious when editing the template. --- doc/ikiwiki/pagespec.mdwn | 2 + doc/plugins/anonok.mdwn | 7 +- doc/plugins/comments.mdwn | 52 +++++++++ doc/plugins/comments/discussion.mdwn | 160 +++++++++++++++++++++++++++ doc/plugins/contrib/comments.mdwn | 91 --------------- doc/plugins/contrib/comments/discussion.mdwn | 160 --------------------------- doc/plugins/lockedit.mdwn | 4 + doc/wikitemplates.mdwn | 4 + 8 files changed, 228 insertions(+), 252 deletions(-) create mode 100644 doc/plugins/comments.mdwn create mode 100644 doc/plugins/comments/discussion.mdwn delete mode 100644 doc/plugins/contrib/comments.mdwn delete mode 100644 doc/plugins/contrib/comments/discussion.mdwn (limited to 'doc/plugins') diff --git a/doc/ikiwiki/pagespec.mdwn b/doc/ikiwiki/pagespec.mdwn index c78666c40..90b96c936 100644 --- a/doc/ikiwiki/pagespec.mdwn +++ b/doc/ikiwiki/pagespec.mdwn @@ -47,6 +47,8 @@ Some more elaborate limits can be added to what matches using these functions: wiki admins. * "`ip(address)`" - tests whether a modification is being made from the specified IP address. +* "`postcomment(glob)`" - matches internal-use pages created by the + comments plugin as comments for pages that match the specified glob. For example, to match all pages in a blog that link to the page about music and were written in 2005: diff --git a/doc/plugins/anonok.mdwn b/doc/plugins/anonok.mdwn index 2a8a922cd..ab2f744e2 100644 --- a/doc/plugins/anonok.mdwn +++ b/doc/plugins/anonok.mdwn @@ -5,5 +5,10 @@ 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 +The plugin also has a configuration setting, `anonok_pages`. This [[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: + + anonok_pages => "postcomment(*)" diff --git a/doc/plugins/comments.mdwn b/doc/plugins/comments.mdwn new file mode 100644 index 000000000..347d7fc8d --- /dev/null +++ b/doc/plugins/comments.mdwn @@ -0,0 +1,52 @@ +[[!template id=plugin name=comments author="[[Simon_McVittie|smcv]]"]] +[[!tag type/useful]] + +This plugin adds "blog-style" comments. Unlike the wiki-style freeform +Discussion pages, these comments are posted by a simple form, cannot later +be edited, and rss/atom feeds are provided of each page's comments. + +When using this plugin, you should also enable [[htmlscrubber]] and either +[[htmltidy]] or [[htmlbalance]]. Directives are filtered out by default, to +avoid commenters slowing down the wiki by causing time-consuming +processing. As long as the recommended plugins are enabled, comment +authorship should hopefully be unforgeable by CGI users. + +The intention is that on a non-wiki site (like a blog) you can lock all +pages for admin-only access, then allow otherwise unprivileged (or perhaps +even anonymous) users to comment on posts. See the documentation of the +[[lockedit]] and [[anonok]] pages for details on locking down a wiki so +users can only post comments. + +Individual comments are stored as internal-use pages named something like +`page/comment_1`, `page/comment_2`, etc. These pages internally use a +`\[[!_comment]]` [[ikiwiki/directive]], and comment pages can be matched +using a special `postcomment()` [[ikiwiki/PageSpec]]. + +There are some global options for the setup file: + +* `comments_shown_pagespec`: pages where comments will be displayed inline, + e.g. `blog/*` or `!*/discussion`. +* `comments_open_pagespec`: pages where new comments can be posted, e.g. + `blog/* and created_after(close_old_comments)` or `!*/discussion` +* `comments_pagename`: if this is e.g. `comment_` (the default), then + comment pages will be named something like `page/comment_12` +* `comments_allowdirectives`: if true (default false), comments may + contain IkiWiki [[directives|ikiwiki/directive]] +* `comments_commit`: if true (default true), comments will be committed to + the version control system +* `comments_allowauthor`: if true (default false), anonymous commenters may + specify a name for themselves, and the \[[!meta author]] and + \[[!meta authorurl]] directives will not be overridden by the comments + plugin + +Known issues: + +* Needs code review +* The access control via postcomment() is rather strange (see [[discussion]] for more details) +* There is some common code cargo-culted from other plugins (notably inline and editpage) which + should probably be shared +* Joey doesn't think it should necessarily use internal pages (see [[discussion]]) +* Previews always say "unknown IP address" +* Add `COMMENTOPENID`: the authenticated/verified user name, if and only if it was an OpenID +* The default template should have a (?) icon next to unauthenticated users (with the IP address + as title) and an OpenID icon next to OpenIDs diff --git a/doc/plugins/comments/discussion.mdwn b/doc/plugins/comments/discussion.mdwn new file mode 100644 index 000000000..59740ec37 --- /dev/null +++ b/doc/plugins/comments/discussion.mdwn @@ -0,0 +1,160 @@ +## Why internal pages? (unresolved) + +Comments are saved as internal pages, so they can never be edited through the CGI, +only by direct committers. + +> So, why do it this way, instead of using regular wiki pages in a +> namespace, such as `$page/comments/*`? Then you could use [[plugins/lockedit]] to +> limit editing of comments in more powerful ways. --[[Joey]] + +>> Er... I suppose so. I'd assumed that these pages ought to only exist as inlines +>> rather than as individual pages (same reasoning as aggregated posts), though. +>> +>> lockedit is actually somewhat insufficient, since `check_canedit()` +>> doesn't distinguish between creation and editing; I'd have to continue to use +>> some sort of odd hack to allow creation but not editing. +>> +>> I also can't think of any circumstance where you'd want a user other than +>> admins (~= git committers) and possibly the commenter (who we can't check for +>> at the moment anyway, I don't think?) to be able to edit comments - I think +>> user expectations for something that looks like ordinary blog comments are +>> likely to include "others can't put words into my mouth". +>> +>> My other objection to using a namespace is that I'm not particularly happy about +>> plugins consuming arbitrary pieces of the wiki namespace - /discussion is bad +>> enough already. Indeed, this very page would accidentally get matched by rules +>> aiming to control comment-posting... :-) --[[smcv]] + +>>> Thinking about it, perhaps one way to address this would be to have the suffix +>>> (e.g. whether commenting on Sandbox creates sandbox/comment1 or sandbox/c1 or +>>> what) be configurable by the wiki admin, in the same way that recentchanges has +>>> recentchangespage => 'recentchanges'? I'd like to see fewer hard-coded page +>>> names in general, really - it seems odd to me that shortcuts and smileys +>>> hard-code the name of the page to look at. Perhaps I could add +>>> discussionpage => 'discussion' too? --[[smcv]] + +>>> (I've now implemented this in my branch. --[[smcv]]) + +>> The best reason to keep the pages internal seems to me to be that you +>> don't want the overhead of every comment spawning its own wiki page. --[[Joey]] + +## Formats (resolved) + +The plugin now allows multiple comment formats while still using internal +pages; each comment is saved as a page containing one `\[[!comment]]` directive, +which has a superset of the functionality of [[ikiwiki/directives/format]]. + +## Access control (unresolved?) + +By the way, I think that who can post comments should be controllable by +the existing plugins opendiscussion, anonok, signinedit, and lockedit. Allowing +posting comments w/o any login, while a nice capability, can lead to +spam problems. So, use `check_canedit` as at least a first-level check? +--[[Joey]] + +> This plugin already uses `check_canedit`, but that function doesn't have a concept +> of different actions. The hack I use is that when a user comments on, say, sandbox, +> I call `check_canedit` for the pseudo-page "sandbox[postcomment]". The +> special `postcomment(glob)` [[ikiwiki/pagespec]] returns true if the page ends with +> "[postcomment]" and the part before (e.g. sandbox) matches the glob. So, you can +> have postcomment(blog/*) or something. (Perhaps instead of taking a glob, postcomment +> should take a pagespec, so you can have postcomment(link(tags/commentable))?) +> +> This is why `anonok_pages => 'postcomment(*)'` and `locked_pages => '!postcomment(*)'` +> are necessary to allow anonymous and logged-in editing (respectively). +> +> This is ugly - one alternative would be to add `check_permission()` that takes a +> page and a verb (create, edit, rename, remove and maybe comment are the ones I +> can think of so far), use that, and port the plugins you mentioned to use that +> API too. This plugin could either call `check_can("$page/comment1", 'create')` or +> call `check_can($page, 'comment')`. +> +> One odd effect of the code structure I've used is that we check for the ability to +> create the page before we actually know what page name we're going to use - when +> posting the comment I just increment a number until I reach an unused one - so +> either the code needs restructuring, or the permission check for 'create' would +> always be for 'comment1' and never 'comment123'. --[[smcv]] + +>> Now resolved, in fact --[[smcv]] + +> Another possibility is to just check for permission to edit (e.g.) `sandbox/comment1`. +> However, this makes the "comments can only be created, not edited" feature completely +> reliant on the fact that internal pages can't be edited. Perhaps there should be a +> `editable_pages` pagespec, defaulting to `'*'`? --[[smcv]] + +## comments directive vs global setting (resolved?) + +When comments have been enabled generally, you still need to mark which pages +can have comments, by including the `\[[!comments]]` directive in them. By default, +this directive expands to a "post a comment" link plus an `\[[!inline]]` with +the comments. [This requirement has now been removed --[[smcv]]] + +> I don't like this, because it's hard to explain to someone why they have +> to insert this into every post to their blog. Seems that the model used +> for discussion pages could work -- if comments are enabled, automatically +> add the comment posting form and comments to the end of each page. +> --[[Joey]] + +>> I don't think I'd want comments on *every* page (particularly, not the +>> front page). Perhaps a pagespec in the setup file, where the default is "*"? +>> Then control freaks like me could use "link(tags/comments)" and tag pages +>> as allowing comments. +>> +>>> Yes, I think a pagespec is the way to go. --[[Joey]] + +>>>> Implemented --[[smcv]] + +>> +>> The model used for discussion pages does require patching the existing +>> page template, which I was trying to avoid - I'm not convinced that having +>> every possible feature hard-coded there really scales (and obviously it's +>> rather annoying while this plugin is on a branch). --[[smcv]] + +>>> Using the template would allow customising the html around the comments +>>> which seems like a good thing? --[[Joey]] + +>>>> The \[[!comments]] directive is already template-friendly - it expands to +>>>> the contents of the template `comments_embed.tmpl`, possibly with the +>>>> result of an \[[!inline]] appended. I should change `comments_embed.tmpl` +>>>> so it uses a template variable `INLINE` for the inline result rather than +>>>> having the perl code concatenate it, which would allow a bit more +>>>> customization (whether the "post" link was before or after the inline). +>>>> Even if you want comments in page.tmpl, keeping the separate comments_embed.tmpl +>>>> and having a `COMMENTS` variable in page.tmpl might be the way forward, +>>>> since the smaller each templates is, the easier it will be for users +>>>> to maintain a patched set of templates. (I think so, anyway, based on what happens +>>>> with dpkg prompts in Debian packages with monolithic vs split +>>>> conffiles.) --[[smcv]] + +>>>>> I've switched my branch to use page.tmpl instead; see what you think? --[[smcv]] + +## Raw HTML (resolved?) + +Raw HTML was not initially allowed by default (this was configurable). + +> I'm not sure that raw html should be a problem, as long as the +> htmlsanitizer and htmlbalanced plugins are enabled. I can see filtering +> out directives, as a special case. --[[Joey]] + +>> Right, if I sanitize each post individually, with htmlscrubber and either htmltidy +>> or htmlbalance turned on, then there should be no way the user can forge a comment; +>> I was initially wary of allowing meta directives, but I think those are OK, as long +>> as the comment template puts the \[[!meta author]] at the *end*. Disallowing +>> directives is more a way to avoid commenters causing expensive processing than +>> anything else, at this point. +>> +>> I've rebased the plugin on master, made it sanitize individual posts' content +>> and removed the option to disallow raw HTML. Sanitizing individual posts before +>> they've been htmlized required me to preserve whitespace in the htmlbalance +>> plugin, so I did that. Alternatively, we could htmlize immediately and always +>> save out raw HTML? --[[smcv]] + +>>> There might be some use cases for other directives, such as img, in +>>> comments. +>>> +>>> I don't know if meta is "safe" (ie, guaranteed to be inexpensive and not +>>> allow users to do annoying things) or if it will continue to be in the +>>> future. Hard to predict really, all that can be said with certainty is +>>> 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]] diff --git a/doc/plugins/contrib/comments.mdwn b/doc/plugins/contrib/comments.mdwn deleted file mode 100644 index d2ca8d17d..000000000 --- a/doc/plugins/contrib/comments.mdwn +++ /dev/null @@ -1,91 +0,0 @@ -[[!template id=plugin name=comments author="[[Simon_McVittie|smcv]]"]] -[[!tag type/useful]] - -This plugin adds "blog-style" comments. The intention is that on a non-wiki site -(like a blog) you can lock all pages for admin-only access, then allow otherwise -unprivileged (or perhaps even anonymous) users to comment on posts. - -When using this plugin, you should also enable [[htmlscrubber]] and either [[htmltidy]] -or [[htmlbalance]]. Directives are filtered out by default, to avoid commenters slowing -down the wiki by causing time-consuming processing. As long as the recommended plugins -are enabled, comment authorship should hopefully be unforgeable by CGI users. - -The plugin adds a new [[ikiwiki/PageSpec]] match type, `postcomment`, for use -with `anonok_pagespec` from the [[plugins/anonok]] plugin or `locked_pages` from -the [[plugins/lockedit]] plugin. Typical usage would be something like: - - locked_pages => "!postcomment(*)" - -to allow non-admin users to comment on pages, but not edit anything. You can also do - - anonok_pages => "postcomment(*)" - -to allow anonymous comments (the IP address will be used as the "author"). - -There are some global options for the setup file: - -* `comments_shown_pagespec`: pages where comments will be displayed inline, e.g. `blog/*` - or `*/discussion`. -* `comments_open_pagespec`: pages where new comments can be posted, e.g. - `blog/* and created_after(close_old_comments)` or `*/discussion` -* `comments_pagename`: if this is e.g. `comment_` (the default), then comments on the - [[sandbox]] will be called something like `sandbox/comment_12` -* `comments_allowdirectives`: if true (default false), comments may contain IkiWiki - directives -* `comments_commit`: if true (default true), comments will be committed to the version - control system -* `comments_allowauthor`: if true (default false), anonymous commenters may specify a - name for themselves, and the \[[!meta author]] and \[[!meta authorurl]] directives - will not be overridden by the comments plugin - -Templates that will display comments (by default that means `comments_display.tmpl`) -can use the following additional ``s: - -* `COMMENTUSER`: the authenticated/verified user name, or undefined if the user was not signed in -* `COMMENTIP`: the remote IP address, or undefined if not known (this is not currently recorded - for users who are signed in, who are assumed to be vaguely accountable) -* `COMMENTAUTHOR`: a "prettier" version of the authenticated/verified user name (e.g. OpenIDs are - formatted the same way as in [[RecentChanges]]), or the result of localizing "Anonymous" if the - user was not signed in -* `COMMENTAUTHORURL`: if the user was signed in with an OpenID, that URL; if the user was signed - in with some other username, a CGI URL that redirects to their user page (if any) - -This plugin also adds a `\[[!_comment]]` directive which is used when storing comments. This -directive is for internal use only and shouldn't be used on pages that are edited in the usual way. - -This plugin aims to close the [[todo]] item "[[todo/supporting_comments_via_disussion_pages]]", -and is currently available from [[smcv]]'s git repository on git.pseudorandom.co.uk (it's the -`comments-rebase2` branch). A demo wiki with the plugin enabled is running at -; the -[sandbox page](http://www.pseudorandom.co.uk/2008/ikiwiki/demo/sandbox/#comments) has some -examples of comments. - -Known issues: - -* Needs code review -* The access control via postcomment() is rather strange (see [[discussion]] for more details) -* There is some common code cargo-culted from other plugins (notably inline and editpage) which - should probably be shared -* Joey doesn't think it should necessarily use internal pages (see [[discussion]]) -* Previews always say "unknown IP address" -* Add `COMMENTOPENID`: the authenticated/verified user name, if and only if it was an OpenID -* The default template should have a (?) icon next to unauthenticated users (with the IP address - as title) and an OpenID icon next to OpenIDs - -> I haven't done a detailed code review, but I will say I'm pleased you -> avoided re-implementing inline! --[[Joey]] - -Fixed issues: - -* Joey didn't think the `\[[!comments]]` directive was appropriate; comments now appear - on pages selected with a [[ikiwiki/pagespec]] -* Joey thought that raw HTML should always be allowed; it now is -* tbm wanted anonymous people to be able to enter their name and possibly email - address; a name and website can now be supplied -* There is now an indication of who you're signed in as -* Each comment is now one big \[[!_comment]] directive invocation, avoiding previous - issues with unambiguous and un-spoofable metadata -* `\[[!comment]]` should be `\[[!_comment]]`, or a special filter/htmlize hook rather - than being a directive at all -* [[todo/inline_plugin:_ability_to_override_the_feed_name]] -* [[todo/inline_plugin:_hide_feed_buttons_if_empty]] diff --git a/doc/plugins/contrib/comments/discussion.mdwn b/doc/plugins/contrib/comments/discussion.mdwn deleted file mode 100644 index 59740ec37..000000000 --- a/doc/plugins/contrib/comments/discussion.mdwn +++ /dev/null @@ -1,160 +0,0 @@ -## Why internal pages? (unresolved) - -Comments are saved as internal pages, so they can never be edited through the CGI, -only by direct committers. - -> So, why do it this way, instead of using regular wiki pages in a -> namespace, such as `$page/comments/*`? Then you could use [[plugins/lockedit]] to -> limit editing of comments in more powerful ways. --[[Joey]] - ->> Er... I suppose so. I'd assumed that these pages ought to only exist as inlines ->> rather than as individual pages (same reasoning as aggregated posts), though. ->> ->> lockedit is actually somewhat insufficient, since `check_canedit()` ->> doesn't distinguish between creation and editing; I'd have to continue to use ->> some sort of odd hack to allow creation but not editing. ->> ->> I also can't think of any circumstance where you'd want a user other than ->> admins (~= git committers) and possibly the commenter (who we can't check for ->> at the moment anyway, I don't think?) to be able to edit comments - I think ->> user expectations for something that looks like ordinary blog comments are ->> likely to include "others can't put words into my mouth". ->> ->> My other objection to using a namespace is that I'm not particularly happy about ->> plugins consuming arbitrary pieces of the wiki namespace - /discussion is bad ->> enough already. Indeed, this very page would accidentally get matched by rules ->> aiming to control comment-posting... :-) --[[smcv]] - ->>> Thinking about it, perhaps one way to address this would be to have the suffix ->>> (e.g. whether commenting on Sandbox creates sandbox/comment1 or sandbox/c1 or ->>> what) be configurable by the wiki admin, in the same way that recentchanges has ->>> recentchangespage => 'recentchanges'? I'd like to see fewer hard-coded page ->>> names in general, really - it seems odd to me that shortcuts and smileys ->>> hard-code the name of the page to look at. Perhaps I could add ->>> discussionpage => 'discussion' too? --[[smcv]] - ->>> (I've now implemented this in my branch. --[[smcv]]) - ->> The best reason to keep the pages internal seems to me to be that you ->> don't want the overhead of every comment spawning its own wiki page. --[[Joey]] - -## Formats (resolved) - -The plugin now allows multiple comment formats while still using internal -pages; each comment is saved as a page containing one `\[[!comment]]` directive, -which has a superset of the functionality of [[ikiwiki/directives/format]]. - -## Access control (unresolved?) - -By the way, I think that who can post comments should be controllable by -the existing plugins opendiscussion, anonok, signinedit, and lockedit. Allowing -posting comments w/o any login, while a nice capability, can lead to -spam problems. So, use `check_canedit` as at least a first-level check? ---[[Joey]] - -> This plugin already uses `check_canedit`, but that function doesn't have a concept -> of different actions. The hack I use is that when a user comments on, say, sandbox, -> I call `check_canedit` for the pseudo-page "sandbox[postcomment]". The -> special `postcomment(glob)` [[ikiwiki/pagespec]] returns true if the page ends with -> "[postcomment]" and the part before (e.g. sandbox) matches the glob. So, you can -> have postcomment(blog/*) or something. (Perhaps instead of taking a glob, postcomment -> should take a pagespec, so you can have postcomment(link(tags/commentable))?) -> -> This is why `anonok_pages => 'postcomment(*)'` and `locked_pages => '!postcomment(*)'` -> are necessary to allow anonymous and logged-in editing (respectively). -> -> This is ugly - one alternative would be to add `check_permission()` that takes a -> page and a verb (create, edit, rename, remove and maybe comment are the ones I -> can think of so far), use that, and port the plugins you mentioned to use that -> API too. This plugin could either call `check_can("$page/comment1", 'create')` or -> call `check_can($page, 'comment')`. -> -> One odd effect of the code structure I've used is that we check for the ability to -> create the page before we actually know what page name we're going to use - when -> posting the comment I just increment a number until I reach an unused one - so -> either the code needs restructuring, or the permission check for 'create' would -> always be for 'comment1' and never 'comment123'. --[[smcv]] - ->> Now resolved, in fact --[[smcv]] - -> Another possibility is to just check for permission to edit (e.g.) `sandbox/comment1`. -> However, this makes the "comments can only be created, not edited" feature completely -> reliant on the fact that internal pages can't be edited. Perhaps there should be a -> `editable_pages` pagespec, defaulting to `'*'`? --[[smcv]] - -## comments directive vs global setting (resolved?) - -When comments have been enabled generally, you still need to mark which pages -can have comments, by including the `\[[!comments]]` directive in them. By default, -this directive expands to a "post a comment" link plus an `\[[!inline]]` with -the comments. [This requirement has now been removed --[[smcv]]] - -> I don't like this, because it's hard to explain to someone why they have -> to insert this into every post to their blog. Seems that the model used -> for discussion pages could work -- if comments are enabled, automatically -> add the comment posting form and comments to the end of each page. -> --[[Joey]] - ->> I don't think I'd want comments on *every* page (particularly, not the ->> front page). Perhaps a pagespec in the setup file, where the default is "*"? ->> Then control freaks like me could use "link(tags/comments)" and tag pages ->> as allowing comments. ->> ->>> Yes, I think a pagespec is the way to go. --[[Joey]] - ->>>> Implemented --[[smcv]] - ->> ->> The model used for discussion pages does require patching the existing ->> page template, which I was trying to avoid - I'm not convinced that having ->> every possible feature hard-coded there really scales (and obviously it's ->> rather annoying while this plugin is on a branch). --[[smcv]] - ->>> Using the template would allow customising the html around the comments ->>> which seems like a good thing? --[[Joey]] - ->>>> The \[[!comments]] directive is already template-friendly - it expands to ->>>> the contents of the template `comments_embed.tmpl`, possibly with the ->>>> result of an \[[!inline]] appended. I should change `comments_embed.tmpl` ->>>> so it uses a template variable `INLINE` for the inline result rather than ->>>> having the perl code concatenate it, which would allow a bit more ->>>> customization (whether the "post" link was before or after the inline). ->>>> Even if you want comments in page.tmpl, keeping the separate comments_embed.tmpl ->>>> and having a `COMMENTS` variable in page.tmpl might be the way forward, ->>>> since the smaller each templates is, the easier it will be for users ->>>> to maintain a patched set of templates. (I think so, anyway, based on what happens ->>>> with dpkg prompts in Debian packages with monolithic vs split ->>>> conffiles.) --[[smcv]] - ->>>>> I've switched my branch to use page.tmpl instead; see what you think? --[[smcv]] - -## Raw HTML (resolved?) - -Raw HTML was not initially allowed by default (this was configurable). - -> I'm not sure that raw html should be a problem, as long as the -> htmlsanitizer and htmlbalanced plugins are enabled. I can see filtering -> out directives, as a special case. --[[Joey]] - ->> Right, if I sanitize each post individually, with htmlscrubber and either htmltidy ->> or htmlbalance turned on, then there should be no way the user can forge a comment; ->> I was initially wary of allowing meta directives, but I think those are OK, as long ->> as the comment template puts the \[[!meta author]] at the *end*. Disallowing ->> directives is more a way to avoid commenters causing expensive processing than ->> anything else, at this point. ->> ->> I've rebased the plugin on master, made it sanitize individual posts' content ->> and removed the option to disallow raw HTML. Sanitizing individual posts before ->> they've been htmlized required me to preserve whitespace in the htmlbalance ->> plugin, so I did that. Alternatively, we could htmlize immediately and always ->> save out raw HTML? --[[smcv]] - ->>> There might be some use cases for other directives, such as img, in ->>> comments. ->>> ->>> I don't know if meta is "safe" (ie, guaranteed to be inexpensive and not ->>> allow users to do annoying things) or if it will continue to be in the ->>> future. Hard to predict really, all that can be said with certainty is ->>> 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]] diff --git a/doc/plugins/lockedit.mdwn b/doc/plugins/lockedit.mdwn index 71bf232ab..d2e98e07a 100644 --- a/doc/plugins/lockedit.mdwn +++ b/doc/plugins/lockedit.mdwn @@ -17,6 +17,10 @@ One handy thing to do if you're using ikiwiki for your blog is to lock posts in your blog, while still letting them comment via the Discussion pages. +Alternatively, if you're using the [[comments]] plugin, you can lock +"!postcomment(*)" to allow users to comment on pages, but not edit anything +else. + Wiki administrators can always edit locked pages. The [[ikiwiki/PageSpec]] can specify that some pages are not locked for some users. For example, "important_page and !user(joey)" locks `important_page` while still diff --git a/doc/wikitemplates.mdwn b/doc/wikitemplates.mdwn index babd70211..6fb4d5f49 100644 --- a/doc/wikitemplates.mdwn +++ b/doc/wikitemplates.mdwn @@ -29,6 +29,10 @@ located in /usr/share/ikiwiki/templates by default. form to wiki pages. * `searchquery.tmpl` - This is an omega template, used by the [[plugins/search]] plugin. +* `comments_display.tmpl` - This template is used to display a comment + by the [[plugins/comments]] plugin. +* `comments_form.tmpl` - This template is the comment post form for the + [[plugins/comments]] plugin. The [[plugins/pagetemplate]] plugin can allow individual pages to use a different template than `page.tmpl`. -- cgit v1.2.3 From e9797ee0863855da93c7a98612c984fecc8d1e23 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 12 Dec 2008 15:02:40 -0500 Subject: improve documentation of postcomment --- doc/ikiwiki/pagespec.mdwn | 4 ++-- doc/plugins/comments.mdwn | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'doc/plugins') diff --git a/doc/ikiwiki/pagespec.mdwn b/doc/ikiwiki/pagespec.mdwn index 90b96c936..d4dd265cc 100644 --- a/doc/ikiwiki/pagespec.mdwn +++ b/doc/ikiwiki/pagespec.mdwn @@ -47,8 +47,8 @@ Some more elaborate limits can be added to what matches using these functions: wiki admins. * "`ip(address)`" - tests whether a modification is being made from the specified IP address. -* "`postcomment(glob)`" - matches internal-use pages created by the - comments plugin as comments for pages that match the specified glob. +* "`postcomment(glob)`" - matches only when comments are being + posted to a page matching the specified glob For example, to match all pages in a blog that link to the page about music and were written in 2005: diff --git a/doc/plugins/comments.mdwn b/doc/plugins/comments.mdwn index 347d7fc8d..fa263ef40 100644 --- a/doc/plugins/comments.mdwn +++ b/doc/plugins/comments.mdwn @@ -19,8 +19,7 @@ users can only post comments. Individual comments are stored as internal-use pages named something like `page/comment_1`, `page/comment_2`, etc. These pages internally use a -`\[[!_comment]]` [[ikiwiki/directive]], and comment pages can be matched -using a special `postcomment()` [[ikiwiki/PageSpec]]. +`\[[!_comment]]` [[ikiwiki/directive]]. There are some global options for the setup file: -- cgit v1.2.3 From fdd994fb7365308bde162b72b280512f2db6a339 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 17 Dec 2008 14:15:52 -0500 Subject: more comments doc updates Moved todo items to a todo page, mark the old todo item about comments as done, etc. --- doc/plugins/comments.mdwn | 12 ------------ doc/plugins/comments/discussion.mdwn | 3 +++ doc/todo/comments.mdwn | 8 ++++++++ doc/todo/supporting_comments_via_disussion_pages.mdwn | 3 +++ 4 files changed, 14 insertions(+), 12 deletions(-) create mode 100644 doc/todo/comments.mdwn (limited to 'doc/plugins') diff --git a/doc/plugins/comments.mdwn b/doc/plugins/comments.mdwn index fa263ef40..aab75e9b7 100644 --- a/doc/plugins/comments.mdwn +++ b/doc/plugins/comments.mdwn @@ -37,15 +37,3 @@ There are some global options for the setup file: specify a name for themselves, and the \[[!meta author]] and \[[!meta authorurl]] directives will not be overridden by the comments plugin - -Known issues: - -* Needs code review -* The access control via postcomment() is rather strange (see [[discussion]] for more details) -* There is some common code cargo-culted from other plugins (notably inline and editpage) which - should probably be shared -* Joey doesn't think it should necessarily use internal pages (see [[discussion]]) -* Previews always say "unknown IP address" -* Add `COMMENTOPENID`: the authenticated/verified user name, if and only if it was an OpenID -* The default template should have a (?) icon next to unauthenticated users (with the IP address - as title) and an OpenID icon next to OpenIDs diff --git a/doc/plugins/comments/discussion.mdwn b/doc/plugins/comments/discussion.mdwn index 59740ec37..2a87a3d93 100644 --- a/doc/plugins/comments/discussion.mdwn +++ b/doc/plugins/comments/discussion.mdwn @@ -63,6 +63,9 @@ spam problems. So, use `check_canedit` as at least a first-level check? > This is why `anonok_pages => 'postcomment(*)'` and `locked_pages => '!postcomment(*)'` > are necessary to allow anonymous and logged-in editing (respectively). > +>> I changed that to move the flag out of the page name, and into a variable that the `match_postcomment` +>> function checks for. Other ugliness still applies. :-) --[[Joey]] +> > This is ugly - one alternative would be to add `check_permission()` that takes a > page and a verb (create, edit, rename, remove and maybe comment are the ones I > can think of so far), use that, and port the plugins you mentioned to use that diff --git a/doc/todo/comments.mdwn b/doc/todo/comments.mdwn new file mode 100644 index 000000000..adc302a25 --- /dev/null +++ b/doc/todo/comments.mdwn @@ -0,0 +1,8 @@ +Known issues with the [[plugins/comments]] plugin: + +* There is some common code cargo-culted from other plugins (notably inline and editpage) which + should probably be shared +* Previews always say "unknown IP address" +* Add `COMMENTOPENID`: the authenticated/verified user name, if and only if it was an OpenID +* The default template should have a (?) icon next to unauthenticated users (with the IP address + as title) and an OpenID icon next to OpenIDs diff --git a/doc/todo/supporting_comments_via_disussion_pages.mdwn b/doc/todo/supporting_comments_via_disussion_pages.mdwn index bc4e331d0..892db18a9 100644 --- a/doc/todo/supporting_comments_via_disussion_pages.mdwn +++ b/doc/todo/supporting_comments_via_disussion_pages.mdwn @@ -215,3 +215,6 @@ do you think so far? Known issues include: --[[smcv]] I've updated smcvpostcomment and publicised it as [[plugins/contrib/comments]]. --[[smcv]] + +> While there is still room for improvement and entirely other approaches, +> I am calling this done since smcv's comments plugin is ready. --[[Joey]] -- cgit v1.2.3 From bb93fccf0690344aa77f9538a508959a6de09847 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 17 Dec 2008 15:22:16 -0500 Subject: Coding style change: Remove explcit vim folding markers. --- IkiWiki.pm | 388 ++++++++++----------- IkiWiki/CGI.pm | 60 ++-- IkiWiki/Plugin/aggregate.pm | 108 +++--- IkiWiki/Plugin/amazon_s3.pm | 32 +- IkiWiki/Plugin/anonok.pm | 12 +- IkiWiki/Plugin/attachment.pm | 32 +- IkiWiki/Plugin/autoindex.pm | 16 +- IkiWiki/Plugin/brokenlinks.pm | 12 +- IkiWiki/Plugin/bzr.pm | 54 +-- IkiWiki/Plugin/calendar.pm | 30 +- IkiWiki/Plugin/camelcase.pm | 14 +- IkiWiki/Plugin/color.pm | 20 +- IkiWiki/Plugin/comments.pm | 38 +- IkiWiki/Plugin/conditional.pm | 28 +- IkiWiki/Plugin/creole.pm | 12 +- IkiWiki/Plugin/cutpaste.pm | 20 +- IkiWiki/Plugin/ddate.pm | 12 +- IkiWiki/Plugin/editdiff.pm | 16 +- IkiWiki/Plugin/editpage.pm | 16 +- IkiWiki/Plugin/edittemplate.pm | 24 +- IkiWiki/Plugin/embed.pm | 20 +- IkiWiki/Plugin/external.pm | 48 +-- IkiWiki/Plugin/favicon.pm | 12 +- IkiWiki/Plugin/filecheck.pm | 30 +- IkiWiki/Plugin/format.pm | 8 +- IkiWiki/Plugin/fortune.pm | 12 +- IkiWiki/Plugin/git.pm | 72 ++-- IkiWiki/Plugin/goodstuff.pm | 8 +- IkiWiki/Plugin/google.pm | 16 +- IkiWiki/Plugin/googlecalendar.pm | 20 +- IkiWiki/Plugin/graphviz.pm | 16 +- IkiWiki/Plugin/haiku.pm | 12 +- IkiWiki/Plugin/hnb.pm | 12 +- IkiWiki/Plugin/html.pm | 12 +- IkiWiki/Plugin/htmlbalance.pm | 12 +- IkiWiki/Plugin/htmlscrubber.pm | 16 +- IkiWiki/Plugin/htmltidy.pm | 12 +- IkiWiki/Plugin/httpauth.pm | 12 +- IkiWiki/Plugin/img.pm | 12 +- IkiWiki/Plugin/inline.pm | 54 +-- IkiWiki/Plugin/link.pm | 24 +- IkiWiki/Plugin/linkmap.pm | 20 +- IkiWiki/Plugin/listdirectives.pm | 20 +- IkiWiki/Plugin/lockedit.pm | 16 +- IkiWiki/Plugin/map.pm | 12 +- IkiWiki/Plugin/mdwn.pm | 12 +- IkiWiki/Plugin/mercurial.pm | 52 +-- IkiWiki/Plugin/meta.pm | 52 +-- IkiWiki/Plugin/mirrorlist.pm | 16 +- IkiWiki/Plugin/monotone.pm | 72 ++-- IkiWiki/Plugin/more.pm | 10 +- IkiWiki/Plugin/norcs.pm | 48 +-- IkiWiki/Plugin/opendiscussion.pm | 12 +- IkiWiki/Plugin/openid.pm | 28 +- IkiWiki/Plugin/orphans.pm | 12 +- IkiWiki/Plugin/otl.pm | 16 +- IkiWiki/Plugin/pagecount.pm | 12 +- IkiWiki/Plugin/pagestats.pm | 12 +- IkiWiki/Plugin/pagetemplate.pm | 16 +- IkiWiki/Plugin/parentlinks.pm | 16 +- IkiWiki/Plugin/passwordauth.pm | 26 +- IkiWiki/Plugin/pingee.pm | 12 +- IkiWiki/Plugin/pinger.pm | 16 +- IkiWiki/Plugin/poll.pm | 16 +- IkiWiki/Plugin/polygen.pm | 12 +- IkiWiki/Plugin/postsparkline.pm | 12 +- IkiWiki/Plugin/prettydate.pm | 16 +- IkiWiki/Plugin/progress.pm | 16 +- IkiWiki/Plugin/rawhtml.pm | 8 +- IkiWiki/Plugin/recentchanges.pm | 30 +- IkiWiki/Plugin/recentchangesdiff.pm | 12 +- IkiWiki/Plugin/relativedate.pm | 20 +- IkiWiki/Plugin/remove.pm | 34 +- IkiWiki/Plugin/rename.pm | 48 +-- IkiWiki/Plugin/search.pm | 40 +-- IkiWiki/Plugin/shortcut.pm | 20 +- IkiWiki/Plugin/sidebar.pm | 16 +- IkiWiki/Plugin/signinedit.pm | 12 +- IkiWiki/Plugin/skeleton.pm.example | 102 +++--- IkiWiki/Plugin/smiley.pm | 16 +- IkiWiki/Plugin/sparkline.pm | 12 +- IkiWiki/Plugin/svn.pm | 54 +-- IkiWiki/Plugin/table.pm | 26 +- IkiWiki/Plugin/tag.pm | 32 +- IkiWiki/Plugin/template.pm | 12 +- IkiWiki/Plugin/testpagespec.pm | 12 +- IkiWiki/Plugin/teximg.pm | 32 +- IkiWiki/Plugin/textile.pm | 12 +- IkiWiki/Plugin/tla.pm | 46 +-- IkiWiki/Plugin/toc.pm | 14 +- IkiWiki/Plugin/toggle.pm | 28 +- IkiWiki/Plugin/txt.pm | 4 +- IkiWiki/Plugin/typography.pm | 16 +- IkiWiki/Plugin/version.pm | 16 +- IkiWiki/Plugin/websetup.pm | 36 +- IkiWiki/Plugin/wikitext.pm | 12 +- IkiWiki/Receive.pm | 16 +- IkiWiki/Render.pm | 34 +- IkiWiki/Setup.pm | 12 +- IkiWiki/Setup/Automator.pm | 12 +- IkiWiki/Setup/Standard.pm | 16 +- IkiWiki/UserInfo.pm | 32 +- IkiWiki/Wrapper.pm | 4 +- debian/changelog | 1 + .../Allow_overriding_of_symlink_restriction.mdwn | 6 +- doc/bugs/Can__39__t_create_root_page.mdwn | 4 +- ...dency_in_eval_while_running_with_-T_switch.mdwn | 4 +- doc/bugs/Monotone_rcs_support.mdwn | 2 +- ..._blog_items_when_filename_contains_a_colon.mdwn | 8 +- doc/bugs/Problem_with_toc.pm_plug-in.mdwn | 4 +- doc/bugs/Problems_with_graphviz.pm_plug-in.mdwn | 14 +- .../RecentChanges_broken_with_empty_svnpath.mdwn | 2 +- ...itles_are_lower-cased_when_creating_a_page.mdwn | 2 +- ...n_and_a_directive_does_not_contain_a_space.mdwn | 4 +- ...celed:_Broken_pipe__34_____40__patch__41__.mdwn | 2 +- doc/bugs/git_stderr_output_causes_problems.mdwn | 2 +- ...plugin_should_pass_through_class_attribute.mdwn | 4 +- doc/bugs/inline_sort-by-title_issues.mdwn | 2 +- doc/bugs/mercurial_fail_to_add.mdwn | 2 +- doc/bugs/methodResponse_in_add__95__plugins.mdwn | 2 +- doc/bugs/multiple_pages_with_same_name.mdwn | 6 +- ...pec_parsing_chokes_on_function__40____41__.mdwn | 2 +- doc/bugs/prune_causing_taint_mode_failures.mdwn | 4 +- doc/bugs/quieten_mercurial.mdwn | 4 +- ..._for_locale_data_in_the_installed_location.mdwn | 2 +- doc/bugs/tbasewiki__95__brokenlinks.t_broken.mdwn | 6 +- doc/plugins/contrib/headinganchors.mdwn | 8 +- doc/plugins/contrib/siterel2pagerel.mdwn | 8 +- doc/plugins/contrib/unixauth.mdwn | 24 +- .../Add_DATE_parameter_for_use_in_templates.mdwn | 14 +- ...for_latest_Text::Markdown_as_found_on_CPAN.mdwn | 2 +- doc/todo/Allow_change_of_wiki_file_types.mdwn | 8 +- doc/todo/Allow_edittemplate_to_set_file_type.mdwn | 8 +- .../Bestdir_along_with_bestlink_in_IkiWiki.pm.mdwn | 8 +- doc/todo/Default_text_for_new_pages.mdwn | 8 +- ..._templates_inserted_by_the_template_plugin.mdwn | 2 +- ...nline_plugin_option_to_show_full_page_path.mdwn | 2 +- .../Move_teximg_latex_preamble_to_config_file.mdwn | 10 +- ...bitrary_date_to_be_used_by_calendar_plugin.mdwn | 12 +- doc/todo/Silence_monotone_warning.mdwn | 2 +- ...side_of_link__40____41___within_a_pagespec.mdwn | 4 +- doc/todo/Wrapper_config_with_multiline_regexp.mdwn | 4 +- .../add_forward_age_sorting_option_to_inline.mdwn | 2 +- .../discussion.mdwn | 20 +- doc/todo/blogpost_plugin.mdwn | 20 +- doc/todo/bzr.mdwn | 28 +- doc/todo/cas_authentication.mdwn | 14 +- doc/todo/color_plugin.mdwn | 20 +- doc/todo/darcs.mdwn | 26 +- doc/todo/datearchives-plugin.mdwn | 8 +- doc/todo/different_search_engine.mdwn | 40 +-- doc/todo/directive_docs.mdwn | 12 +- doc/todo/enable-htaccess-files.mdwn | 2 +- doc/todo/format_escape.mdwn | 16 +- .../fortune:_select_options_via_environment.mdwn | 4 +- doc/todo/index.html_allowed.mdwn | 10 +- doc/todo/inline:_numerical_ordering_by_title.mdwn | 22 +- .../language_definition_for_the_meta_plugin.mdwn | 4 +- doc/todo/meta_rcsid.mdwn | 2 +- doc/todo/missingparents.pm.mdwn | 44 +-- doc/todo/modify_page_filename_in_plugin.mdwn | 6 +- doc/todo/pagespec_relative_to_a_target.mdwn | 16 +- doc/todo/provide_sha1_for_git_diffurl.mdwn | 2 +- doc/todo/require_CAPTCHA_to_edit.mdwn | 22 +- doc/todo/source_link.mdwn | 14 +- doc/todo/structured_page_data.mdwn | 50 +-- .../supporting_comments_via_disussion_pages.mdwn | 12 +- doc/todo/syntax_highlighting.mdwn | 4 +- doc/todo/tidy_git__39__s_ctime_debug_output.mdwn | 2 +- doc/todo/tmplvars_plugin.mdwn | 12 +- doc/todo/tracking_bugs_with_dependencies.mdwn | 58 +-- ...turn_edittemplate_verbosity_off_by_default.mdwn | 6 +- doc/todo/using_meta_titles_for_parentlinks.html | 8 +- ...closures_for_values__41___in_ikiwiki.setup.mdwn | 8 +- ikiwiki.in | 12 +- 175 files changed, 1776 insertions(+), 1775 deletions(-) (limited to 'doc/plugins') diff --git a/IkiWiki.pm b/IkiWiki.pm index 1c68c2cb3..d93ff7374 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -34,7 +34,7 @@ memoize("abs2rel"); memoize("pagespec_translate"); memoize("file_pruned"); -sub getsetup () { #{{{ +sub getsetup () { wikiname => { type => "string", default => "wiki", @@ -431,9 +431,9 @@ sub getsetup () { #{{{ safe => 0, rebuild => 0, }, -} #}}} +} -sub defaultconfig () { #{{{ +sub defaultconfig () { my %s=getsetup(); my @ret; foreach my $key (keys %s) { @@ -441,9 +441,9 @@ sub defaultconfig () { #{{{ } use Data::Dumper; return @ret; -} #}}} +} -sub checkconfig () { #{{{ +sub checkconfig () { # locale stuff; avoid LC_ALL since it overrides everything if (defined $ENV{LC_ALL}) { $ENV{LANG} = $ENV{LC_ALL}; @@ -490,9 +490,9 @@ sub checkconfig () { #{{{ run_hooks(checkconfig => sub { shift->() }); return 1; -} #}}} +} -sub listplugins () { #{{{ +sub listplugins () { my %ret; foreach my $dir (@INC, $config{libdir}) { @@ -510,9 +510,9 @@ sub listplugins () { #{{{ } return keys %ret; -} #}}} +} -sub loadplugins () { #{{{ +sub loadplugins () { if (defined $config{libdir} && length $config{libdir}) { unshift @INC, possibly_foolish_untaint($config{libdir}); } @@ -539,9 +539,9 @@ sub loadplugins () { #{{{ } return 1; -} #}}} +} -sub loadplugin ($) { #{{{ +sub loadplugin ($) { my $plugin=shift; return if grep { $_ eq $plugin} @{$config{disable_plugins}}; @@ -567,9 +567,9 @@ sub loadplugin ($) { #{{{ } $loaded_plugins{$plugin}=1; return 1; -} #}}} +} -sub error ($;$) { #{{{ +sub error ($;$) { my $message=shift; my $cleaner=shift; log_message('err' => $message) if $config{syslog}; @@ -577,15 +577,15 @@ sub error ($;$) { #{{{ $cleaner->(); } die $message."\n"; -} #}}} +} -sub debug ($) { #{{{ +sub debug ($) { return unless $config{verbose}; return log_message(debug => @_); -} #}}} +} my $log_open=0; -sub log_message ($$) { #{{{ +sub log_message ($$) { my $type=shift; if ($config{syslog}) { @@ -605,44 +605,44 @@ sub log_message ($$) { #{{{ else { return print STDERR "@_\n"; } -} #}}} +} -sub possibly_foolish_untaint ($) { #{{{ +sub possibly_foolish_untaint ($) { my $tainted=shift; my ($untainted)=$tainted=~/(.*)/s; return $untainted; -} #}}} +} -sub basename ($) { #{{{ +sub basename ($) { my $file=shift; $file=~s!.*/+!!; return $file; -} #}}} +} -sub dirname ($) { #{{{ +sub dirname ($) { my $file=shift; $file=~s!/*[^/]+$!!; return $file; -} #}}} +} -sub pagetype ($) { #{{{ +sub pagetype ($) { my $page=shift; if ($page =~ /\.([^.]+)$/) { return $1 if exists $hooks{htmlize}{$1}; } return; -} #}}} +} -sub isinternal ($) { #{{{ +sub isinternal ($) { my $page=shift; return exists $pagesources{$page} && $pagesources{$page} =~ /\._([^.]+)$/; -} #}}} +} -sub pagename ($) { #{{{ +sub pagename ($) { my $file=shift; my $type=pagetype($file); @@ -652,9 +652,9 @@ sub pagename ($) { #{{{ $page=$1; } return $page; -} #}}} +} -sub newpagefile ($$) { #{{{ +sub newpagefile ($$) { my $page=shift; my $type=shift; @@ -664,9 +664,9 @@ sub newpagefile ($$) { #{{{ else { return $page."/index.".$type; } -} #}}} +} -sub targetpage ($$;$) { #{{{ +sub targetpage ($$;$) { my $page=shift; my $ext=shift; my $filename=shift; @@ -680,15 +680,15 @@ sub targetpage ($$;$) { #{{{ else { return $page."/index.".$ext; } -} #}}} +} -sub htmlpage ($) { #{{{ +sub htmlpage ($) { my $page=shift; return targetpage($page, $config{htmlext}); -} #}}} +} -sub srcfile_stat { #{{{ +sub srcfile_stat { my $file=shift; my $nothrow=shift; @@ -698,13 +698,13 @@ sub srcfile_stat { #{{{ } error("internal error: $file cannot be found in $config{srcdir} or underlay") unless $nothrow; return; -} #}}} +} -sub srcfile ($;$) { #{{{ +sub srcfile ($;$) { return (srcfile_stat(@_))[0]; -} #}}} +} -sub add_underlay ($) { #{{{ +sub add_underlay ($) { my $dir=shift; if ($dir !~ /^\//) { @@ -716,9 +716,9 @@ sub add_underlay ($) { #{{{ } return 1; -} #}}} +} -sub readfile ($;$$) { #{{{ +sub readfile ($;$$) { my $file=shift; my $binary=shift; my $wantfd=shift; @@ -738,9 +738,9 @@ sub readfile ($;$$) { #{{{ } close $in || error("failed to read $file: $!"); return $ret; -} #}}} +} -sub prep_writefile ($$) { #{{{ +sub prep_writefile ($$) { my $file=shift; my $destdir=shift; @@ -764,9 +764,9 @@ sub prep_writefile ($$) { #{{{ } return 1; -} #}}} +} -sub writefile ($$$;$$) { #{{{ +sub writefile ($$$;$$) { my $file=shift; # can include subdirs my $destdir=shift; # directory to put file in my $content=shift; @@ -794,10 +794,10 @@ sub writefile ($$$;$$) { #{{{ error("failed renaming $newfile to $destdir/$file: $!", $cleanup); return 1; -} #}}} +} my %cleared; -sub will_render ($$;$) { #{{{ +sub will_render ($$;$) { my $page=shift; my $dest=shift; my $clear=shift; @@ -821,9 +821,9 @@ sub will_render ($$;$) { #{{{ $destsources{$dest}=$page; return 1; -} #}}} +} -sub bestlink ($$) { #{{{ +sub bestlink ($$) { my $page=shift; my $link=shift; @@ -859,15 +859,15 @@ sub bestlink ($$) { #{{{ #print STDERR "warning: page $page, broken link: $link\n"; return ""; -} #}}} +} -sub isinlinableimage ($) { #{{{ +sub isinlinableimage ($) { my $file=shift; return $file =~ /\.(png|gif|jpg|jpeg)$/i; -} #}}} +} -sub pagetitle ($;$) { #{{{ +sub pagetitle ($;$) { my $page=shift; my $unescaped=shift; @@ -879,31 +879,31 @@ sub pagetitle ($;$) { #{{{ } return $page; -} #}}} +} -sub titlepage ($) { #{{{ +sub titlepage ($) { my $title=shift; # 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 ($) { #{{{ +sub linkpage ($) { my $link=shift; my $chars = defined $config{wiki_file_chars} ? $config{wiki_file_chars} : "-[:alnum:]+/.:_"; $link=~s/([^$chars])/$1 eq ' ' ? '_' : "__".ord($1)."__"/eg; return $link; -} #}}} +} -sub cgiurl (@) { #{{{ +sub cgiurl (@) { my %params=@_; return $config{cgiurl}."?". join("&", map $_."=".uri_escape_utf8($params{$_}), keys %params); -} #}}} +} -sub baseurl (;$) { #{{{ +sub baseurl (;$) { my $page=shift; return "$config{url}/" if ! defined $page; @@ -912,9 +912,9 @@ sub baseurl (;$) { #{{{ $page=~s/[^\/]+$//; $page=~s/[^\/]+\//..\//g; return $page; -} #}}} +} -sub abs2rel ($$) { #{{{ +sub abs2rel ($$) { # Work around very innefficient behavior in File::Spec if abs2rel # is passed two relative paths. It's much faster if paths are # absolute! (Debian bug #376658; fixed in debian unstable now) @@ -925,15 +925,15 @@ sub abs2rel ($$) { #{{{ my $ret=File::Spec->abs2rel($path, $base); $ret=~s/^// if defined $ret; return $ret; -} #}}} +} -sub displaytime ($;$) { #{{{ +sub displaytime ($;$) { # Plugins can override this function to mark up the time to # display. return ''.formattime(@_).''; -} #}}} +} -sub formattime ($;$) { #{{{ +sub formattime ($;$) { # Plugins can override this function to format the time. my $time=shift; my $format=shift; @@ -944,9 +944,9 @@ sub formattime ($;$) { #{{{ # strftime doesn't know about encodings, so make sure # its output is properly treated as utf8 return decode_utf8(POSIX::strftime($format, localtime($time))); -} #}}} +} -sub beautify_urlpath ($) { #{{{ +sub beautify_urlpath ($) { my $url=shift; if ($config{usedirs}) { @@ -960,9 +960,9 @@ sub beautify_urlpath ($) { #{{{ } return $url; -} #}}} +} -sub urlto ($$;$) { #{{{ +sub urlto ($$;$) { my $to=shift; my $from=shift; my $absolute=shift; @@ -982,9 +982,9 @@ sub urlto ($$;$) { #{{{ my $link = abs2rel($to, dirname(htmlpage($from))); return beautify_urlpath($link); -} #}}} +} -sub htmllink ($$$;@) { #{{{ +sub htmllink ($$$;@) { my $lpage=shift; # the page doing the linking my $page=shift; # the page that will contain the link (different for inline) my $link=shift; @@ -1047,9 +1047,9 @@ sub htmllink ($$$;@) { #{{{ } return "$linktext"; -} #}}} +} -sub userlink ($) { #{{{ +sub userlink ($) { my $user=shift; my $oiduser=eval { openiduser($user) }; @@ -1064,9 +1064,9 @@ sub userlink ($) { #{{{ length $config{userdir} ? $config{userdir}."/".$user : $user ), noimageinline => 1); } -} #}}} +} -sub htmlize ($$$$) { #{{{ +sub htmlize ($$$$) { my $page=shift; my $destpage=shift; my $type=shift; @@ -1101,9 +1101,9 @@ sub htmlize ($$$$) { #{{{ } return $content; -} #}}} +} -sub linkify ($$$) { #{{{ +sub linkify ($$$) { my $page=shift; my $destpage=shift; my $content=shift; @@ -1117,11 +1117,11 @@ sub linkify ($$$) { #{{{ }); return $content; -} #}}} +} our %preprocessing; our $preprocess_preview=0; -sub preprocess ($$$;$$) { #{{{ +sub preprocess ($$$;$$) { my $page=shift; # the page the data comes from my $destpage=shift; # the page the data will appear in (different for inline) my $content=shift; @@ -1274,9 +1274,9 @@ sub preprocess ($$$;$$) { #{{{ $content =~ s{$regex}{$handle->($1, $2, $3, $4)}eg; return $content; -} #}}} +} -sub filter ($$$) { #{{{ +sub filter ($$$) { my $page=shift; my $destpage=shift; my $content=shift; @@ -1287,15 +1287,15 @@ sub filter ($$$) { #{{{ }); return $content; -} #}}} +} -sub indexlink () { #{{{ +sub indexlink () { return "$config{wikiname}"; -} #}}} +} my $wikilock; -sub lockwiki () { #{{{ +sub lockwiki () { # Take an exclusive lock on the wiki to prevent multiple concurrent # run issues. The lock will be dropped on program exit. if (! -d $config{wikistatedir}) { @@ -1307,17 +1307,17 @@ sub lockwiki () { #{{{ error("failed to get lock"); } return 1; -} #}}} +} -sub unlockwiki () { #{{{ +sub unlockwiki () { POSIX::close($ENV{IKIWIKI_CGILOCK_FD}) if exists $ENV{IKIWIKI_CGILOCK_FD}; return close($wikilock) if $wikilock; return; -} #}}} +} my $commitlock; -sub commit_hook_enabled () { #{{{ +sub commit_hook_enabled () { open($commitlock, '+>', "$config{wikistatedir}/commitlock") || error("cannot write to $config{wikistatedir}/commitlock: $!"); if (! flock($commitlock, 1 | 4)) { # LOCK_SH | LOCK_NB to test @@ -1326,23 +1326,23 @@ sub commit_hook_enabled () { #{{{ } close($commitlock) || error("failed closing commitlock: $!"); return 1; -} #}}} +} -sub disable_commit_hook () { #{{{ +sub disable_commit_hook () { open($commitlock, '>', "$config{wikistatedir}/commitlock") || error("cannot write to $config{wikistatedir}/commitlock: $!"); if (! flock($commitlock, 2)) { # LOCK_EX error("failed to get commit lock"); } return 1; -} #}}} +} -sub enable_commit_hook () { #{{{ +sub enable_commit_hook () { return close($commitlock) if $commitlock; return; -} #}}} +} -sub loadindex () { #{{{ +sub loadindex () { %oldrenderedfiles=%pagectime=(); if (! $config{rebuild}) { %pagesources=%pagemtime=%oldlinks=%links=%depends= @@ -1402,9 +1402,9 @@ sub loadindex () { #{{{ $destsources{$_}=$page foreach @{$renderedfiles{$page}}; } return close($in); -} #}}} +} -sub saveindex () { #{{{ +sub saveindex () { run_hooks(savestate => sub { shift->() }); my %hookids; @@ -1460,18 +1460,18 @@ sub saveindex () { #{{{ error("failed renaming $newfile to $config{wikistatedir}/indexdb", $cleanup); return 1; -} #}}} +} -sub template_file ($) { #{{{ +sub template_file ($) { my $template=shift; foreach my $dir ($config{templatedir}, "$installdir/share/ikiwiki/templates") { return "$dir/$template" if -e "$dir/$template"; } return; -} #}}} +} -sub template_params (@) { #{{{ +sub template_params (@) { my $filename=template_file(shift); if (! defined $filename) { @@ -1490,14 +1490,14 @@ sub template_params (@) { #{{{ @_ ); return wantarray ? @ret : {@ret}; -} #}}} +} -sub template ($;@) { #{{{ +sub template ($;@) { require HTML::Template; return HTML::Template->new(template_params(@_)); -} #}}} +} -sub misctemplate ($$;@) { #{{{ +sub misctemplate ($$;@) { my $title=shift; my $pagebody=shift; @@ -1514,9 +1514,9 @@ sub misctemplate ($$;@) { #{{{ shift->(page => "", destpage => "", template => $template); }); return $template->output; -}#}}} +} -sub hook (@) { # {{{ +sub hook (@) { my %param=@_; if (! exists $param{type} || ! ref $param{call} || ! exists $param{id}) { @@ -1527,9 +1527,9 @@ sub hook (@) { # {{{ $hooks{$param{type}}{$param{id}}=\%param; return 1; -} # }}} +} -sub run_hooks ($$) { # {{{ +sub run_hooks ($$) { # Calls the given sub for each hook of the given type, # passing it the hook function to call. my $type=shift; @@ -1550,53 +1550,53 @@ sub run_hooks ($$) { # {{{ } return 1; -} #}}} +} -sub rcs_update () { #{{{ +sub rcs_update () { $hooks{rcs}{rcs_update}{call}->(@_); -} #}}} +} -sub rcs_prepedit ($) { #{{{ +sub rcs_prepedit ($) { $hooks{rcs}{rcs_prepedit}{call}->(@_); -} #}}} +} -sub rcs_commit ($$$;$$) { #{{{ +sub rcs_commit ($$$;$$) { $hooks{rcs}{rcs_commit}{call}->(@_); -} #}}} +} -sub rcs_commit_staged ($$$) { #{{{ +sub rcs_commit_staged ($$$) { $hooks{rcs}{rcs_commit_staged}{call}->(@_); -} #}}} +} -sub rcs_add ($) { #{{{ +sub rcs_add ($) { $hooks{rcs}{rcs_add}{call}->(@_); -} #}}} +} -sub rcs_remove ($) { #{{{ +sub rcs_remove ($) { $hooks{rcs}{rcs_remove}{call}->(@_); -} #}}} +} -sub rcs_rename ($$) { #{{{ +sub rcs_rename ($$) { $hooks{rcs}{rcs_rename}{call}->(@_); -} #}}} +} -sub rcs_recentchanges ($) { #{{{ +sub rcs_recentchanges ($) { $hooks{rcs}{rcs_recentchanges}{call}->(@_); -} #}}} +} -sub rcs_diff ($) { #{{{ +sub rcs_diff ($) { $hooks{rcs}{rcs_diff}{call}->(@_); -} #}}} +} -sub rcs_getctime ($) { #{{{ +sub rcs_getctime ($) { $hooks{rcs}{rcs_getctime}{call}->(@_); -} #}}} +} -sub rcs_receive () { #{{{ +sub rcs_receive () { $hooks{rcs}{rcs_receive}{call}->(); -} #}}} +} -sub globlist_to_pagespec ($) { #{{{ +sub globlist_to_pagespec ($) { my @globlist=split(' ', shift); my (@spec, @skip); @@ -1620,20 +1620,20 @@ sub globlist_to_pagespec ($) { #{{{ } } return $spec; -} #}}} +} -sub is_globlist ($) { #{{{ +sub is_globlist ($) { my $s=shift; return ( $s =~ /[^\s]+\s+([^\s]+)/ && $1 ne "and" && $1 ne "or" ); -} #}}} +} -sub safequote ($) { #{{{ +sub safequote ($) { my $s=shift; $s=~s/[{}]//g; return "q{$s}"; -} #}}} +} -sub add_depends ($$) { #{{{ +sub add_depends ($$) { my $page=shift; my $pagespec=shift; @@ -1647,9 +1647,9 @@ sub add_depends ($$) { #{{{ } return 1; -} # }}} +} -sub file_pruned ($$) { #{{{ +sub file_pruned ($$) { require File::Spec; my $file=File::Spec->canonpath(shift); my $base=File::Spec->canonpath(shift); @@ -1657,9 +1657,9 @@ sub file_pruned ($$) { #{{{ my $regexp='('.join('|', @{$config{wiki_file_prune_regexps}}).')'; return $file =~ m/$regexp/ && $file ne $base; -} #}}} +} -sub gettext { #{{{ +sub gettext { # Only use gettext in the rare cases it's needed. if ((exists $ENV{LANG} && length $ENV{LANG}) || (exists $ENV{LC_ALL} && length $ENV{LC_ALL}) || @@ -1680,15 +1680,15 @@ sub gettext { #{{{ else { return shift; } -} #}}} +} -sub yesno ($) { #{{{ +sub yesno ($) { my $val=shift; return (defined $val && lc($val) eq gettext("yes")); -} #}}} +} -sub inject { #{{{ +sub inject { # Injects a new function into the symbol table to replace an # exported function. my %params=@_; @@ -1711,9 +1711,9 @@ sub inject { #{{{ } use strict; use warnings; -} #}}} +} -sub pagespec_merge ($$) { #{{{ +sub pagespec_merge ($$) { my $a=shift; my $b=shift; @@ -1728,9 +1728,9 @@ sub pagespec_merge ($$) { #{{{ } return "($a) or ($b)"; -} #}}} +} -sub pagespec_translate ($) { #{{{ +sub pagespec_translate ($) { my $spec=shift; # Support for old-style GlobLists. @@ -1784,9 +1784,9 @@ sub pagespec_translate ($) { #{{{ no warnings; return eval 'sub { my $page=shift; '.$code.' }'; -} #}}} +} -sub pagespec_match ($$;@) { #{{{ +sub pagespec_match ($$;@) { my $page=shift; my $spec=shift; my @params=@_; @@ -1799,55 +1799,55 @@ sub pagespec_match ($$;@) { #{{{ my $sub=pagespec_translate($spec); return IkiWiki::FailReason->new("syntax error in pagespec \"$spec\"") if $@; return $sub->($page, @params); -} #}}} +} -sub pagespec_valid ($) { #{{{ +sub pagespec_valid ($) { my $spec=shift; my $sub=pagespec_translate($spec); return ! $@; -} #}}} +} -sub glob2re ($) { #{{{ +sub glob2re ($) { my $re=quotemeta(shift); $re=~s/\\\*/.*/g; $re=~s/\\\?/./g; return $re; -} #}}} +} package IkiWiki::FailReason; -use overload ( #{{{ +use overload ( '""' => sub { ${$_[0]} }, '0+' => sub { 0 }, '!' => sub { bless $_[0], 'IkiWiki::SuccessReason'}, fallback => 1, -); #}}} +); -sub new { #{{{ +sub new { my $class = shift; my $value = shift; return bless \$value, $class; -} #}}} +} package IkiWiki::SuccessReason; -use overload ( #{{{ +use overload ( '""' => sub { ${$_[0]} }, '0+' => sub { 1 }, '!' => sub { bless $_[0], 'IkiWiki::FailReason'}, fallback => 1, -); #}}} +); -sub new { #{{{ +sub new { my $class = shift; my $value = shift; return bless \$value, $class; -}; #}}} +}; package IkiWiki::PageSpec; -sub match_glob ($$;@) { #{{{ +sub match_glob ($$;@) { my $page=shift; my $glob=shift; my %params=@_; @@ -1873,13 +1873,13 @@ sub match_glob ($$;@) { #{{{ else { return IkiWiki::FailReason->new("$glob does not match $page"); } -} #}}} +} -sub match_internal ($$;@) { #{{{ +sub match_internal ($$;@) { return match_glob($_[0], $_[1], @_, internal => 1) -} #}}} +} -sub match_link ($$;@) { #{{{ +sub match_link ($$;@) { my $page=shift; my $link=lc(shift); my %params=@_; @@ -1911,13 +1911,13 @@ sub match_link ($$;@) { #{{{ } } return IkiWiki::FailReason->new("$page does not link to $link"); -} #}}} +} -sub match_backlink ($$;@) { #{{{ +sub match_backlink ($$;@) { return match_link($_[1], $_[0], @_); -} #}}} +} -sub match_created_before ($$;@) { #{{{ +sub match_created_before ($$;@) { my $page=shift; my $testpage=shift; @@ -1932,9 +1932,9 @@ sub match_created_before ($$;@) { #{{{ else { return IkiWiki::FailReason->new("$testpage has no ctime"); } -} #}}} +} -sub match_created_after ($$;@) { #{{{ +sub match_created_after ($$;@) { my $page=shift; my $testpage=shift; @@ -1949,36 +1949,36 @@ sub match_created_after ($$;@) { #{{{ else { return IkiWiki::FailReason->new("$testpage has no ctime"); } -} #}}} +} -sub match_creation_day ($$;@) { #{{{ +sub match_creation_day ($$;@) { if ((gmtime($IkiWiki::pagectime{shift()}))[3] == shift) { return IkiWiki::SuccessReason->new('creation_day matched'); } else { return IkiWiki::FailReason->new('creation_day did not match'); } -} #}}} +} -sub match_creation_month ($$;@) { #{{{ +sub match_creation_month ($$;@) { if ((gmtime($IkiWiki::pagectime{shift()}))[4] + 1 == shift) { return IkiWiki::SuccessReason->new('creation_month matched'); } else { return IkiWiki::FailReason->new('creation_month did not match'); } -} #}}} +} -sub match_creation_year ($$;@) { #{{{ +sub match_creation_year ($$;@) { if ((gmtime($IkiWiki::pagectime{shift()}))[5] + 1900 == shift) { return IkiWiki::SuccessReason->new('creation_year matched'); } else { return IkiWiki::FailReason->new('creation_year did not match'); } -} #}}} +} -sub match_user ($$;@) { #{{{ +sub match_user ($$;@) { shift; my $user=shift; my %params=@_; @@ -1996,9 +1996,9 @@ sub match_user ($$;@) { #{{{ else { return IkiWiki::FailReason->new("user is $params{user}, not $user"); } -} #}}} +} -sub match_admin ($$;@) { #{{{ +sub match_admin ($$;@) { shift; shift; my %params=@_; @@ -2016,9 +2016,9 @@ sub match_admin ($$;@) { #{{{ else { return IkiWiki::FailReason->new("user is not an admin"); } -} #}}} +} -sub match_ip ($$;@) { #{{{ +sub match_ip ($$;@) { shift; my $ip=shift; my %params=@_; @@ -2033,6 +2033,6 @@ sub match_ip ($$;@) { #{{{ else { return IkiWiki::FailReason->new("IP is $params{ip}, not $ip"); } -} #}}} +} 1 diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index a45e12e31..81cb42d13 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -9,7 +9,7 @@ use IkiWiki::UserInfo; use open qw{:utf8 :std}; use Encode; -sub printheader ($) { #{{{ +sub printheader ($) { my $session=shift; if ($config{sslcookie}) { @@ -19,9 +19,9 @@ sub printheader ($) { #{{{ print $session->header(-charset => 'utf-8', -cookie => $session->cookie(-httponly => 1)); } -} #}}} +} -sub showform ($$$$;@) { #{{{ +sub showform ($$$$;@) { my $form=shift; my $buttons=shift; my $session=shift; @@ -36,9 +36,9 @@ sub showform ($$$$;@) { #{{{ printheader($session); print misctemplate($form->title, $form->render(submit => $buttons), @_); -} #}}} +} -sub redirect ($$) { #{{{ +sub redirect ($$) { my $q=shift; my $url=shift; if (! $config{w3mmode}) { @@ -48,9 +48,9 @@ sub redirect ($$) { #{{{ print "Content-type: text/plain\n"; print "W3m-control: GOTO $url\n\n"; } -} #}}} +} -sub decode_cgi_utf8 ($) { #{{{ +sub decode_cgi_utf8 ($) { # decode_form_utf8 method is needed for 5.10 if ($] < 5.01) { my $cgi = shift; @@ -58,9 +58,9 @@ sub decode_cgi_utf8 ($) { #{{{ $cgi->param($f, map { decode_utf8 $_ } $cgi->param($f)); } } -} #}}} +} -sub decode_form_utf8 ($) { #{{{ +sub decode_form_utf8 ($) { if ($] >= 5.01) { my $form = shift; foreach my $f ($form->field) { @@ -70,11 +70,11 @@ sub decode_form_utf8 ($) { #{{{ ); } } -} #}}} +} # Check if the user is signed in. If not, redirect to the signin form and # save their place to return to later. -sub needsignin ($$) { #{{{ +sub needsignin ($$) { my $q=shift; my $session=shift; @@ -85,9 +85,9 @@ sub needsignin ($$) { #{{{ cgi_savesession($session); exit; } -} #}}} +} -sub cgi_signin ($$) { #{{{ +sub cgi_signin ($$) { my $q=shift; my $session=shift; @@ -127,9 +127,9 @@ sub cgi_signin ($$) { #{{{ } showform($form, $buttons, $session, $q); -} #}}} +} -sub cgi_postsignin ($$) { #{{{ +sub cgi_postsignin ($$) { my $q=shift; my $session=shift; @@ -144,9 +144,9 @@ sub cgi_postsignin ($$) { #{{{ else { error(gettext("login failed, perhaps you need to turn on cookies?")); } -} #}}} +} -sub cgi_prefs ($$) { #{{{ +sub cgi_prefs ($$) { my $q=shift; my $session=shift; @@ -254,9 +254,9 @@ sub cgi_prefs ($$) { #{{{ } showform($form, $buttons, $session, $q); -} #}}} +} -sub check_banned ($$) { #{{{ +sub check_banned ($$) { my $q=shift; my $session=shift; @@ -273,9 +273,9 @@ sub check_banned ($$) { #{{{ exit; } } -} #}}} +} -sub cgi_getsession ($) { #{{{ +sub cgi_getsession ($) { my $q=shift; eval q{use CGI::Session; use HTML::Entities}; @@ -294,13 +294,13 @@ sub cgi_getsession ($) { #{{{ umask($oldmask); return $session; -} #}}} +} # To guard against CSRF, the user's session id (sid) # can be stored on a form. This function will check # (for logged in users) that the sid on the form matches # the session id in the cookie. -sub checksessionexpiry ($$) { # {{{ +sub checksessionexpiry ($$) { my $q=shift; my $session = shift; @@ -310,18 +310,18 @@ sub checksessionexpiry ($$) { # {{{ error(gettext("Your login session has expired.")); } } -} # }}} +} -sub cgi_savesession ($) { #{{{ +sub cgi_savesession ($) { my $session=shift; # Force session flush with safe umask. my $oldmask=umask(077); $session->flush; umask($oldmask); -} #}}} +} -sub cgi (;$$) { #{{{ +sub cgi (;$$) { my $q=shift; my $session=shift; @@ -391,16 +391,16 @@ sub cgi (;$$) { #{{{ else { error("unknown do parameter"); } -} #}}} +} # Does not need to be called directly; all errors will go through here. -sub cgierror ($) { #{{{ +sub cgierror ($) { my $message=shift; print "Content-type: text/html\n\n"; print misctemplate(gettext("Error"), "

".gettext("Error").": $message

"); die $@; -} #}}} +} 1 diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index adaa619ab..29bc6d0ce 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -14,7 +14,7 @@ use open qw{:utf8 :std}; my %feeds; my %guids; -sub import { #{{{ +sub import { hook(type => "getopt", id => "aggregate", call => \&getopt); hook(type => "getsetup", id => "aggregate", call => \&getsetup); hook(type => "checkconfig", id => "aggregate", call => \&checkconfig); @@ -26,9 +26,9 @@ sub import { #{{{ if (exists $config{aggregate_webtrigger} && $config{aggregate_webtrigger}) { hook(type => "cgi", id => "aggregate", call => \&cgi); } -} # }}} +} -sub getopt () { #{{{ +sub getopt () { eval q{use Getopt::Long}; error($@) if $@; Getopt::Long::Configure('pass_through'); @@ -36,9 +36,9 @@ sub getopt () { #{{{ "aggregate" => \$config{aggregate}, "aggregateinternal!" => \$config{aggregateinternal}, ); -} #}}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, @@ -58,16 +58,16 @@ sub getsetup () { #{{{ safe => 1, rebuild => 0, }, -} #}}} +} -sub checkconfig () { #{{{ +sub checkconfig () { if ($config{aggregate} && ! ($config{post_commit} && IkiWiki::commit_hook_enabled())) { launchaggregation(); } -} #}}} +} -sub cgi ($) { #{{{ +sub cgi ($) { my $cgi=shift; if (defined $cgi->param('do') && @@ -90,9 +90,9 @@ sub cgi ($) { #{{{ } exit 0; } -} #}}} +} -sub launchaggregation () { #{{{ +sub launchaggregation () { # See if any feeds need aggregation. loadstate(); my @feeds=needsaggregate(); @@ -135,16 +135,16 @@ sub launchaggregation () { #{{{ unlockaggregate(); return 1; -} #}}} +} # Pages with extension _aggregated have plain html markup, pass through. -sub htmlize (@) { #{{{ +sub htmlize (@) { my %params=@_; return $params{content}; -} #}}} +} # Used by ikiwiki-transition aggregateinternal. -sub migrate_to_internal { #{{{ +sub migrate_to_internal { if (! lockaggregate()) { error("an aggregation process is currently running"); } @@ -190,9 +190,9 @@ sub migrate_to_internal { #{{{ IkiWiki::unlockwiki; unlockaggregate(); -} #}}} +} -sub needsbuild (@) { #{{{ +sub needsbuild (@) { my $needsbuild=shift; loadstate(); @@ -206,9 +206,9 @@ sub needsbuild (@) { #{{{ markunseen($feed->{sourcepage}); } } -} # }}} +} -sub preprocess (@) { #{{{ +sub preprocess (@) { my %params=@_; foreach my $required (qw{name url}) { @@ -265,9 +265,9 @@ sub preprocess (@) { #{{{ ($feed->{newposts} ? "; ".$feed->{newposts}. " ".gettext("new") : ""). ")"; -} # }}} +} -sub delete (@) { #{{{ +sub delete (@) { my @files=@_; # Remove feed data for removed pages. @@ -275,9 +275,9 @@ sub delete (@) { #{{{ my $page=pagename($file); markunseen($page); } -} #}}} +} -sub markunseen ($) { #{{{ +sub markunseen ($) { my $page=shift; foreach my $id (keys %feeds) { @@ -285,11 +285,11 @@ sub markunseen ($) { #{{{ $feeds{$id}->{unseen}=1; } } -} #}}} +} my $state_loaded=0; -sub loadstate () { #{{{ +sub loadstate () { return if $state_loaded; $state_loaded=1; if (-e "$config{wikistatedir}/aggregate") { @@ -323,9 +323,9 @@ sub loadstate () { #{{{ close IN; } -} #}}} +} -sub savestate () { #{{{ +sub savestate () { return unless $state_loaded; garbage_collect(); my $newfile="$config{wikistatedir}/aggregate.new"; @@ -350,9 +350,9 @@ sub savestate () { #{{{ close OUT || error("save $newfile: $!", $cleanup); rename($newfile, "$config{wikistatedir}/aggregate") || error("rename $newfile: $!", $cleanup); -} #}}} +} -sub garbage_collect () { #{{{ +sub garbage_collect () { foreach my $name (keys %feeds) { # remove any feeds that were not seen while building the pages # that used to contain them @@ -375,9 +375,9 @@ sub garbage_collect () { #{{{ delete $guid->{md5}; } } -} #}}} +} -sub mergestate () { #{{{ +sub mergestate () { # Load the current state in from disk, and merge into it # values from the state in memory that might have changed # during aggregation. @@ -407,15 +407,15 @@ sub mergestate () { #{{{ $guids{$guid}=$myguids{$guid}; } } -} #}}} +} -sub clearstate () { #{{{ +sub clearstate () { %feeds=(); %guids=(); $state_loaded=0; -} #}}} +} -sub expire () { #{{{ +sub expire () { foreach my $feed (values %feeds) { next unless $feed->{expireage} || $feed->{expirecount}; my $count=0; @@ -444,14 +444,14 @@ sub expire () { #{{{ } } } -} #}}} +} -sub needsaggregate () { #{{{ +sub needsaggregate () { return values %feeds if $config{rebuild}; return grep { time - $_->{lastupdate} >= $_->{updateinterval} } values %feeds; -} #}}} +} -sub aggregate (@) { #{{{ +sub aggregate (@) { eval q{use XML::Feed}; error($@) if $@; eval q{use URI::Fetch}; @@ -542,9 +542,9 @@ sub aggregate (@) { #{{{ ); } } -} #}}} +} -sub add_page (@) { #{{{ +sub add_page (@) { my %params=@_; my $feed=$params{feed}; @@ -635,21 +635,21 @@ sub add_page (@) { #{{{ # Dummy value for expiry code. $IkiWiki::pagectime{$guid->{page}}=time; } -} #}}} +} -sub wikiescape ($) { #{{{ +sub wikiescape ($) { # escape accidental wikilinks and preprocessor stuff return encode_entities(shift, '\[\]'); -} #}}} +} -sub urlabs ($$) { #{{{ +sub urlabs ($$) { my $url=shift; my $urlbase=shift; URI->new_abs($url, $urlbase)->as_string; -} #}}} +} -sub htmlabs ($$) { #{{{ +sub htmlabs ($$) { # Convert links in html from relative to absolute. # Note that this is a heuristic, which is not specified by the rss # spec and may not be right for all feeds. Also, see Debian @@ -685,15 +685,15 @@ sub htmlabs ($$) { #{{{ $p->eof; return $ret; -} #}}} +} -sub htmlfn ($) { #{{{ +sub htmlfn ($) { return shift().".".($config{aggregateinternal} ? "_aggregated" : $config{htmlext}); -} #}}} +} my $aggregatelock; -sub lockaggregate () { #{{{ +sub lockaggregate () { # Take an exclusive lock to prevent multiple concurrent aggregators. # Returns true if the lock was aquired. if (! -d $config{wikistatedir}) { @@ -706,11 +706,11 @@ sub lockaggregate () { #{{{ return 0; } return 1; -} #}}} +} -sub unlockaggregate () { #{{{ +sub unlockaggregate () { return close($aggregatelock) if $aggregatelock; return; -} #}}} +} 1 diff --git a/IkiWiki/Plugin/amazon_s3.pm b/IkiWiki/Plugin/amazon_s3.pm index 597539c13..93c10b629 100644 --- a/IkiWiki/Plugin/amazon_s3.pm +++ b/IkiWiki/Plugin/amazon_s3.pm @@ -16,13 +16,13 @@ BEGIN { } }; -sub import { #{{{ +sub import { hook(type => "getopt", id => "amazon_s3", call => \&getopt); hook(type => "getsetup", id => "amazon_s3", call => \&getsetup); hook(type => "checkconfig", id => "amazon_s3", call => \&checkconfig); -} # }}} +} -sub getopt () { #{{{ +sub getopt () { eval q{use Getopt::Long}; error($@) if $@; Getopt::Long::Configure('pass_through'); @@ -38,9 +38,9 @@ sub getopt () { #{{{ debug(gettext("done")); exit(0); }); -} #}}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 0, @@ -88,9 +88,9 @@ sub getsetup () { #{{{ safe => 1, rebuild => 1, }, -} #}}} +} -sub checkconfig { #{{{ +sub checkconfig { foreach my $field (qw{amazon_s3_key_id amazon_s3_key_file amazon_s3_bucket}) { if (! exists $config{$field} || ! defined $config{$field}) { @@ -101,11 +101,11 @@ sub checkconfig { #{{{ ! defined $config{amazon_s3_prefix}) { $config{amazon_s3_prefix}="wiki/"; } -} #}}} +} { my $bucket; -sub getbucket { #{{{ +sub getbucket { return $bucket if defined $bucket; open(IN, "<", $config{amazon_s3_key_file}) || error($config{amazon_s3_key_file}.": ".$!); @@ -138,11 +138,11 @@ sub getbucket { #{{{ } return $bucket; -} #}}} +} } # Given a file, return any S3 keys associated with it. -sub file2keys ($) { #{{{ +sub file2keys ($) { my $file=shift; my @keys; @@ -162,14 +162,14 @@ sub file2keys ($) { #{{{ } } return @keys; -} #}}} +} package IkiWiki; use File::MimeInfo; use Encode; # This is a wrapper around the real writefile. -sub writefile ($$$;$$) { #{{{ +sub writefile ($$$;$$) { my $file=shift; my $destdir=shift; my $content=shift; @@ -225,10 +225,10 @@ sub writefile ($$$;$$) { #{{{ } return $ret; -} #}}} +} # This is a wrapper around the real prune. -sub prune ($) { #{{{ +sub prune ($) { my $file=shift; my @keys=IkiWiki::Plugin::amazon_s3::file2keys($file); @@ -247,6 +247,6 @@ sub prune ($) { #{{{ } return $IkiWiki::Plugin::amazon_s3::subs{'IkiWiki::prune'}->($file); -} #}}} +} 1 diff --git a/IkiWiki/Plugin/anonok.pm b/IkiWiki/Plugin/anonok.pm index 2be983693..1cbdfe4e5 100644 --- a/IkiWiki/Plugin/anonok.pm +++ b/IkiWiki/Plugin/anonok.pm @@ -5,12 +5,12 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "anonok", call => \&getsetup); hook(type => "canedit", id => "anonok", call => \&canedit); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, @@ -24,9 +24,9 @@ sub getsetup () { #{{{ safe => 1, rebuild => 0, }, -} #}}} +} -sub canedit ($$$) { #{{{ +sub canedit ($$$) { my $page=shift; my $cgi=shift; my $session=shift; @@ -45,6 +45,6 @@ sub canedit ($$$) { #{{{ else { return ""; } -} #}}} +} 1 diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm index 44781165c..87da6cd4e 100644 --- a/IkiWiki/Plugin/attachment.pm +++ b/IkiWiki/Plugin/attachment.pm @@ -5,16 +5,16 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { add_underlay("javascript"); hook(type => "getsetup", id => "attachment", call => \&getsetup); hook(type => "checkconfig", id => "attachment", call => \&checkconfig); hook(type => "formbuilder_setup", id => "attachment", call => \&formbuilder_setup); hook(type => "formbuilder", id => "attachment", call => \&formbuilder); IkiWiki::loadplugin("filecheck"); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, @@ -35,9 +35,9 @@ sub getsetup () { #{{{ safe => 0, # executed rebuild => 0, }, -} #}}} +} -sub check_canattach ($$;$) { #{{{ +sub check_canattach ($$;$) { my $session=shift; my $dest=shift; # where it's going to be put, under the srcdir my $file=shift; # the path to the attachment currently @@ -84,13 +84,13 @@ sub check_canattach ($$;$) { #{{{ else { return 1; } -} #}}} +} -sub checkconfig () { #{{{ +sub checkconfig () { $config{cgi_disable_uploads}=0; -} #}}} +} -sub formbuilder_setup (@) { #{{{ +sub formbuilder_setup (@) { my %params=@_; my $form=$params{form}; my $q=$params{cgi}; @@ -153,9 +153,9 @@ sub formbuilder_setup (@) { #{{{ } } } -} #}}} +} -sub formbuilder (@) { #{{{ +sub formbuilder (@) { my %params=@_; my $form=$params{form}; my $q=$params{cgi}; @@ -253,9 +253,9 @@ sub formbuilder (@) { #{{{ # Generate the attachment list only after having added any new # attachments. $form->tmpl_param("attachment_list" => [attachment_list($form->field('page'))]); -} # }}} +} -sub attachment_location ($) { #{{{ +sub attachment_location ($) { my $page=shift; # Put the attachment in a subdir of the page it's attached @@ -264,9 +264,9 @@ sub attachment_location ($) { #{{{ $page.="/" if length $page; return $page; -} #}}} +} -sub attachment_list ($) { #{{{ +sub attachment_list ($) { my $page=shift; my $loc=attachment_location($page); @@ -287,6 +287,6 @@ sub attachment_list ($) { #{{{ # Sort newer attachments to the top of the list, so a newly-added # attachment appears just before the form used to add it. return sort { $b->{mtime_raw} <=> $a->{mtime_raw} || $a->{link} cmp $b->{link} } @ret; -} #}}} +} 1 diff --git a/IkiWiki/Plugin/autoindex.pm b/IkiWiki/Plugin/autoindex.pm index d1b3edb1f..bb08091ae 100644 --- a/IkiWiki/Plugin/autoindex.pm +++ b/IkiWiki/Plugin/autoindex.pm @@ -6,20 +6,20 @@ use strict; use IkiWiki 2.00; use Encode; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "autoindex", call => \&getsetup); hook(type => "refresh", id => "autoindex", call => \&refresh); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => 0, }, -} #}}} +} -sub genindex ($) { #{{{ +sub genindex ($) { my $page=shift; my $file=newpagefile($page, $config{default_pageext}); my $template=template("autoindex.tmpl"); @@ -28,9 +28,9 @@ sub genindex ($) { #{{{ if ($config{rcs}) { IkiWiki::rcs_add($file); } -} #}}} +} -sub refresh () { #{{{ +sub refresh () { eval q{use File::Find}; error($@) if $@; @@ -107,6 +107,6 @@ sub refresh () { #{{{ IkiWiki::enable_commit_hook(); } } -} #}}} +} 1 diff --git a/IkiWiki/Plugin/brokenlinks.pm b/IkiWiki/Plugin/brokenlinks.pm index 37752dd3e..1c52099bf 100644 --- a/IkiWiki/Plugin/brokenlinks.pm +++ b/IkiWiki/Plugin/brokenlinks.pm @@ -6,20 +6,20 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "brokenlinks", call => \&getsetup); hook(type => "preprocess", id => "brokenlinks", call => \&preprocess); -} # }}} +} -sub getsetup { #{{{ +sub getsetup { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} -sub preprocess (@) { #{{{ +sub preprocess (@) { my %params=@_; $params{pages}="*" unless defined $params{pages}; @@ -61,6 +61,6 @@ sub preprocess (@) { #{{{ } sort @broken) ."\n"; -} # }}} +} 1 diff --git a/IkiWiki/Plugin/bzr.pm b/IkiWiki/Plugin/bzr.pm index 1054f5b3e..16c959069 100644 --- a/IkiWiki/Plugin/bzr.pm +++ b/IkiWiki/Plugin/bzr.pm @@ -7,7 +7,7 @@ use IkiWiki; use Encode; use open qw{:utf8 :std}; -sub import { #{{{ +sub import { hook(type => "checkconfig", id => "bzr", call => \&checkconfig); hook(type => "getsetup", id => "bzr", call => \&getsetup); hook(type => "rcs", id => "rcs_update", call => \&rcs_update); @@ -20,18 +20,18 @@ sub import { #{{{ hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges); hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff); hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime); -} #}}} +} -sub checkconfig () { #{{{ +sub checkconfig () { if (defined $config{bzr_wrapper} && length $config{bzr_wrapper}) { push @{$config{wrappers}}, { wrapper => $config{bzr_wrapper}, wrappermode => (defined $config{bzr_wrappermode} ? $config{bzr_wrappermode} : "06755"), }; } -} #}}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 0, # rcs plugin @@ -65,9 +65,9 @@ sub getsetup () { #{{{ safe => 1, rebuild => 1, }, -} #}}} +} -sub bzr_log ($) { #{{{ +sub bzr_log ($) { my $out = shift; my @infos = (); my $key = undef; @@ -99,20 +99,20 @@ sub bzr_log ($) { #{{{ close $out; return @infos; -} #}}} +} -sub rcs_update () { #{{{ +sub rcs_update () { my @cmdline = ("bzr", "update", "--quiet", $config{srcdir}); if (system(@cmdline) != 0) { warn "'@cmdline' failed: $!"; } -} #}}} +} -sub rcs_prepedit ($) { #{{{ +sub rcs_prepedit ($) { return ""; -} #}}} +} -sub bzr_author ($$) { #{{{ +sub bzr_author ($$) { my ($user, $ipaddr) = @_; if (defined $user) { @@ -124,9 +124,9 @@ sub bzr_author ($$) { #{{{ else { return "Anonymous"; } -} #}}} +} -sub rcs_commit ($$$;$$) { #{{{ +sub rcs_commit ($$$;$$) { my ($file, $message, $rcstoken, $user, $ipaddr) = @_; $user = bzr_author($user, $ipaddr); @@ -143,7 +143,7 @@ sub rcs_commit ($$$;$$) { #{{{ } return undef; # success -} #}}} +} sub rcs_commit_staged ($$$) { # Commits all staged changes. Changes can be staged using rcs_add, @@ -164,27 +164,27 @@ sub rcs_commit_staged ($$$) { } return undef; # success -} #}}} +} -sub rcs_add ($) { # {{{ +sub rcs_add ($) { my ($file) = @_; my @cmdline = ("bzr", "add", "--quiet", "$config{srcdir}/$file"); if (system(@cmdline) != 0) { warn "'@cmdline' failed: $!"; } -} #}}} +} -sub rcs_remove ($) { # {{{ +sub rcs_remove ($) { my ($file) = @_; my @cmdline = ("bzr", "rm", "--force", "--quiet", "$config{srcdir}/$file"); if (system(@cmdline) != 0) { warn "'@cmdline' failed: $!"; } -} #}}} +} -sub rcs_rename ($$) { # {{{ +sub rcs_rename ($$) { my ($src, $dest) = @_; my $parent = IkiWiki::dirname($dest); @@ -196,9 +196,9 @@ sub rcs_rename ($$) { # {{{ if (system(@cmdline) != 0) { warn "'@cmdline' failed: $!"; } -} #}}} +} -sub rcs_recentchanges ($) { #{{{ +sub rcs_recentchanges ($) { my ($num) = @_; my @cmdline = ("bzr", "log", "-v", "--show-ids", "--limit", $num, @@ -253,9 +253,9 @@ sub rcs_recentchanges ($) { #{{{ } return @ret; -} #}}} +} -sub rcs_getctime ($) { #{{{ +sub rcs_getctime ($) { my ($file) = @_; # XXX filename passes through the shell here, should try to avoid @@ -274,6 +274,6 @@ sub rcs_getctime ($) { #{{{ my $ctime = str2time($log[0]->{"timestamp"}); return $ctime; -} #}}} +} 1 diff --git a/IkiWiki/Plugin/calendar.pm b/IkiWiki/Plugin/calendar.pm index 6d536a91b..88303fc44 100644 --- a/IkiWiki/Plugin/calendar.pm +++ b/IkiWiki/Plugin/calendar.pm @@ -29,13 +29,13 @@ my %linkcache; my $time=time; my @now=localtime($time); -sub import { #{{{ +sub import { hook(type => "getsetup", id => "calendar", call => \&getsetup); hook(type => "needsbuild", id => "calendar", call => \&needsbuild); hook(type => "preprocess", id => "calendar", call => \&preprocess); -} #}}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, @@ -48,23 +48,23 @@ sub getsetup () { #{{{ safe => 1, rebuild => 1, }, -} #}}} +} -sub is_leap_year (@) { #{{{ +sub is_leap_year (@) { my %params=@_; return ($params{year} % 4 == 0 && (($params{year} % 100 != 0) || $params{year} % 400 == 0)); -} #}}} +} -sub month_days { #{{{ +sub month_days { my %params=@_; my $days_in_month = (31,28,31,30,31,30,31,31,30,31,30,31)[$params{month}-1]; if ($params{month} == 2 && is_leap_year(%params)) { $days_in_month++; } return $days_in_month; -} #}}} +} -sub format_month (@) { #{{{ +sub format_month (@) { my %params=@_; my $pagespec = $params{pages}; @@ -215,9 +215,9 @@ EOF add_depends($params{page}, join(" or ", @list)); return $calendar; -} #}}} +} -sub format_year (@) { #{{{ +sub format_year (@) { my %params=@_; my $pagespec = $params{pages}; @@ -318,9 +318,9 @@ EOF EOF return $calendar; -} #}}} +} -sub preprocess (@) { #{{{ +sub preprocess (@) { my %params=@_; $params{pages} = "*" unless defined $params{pages}; $params{type} = "month" unless defined $params{type}; @@ -397,7 +397,7 @@ sub preprocess (@) { #{{{ return "\n
$calendar
\n"; } #}} -sub needsbuild (@) { #{{{ +sub needsbuild (@) { my $needsbuild=shift; foreach my $page (keys %pagestate) { if (exists $pagestate{$page}{calendar}{nextchange}) { @@ -415,6 +415,6 @@ sub needsbuild (@) { #{{{ } } } -} # }}} +} 1 diff --git a/IkiWiki/Plugin/camelcase.pm b/IkiWiki/Plugin/camelcase.pm index 7881becd5..6c1fafb7b 100644 --- a/IkiWiki/Plugin/camelcase.pm +++ b/IkiWiki/Plugin/camelcase.pm @@ -22,21 +22,21 @@ my $link_regexp=qr{ ) }x; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "camelcase", call => \&getsetup); hook(type => "linkify", id => "camelcase", call => \&linkify); hook(type => "scan", id => "camelcase", call => \&scan); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => undef, }; -} #}}} +} -sub linkify (@) { #{{{ +sub linkify (@) { my %params=@_; my $page=$params{page}; my $destpage=$params{destpage}; @@ -46,9 +46,9 @@ sub linkify (@) { #{{{ }eg; return $params{content}; -} #}}} +} -sub scan (@) { #{{{ +sub scan (@) { my %params=@_; my $page=$params{page}; my $content=$params{content}; diff --git a/IkiWiki/Plugin/color.pm b/IkiWiki/Plugin/color.pm index ac702ff02..53d8389d2 100644 --- a/IkiWiki/Plugin/color.pm +++ b/IkiWiki/Plugin/color.pm @@ -7,12 +7,12 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "preprocess", id => "color", call => \&preprocess); hook(type => "format", id => "color", call => \&format); -} #}}} +} -sub preserve_style ($$$) { #{{{ +sub preserve_style ($$$) { my $foreground = shift; my $background = shift; my $text = shift; @@ -37,18 +37,18 @@ sub preserve_style ($$$) { #{{{ return $preserved; -} #}}} +} -sub replace_preserved_style ($) { #{{{ +sub replace_preserved_style ($) { my $content = shift; $content =~ s!((color: ([a-z]+|\#[0-9a-f]{3,6})?)?((; )?(background-color: ([a-z]+|\#[0-9a-f]{3,6})?)?)?)!!g; $content =~ s!!!g; return $content; -} #}}} +} -sub preprocess (@) { #{{{ +sub preprocess (@) { my %params = @_; # Preprocess the text to expand any preprocessor directives @@ -57,13 +57,13 @@ sub preprocess (@) { #{{{ IkiWiki::filter($params{page}, $params{destpage}, $params{text})); return preserve_style($params{foreground}, $params{background}, $params{text}); -} #}}} +} -sub format (@) { #{{{ +sub format (@) { my %params = @_; $params{content} = replace_preserved_style($params{content}); return $params{content}; -} #}}} +} 1 diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index b8748a1d6..6184c6031 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -17,7 +17,7 @@ use constant CANCEL => "Cancel"; my $postcomment; -sub import { #{{{ +sub import { hook(type => "checkconfig", id => 'comments', call => \&checkconfig); hook(type => "getsetup", id => 'comments', call => \&getsetup); hook(type => "preprocess", id => '_comment', call => \&preprocess); @@ -26,9 +26,9 @@ sub import { #{{{ hook(type => "pagetemplate", id => "comments", call => \&pagetemplate); hook(type => "cgi", id => "comments", call => \&linkcgi); IkiWiki::loadplugin("inline"); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, @@ -88,15 +88,15 @@ sub getsetup () { #{{{ safe => 0, rebuild => 0, }, -} #}}} +} -sub htmlize { # {{{ +sub htmlize { my %params = @_; return $params{content}; -} # }}} +} # FIXME: copied verbatim from meta -sub safeurl ($) { #{{{ +sub safeurl ($) { my $url=shift; if (exists $IkiWiki::Plugin::htmlscrubber::{safe_url_regexp} && defined $IkiWiki::Plugin::htmlscrubber::safe_url_regexp) { @@ -105,9 +105,9 @@ sub safeurl ($) { #{{{ else { return 1; } -} #}}} +} -sub preprocess { # {{{ +sub preprocess { my %params = @_; my $page = $params{page}; @@ -206,16 +206,16 @@ sub preprocess { # {{{ # FIXME: hard-coded HTML (although it's just to set an ID) return "
$content
" if $anchor; return $content; -} # }}} +} -sub checkconfig () { #{{{ +sub checkconfig () { $config{comments_commit} = 1 unless defined $config{comments_commit}; $config{comments_pagename} = 'comment_' unless defined $config{comments_pagename}; -} #}}} +} # This is exactly the same as recentchanges_link :-( -sub linkcgi ($) { #{{{ +sub linkcgi ($) { my $cgi=shift; if (defined $cgi->param('do') && $cgi->param('do') eq "commenter") { @@ -245,7 +245,7 @@ sub linkcgi ($) { #{{{ # FIXME: basically the same logic as recentchanges # returns (author URL, pretty-printed version) -sub linkuser ($) { # {{{ +sub linkuser ($) { my $user = shift; my $oiduser = eval { IkiWiki::openiduser($user) }; @@ -262,10 +262,10 @@ sub linkuser ($) { # {{{ : "$user") ), $user); } -} # }}} +} # Mostly cargo-culted from IkiWiki::plugin::editpage -sub sessioncgi ($$) { #{{{ +sub sessioncgi ($$) { my $cgi=shift; my $session=shift; @@ -512,9 +512,9 @@ sub sessioncgi ($$) { #{{{ } exit; -} #}}} +} -sub pagetemplate (@) { #{{{ +sub pagetemplate (@) { my %params = @_; my $page = $params{page}; @@ -583,7 +583,7 @@ sub pagetemplate (@) { #{{{ $template->param(commentauthorurl => $pagestate{$page}{comments}{commentauthorurl}); } -} # }}} +} package IkiWiki::PageSpec; diff --git a/IkiWiki/Plugin/conditional.pm b/IkiWiki/Plugin/conditional.pm index e787424aa..66253e07d 100644 --- a/IkiWiki/Plugin/conditional.pm +++ b/IkiWiki/Plugin/conditional.pm @@ -6,20 +6,20 @@ use strict; use IkiWiki 2.00; use UNIVERSAL; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "conditional", call => \&getsetup); hook(type => "preprocess", id => "if", call => \&preprocess_if); -} # }}} +} -sub getsetup { #{{{ +sub getsetup { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} -sub preprocess_if (@) { #{{{ +sub preprocess_if (@) { my %params=@_; foreach my $param (qw{test then}) { @@ -66,11 +66,11 @@ sub preprocess_if (@) { #{{{ } return IkiWiki::preprocess($params{page}, $params{destpage}, IkiWiki::filter($params{page}, $params{destpage}, $ret)); -} # }}} +} package IkiWiki::PageSpec; -sub match_enabled ($$;@) { #{{{ +sub match_enabled ($$;@) { shift; my $plugin=shift; @@ -81,9 +81,9 @@ sub match_enabled ($$;@) { #{{{ else { return IkiWiki::FailReason->new("$plugin is not enabled"); } -} #}}} +} -sub match_sourcepage ($$;@) { #{{{ +sub match_sourcepage ($$;@) { shift; my $glob=shift; my %params=@_; @@ -95,9 +95,9 @@ sub match_sourcepage ($$;@) { #{{{ else { return IkiWiki::FailReason->new("sourcepage does not match $glob"); } -} #}}} +} -sub match_destpage ($$;@) { #{{{ +sub match_destpage ($$;@) { shift; my $glob=shift; my %params=@_; @@ -109,9 +109,9 @@ sub match_destpage ($$;@) { #{{{ else { return IkiWiki::FailReason->new("destpage does not match $glob"); } -} #}}} +} -sub match_included ($$;@) { #{{{ +sub match_included ($$;@) { shift; shift; my %params=@_; @@ -123,6 +123,6 @@ sub match_included ($$;@) { #{{{ else { return IkiWiki::FailReason->new("page $params{sourcepage} is not included"); } -} #}}} +} 1 diff --git a/IkiWiki/Plugin/creole.pm b/IkiWiki/Plugin/creole.pm index 7c729300d..3c46a48df 100644 --- a/IkiWiki/Plugin/creole.pm +++ b/IkiWiki/Plugin/creole.pm @@ -7,20 +7,20 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "creole", call => \&getsetup); hook(type => "htmlize", id => "creole", call => \&htmlize); -} # }}} +} -sub getsetup { #{{{ +sub getsetup { return plugin => { safe => 1, rebuild => 1, # format plugin }, -} #}}} +} -sub htmlize (@) { #{{{ +sub htmlize (@) { my %params=@_; my $content = $params{content}; @@ -32,6 +32,6 @@ sub htmlize (@) { #{{{ creole_custombarelinks(); return creole_parse($content); -} # }}} +} 1 diff --git a/IkiWiki/Plugin/cutpaste.pm b/IkiWiki/Plugin/cutpaste.pm index 92667a1ef..e579c1ea2 100644 --- a/IkiWiki/Plugin/cutpaste.pm +++ b/IkiWiki/Plugin/cutpaste.pm @@ -7,22 +7,22 @@ use IkiWiki 2.00; my %savedtext; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "cutpaste", call => \&getsetup); hook(type => "preprocess", id => "cut", call => \&preprocess_cut, scan => 1); hook(type => "preprocess", id => "copy", call => \&preprocess_copy, scan => 1); hook(type => "preprocess", id => "paste", call => \&preprocess_paste); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} -sub preprocess_cut (@) { #{{{ +sub preprocess_cut (@) { my %params=@_; foreach my $param (qw{id text}) { @@ -35,9 +35,9 @@ sub preprocess_cut (@) { #{{{ $savedtext{$params{page}}->{$params{id}} = $params{text}; return "" if defined wantarray; -} # }}} +} -sub preprocess_copy (@) { #{{{ +sub preprocess_copy (@) { my %params=@_; foreach my $param (qw{id text}) { @@ -51,9 +51,9 @@ sub preprocess_copy (@) { #{{{ return IkiWiki::preprocess($params{page}, $params{destpage}, IkiWiki::filter($params{page}, $params{destpage}, $params{text})) if defined wantarray; -} # }}} +} -sub preprocess_paste (@) { #{{{ +sub preprocess_paste (@) { my %params=@_; foreach my $param (qw{id}) { @@ -71,6 +71,6 @@ sub preprocess_paste (@) { #{{{ return IkiWiki::preprocess($params{page}, $params{destpage}, IkiWiki::filter($params{page}, $params{destpage}, $savedtext{$params{page}}->{$params{id}})); -} # }}} +} 1; diff --git a/IkiWiki/Plugin/ddate.pm b/IkiWiki/Plugin/ddate.pm index c73317b2f..3470640dc 100644 --- a/IkiWiki/Plugin/ddate.pm +++ b/IkiWiki/Plugin/ddate.pm @@ -5,19 +5,19 @@ package IkiWiki::Plugin::ddate; use IkiWiki 2.00; no warnings; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "ddate", call => \&getsetup); -} # }}} +} -sub getsetup { #{{{ +sub getsetup { return plugin => { safe => 1, rebuild => 1, }, -} #}}} +} -sub IkiWiki::formattime ($;$) { #{{{ +sub IkiWiki::formattime ($;$) { my $time=shift; my $format=shift; if (! defined $format) { @@ -36,6 +36,6 @@ sub IkiWiki::formattime ($;$) { #{{{ my $dt = DateTime->from_epoch(epoch => $time); my $dd = DateTime::Calendar::Discordian->from_object(object => $dt); return $dd->strftime($format); -} #}}} +} 5 diff --git a/IkiWiki/Plugin/editdiff.pm b/IkiWiki/Plugin/editdiff.pm index f5d7837fc..068b83b3c 100644 --- a/IkiWiki/Plugin/editdiff.pm +++ b/IkiWiki/Plugin/editdiff.pm @@ -8,21 +8,21 @@ use IkiWiki 2.00; use HTML::Entities; use IPC::Open2; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "editdiff", call => \&getsetup); hook(type => "formbuilder_setup", id => "editdiff", call => \&formbuilder_setup); -} #}}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => 0, }, -} #}}} +} -sub diff ($$) { #{{{ +sub diff ($$) { my $orig=shift; my $content=shift; @@ -50,9 +50,9 @@ sub diff ($$) { #{{{ return "couldn't run diff\n" if $sigpipe; return "
".encode_entities($ret)."
"; -} #}}} +} -sub formbuilder_setup { #{{{ +sub formbuilder_setup { my %params=@_; my $form=$params{form}; @@ -72,6 +72,6 @@ sub formbuilder_setup { #{{{ my $diff = diff(srcfile($pagesources{$page}), $content); $form->tmpl_param("page_preview", $diff); } -} #}}} +} 1 diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm index 242624d77..9210d6ff8 100644 --- a/IkiWiki/Plugin/editpage.pm +++ b/IkiWiki/Plugin/editpage.pm @@ -6,19 +6,19 @@ use strict; use IkiWiki; use open qw{:utf8 :std}; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "editpage", call => \&getsetup); hook(type => "refresh", id => "editpage", call => \&refresh); hook(type => "sessioncgi", id => "editpage", call => \&IkiWiki::cgi_editpage); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => 1, }, -} #}}} +} sub refresh () { if (exists $wikistate{editpage} && exists $wikistate{editpage}{previews}) { @@ -54,7 +54,7 @@ sub refresh () { # and other plugins use the functions below. package IkiWiki; -sub check_canedit ($$$;$) { #{{{ +sub check_canedit ($$$;$) { my $page=shift; my $q=shift; my $session=shift; @@ -79,9 +79,9 @@ sub check_canedit ($$$;$) { #{{{ } }); return $canedit; -} #}}} +} -sub cgi_editpage ($$) { #{{{ +sub cgi_editpage ($$) { my $q=shift; my $session=shift; @@ -453,6 +453,6 @@ sub cgi_editpage ($$) { #{{{ } exit; -} #}}} +} 1 diff --git a/IkiWiki/Plugin/edittemplate.pm b/IkiWiki/Plugin/edittemplate.pm index 846b4e7c8..7c0e7c2f8 100644 --- a/IkiWiki/Plugin/edittemplate.pm +++ b/IkiWiki/Plugin/edittemplate.pm @@ -7,7 +7,7 @@ use IkiWiki 2.00; use HTML::Template; use Encode; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "edittemplate", call => \&getsetup); hook(type => "needsbuild", id => "edittemplate", @@ -16,17 +16,17 @@ sub import { #{{{ call => \&preprocess); hook(type => "formbuilder", id => "edittemplate", call => \&formbuilder); -} #}}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} -sub needsbuild (@) { #{{{ +sub needsbuild (@) { my $needsbuild=shift; foreach my $page (keys %pagestate) { @@ -40,9 +40,9 @@ sub needsbuild (@) { #{{{ } } } -} #}}} +} -sub preprocess (@) { #{{{ +sub preprocess (@) { my %params=@_; return "" if $params{page} ne $params{destpage}; @@ -62,9 +62,9 @@ sub preprocess (@) { #{{{ return sprintf(gettext("edittemplate %s registered for %s"), htmllink($params{page}, $params{destpage}, $link), $params{match}); -} # }}} +} -sub formbuilder (@) { #{{{ +sub formbuilder (@) { my %params=@_; my $form=$params{form}; @@ -103,9 +103,9 @@ sub formbuilder (@) { #{{{ } } } -} #}}} +} -sub filltemplate ($$) { #{{{ +sub filltemplate ($$) { my $template_page=shift; my $page=shift; @@ -136,6 +136,6 @@ sub filltemplate ($$) { #{{{ $template->param(name => $page); return $template->output; -} #}}} +} 1 diff --git a/IkiWiki/Plugin/embed.pm b/IkiWiki/Plugin/embed.pm index 2a1637392..664c95763 100644 --- a/IkiWiki/Plugin/embed.pm +++ b/IkiWiki/Plugin/embed.pm @@ -43,35 +43,35 @@ my $safehtml=qr{( my @embedded; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "embed", call => \&getsetup); hook(type => "filter", id => "embed", call => \&filter); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} -sub embed ($) { #{{{ +sub embed ($) { hook(type => "format", id => "embed", call => \&format) unless @embedded; push @embedded, shift; return "
"; -} #}}} +} -sub filter (@) { #{{{ +sub filter (@) { my %params=@_; $params{content} =~ s/$safehtml/embed($1)/eg; return $params{content}; -} # }}} +} -sub format (@) { #{{{ +sub format (@) { my %params=@_; $params{content} =~ s/
<\/div>/$embedded[$1]/eg; return $params{content}; -} # }}} +} 1 diff --git a/IkiWiki/Plugin/external.pm b/IkiWiki/Plugin/external.pm index 4ce9c8bab..2d540143f 100644 --- a/IkiWiki/Plugin/external.pm +++ b/IkiWiki/Plugin/external.pm @@ -14,7 +14,7 @@ use IO::Handle; my %plugins; -sub import { #{{{ +sub import { my $self=shift; my $plugin=shift; return unless defined $plugin; @@ -32,17 +32,17 @@ sub import { #{{{ $RPC::XML::ENCODING="utf-8"; rpc_call($plugins{$plugin}, "import"); -} #}}} +} -sub rpc_write ($$) { #{{{ +sub rpc_write ($$) { my $fh=shift; my $string=shift; $fh->print($string."\n"); $fh->flush; -} #}}} +} -sub rpc_call ($$;@) { #{{{ +sub rpc_call ($$;@) { my $plugin=shift; my $command=shift; @@ -131,12 +131,12 @@ sub rpc_call ($$;@) { #{{{ } return undef; -} #}}} +} package IkiWiki::RPC::XML; use Memoize; -sub getvar ($$$) { #{{{ +sub getvar ($$$) { my $plugin=shift; my $varname="IkiWiki::".shift; my $key=shift; @@ -145,9 +145,9 @@ sub getvar ($$$) { #{{{ my $ret=$varname->{$key}; use strict 'refs'; return $ret; -} #}}} +} -sub setvar ($$$;@) { #{{{ +sub setvar ($$$;@) { my $plugin=shift; my $varname="IkiWiki::".shift; my $key=shift; @@ -157,18 +157,18 @@ sub setvar ($$$;@) { #{{{ my $ret=$varname->{$key}=$value; use strict 'refs'; return $ret; -} #}}} +} -sub getstate ($$$$) { #{{{ +sub getstate ($$$$) { my $plugin=shift; my $page=shift; my $id=shift; my $key=shift; return $IkiWiki::pagestate{$page}{$id}{$key}; -} #}}} +} -sub setstate ($$$$;@) { #{{{ +sub setstate ($$$$;@) { my $plugin=shift; my $page=shift; my $id=shift; @@ -176,22 +176,22 @@ sub setstate ($$$$;@) { #{{{ my $value=shift; return $IkiWiki::pagestate{$page}{$id}{$key}=$value; -} #}}} +} -sub getargv ($) { #{{{ +sub getargv ($) { my $plugin=shift; return \@ARGV; -} #}}} +} -sub setargv ($@) { #{{{ +sub setargv ($@) { my $plugin=shift; my $array=shift; @ARGV=@$array; -} #}}} +} -sub inject ($@) { #{{{ +sub inject ($@) { # Bind a given perl function name to a particular RPC request. my $plugin=shift; my %params=@_; @@ -213,9 +213,9 @@ sub inject ($@) { #{{{ # the injected version. IkiWiki::inject(name => $params{name}, call => $sub); return 1; -} #}}} +} -sub hook ($@) { #{{{ +sub hook ($@) { # the call parameter is a function name to call, since XML RPC # cannot pass a function reference my $plugin=shift; @@ -227,13 +227,13 @@ sub hook ($@) { #{{{ IkiWiki::hook(%params, call => sub { IkiWiki::Plugin::external::rpc_call($plugin, $callback, @_); }); -} #}}} +} -sub pagespec_match ($@) { #{{{ +sub pagespec_match ($@) { # convert pagespec_match's return object into a XML RPC boolean my $plugin=shift; return RPC::XML::boolean->new(0 + IkiWiki::pagespec_march(@_)); -} #}}} +} 1 diff --git a/IkiWiki/Plugin/favicon.pm b/IkiWiki/Plugin/favicon.pm index e9204dea9..68359a4aa 100644 --- a/IkiWiki/Plugin/favicon.pm +++ b/IkiWiki/Plugin/favicon.pm @@ -7,20 +7,20 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "favicon", call => \&getsetup); hook(type => "pagetemplate", id => "favicon", call => \&pagetemplate); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => 1, }, -} #}}} +} -sub pagetemplate (@) { #{{{ +sub pagetemplate (@) { my %params=@_; my $template=$params{template}; @@ -28,6 +28,6 @@ sub pagetemplate (@) { #{{{ if ($template->query(name => "favicon")) { $template->param(favicon => "favicon.ico"); } -} # }}} +} 1 diff --git a/IkiWiki/Plugin/filecheck.pm b/IkiWiki/Plugin/filecheck.pm index 27f764e3b..5040a185c 100644 --- a/IkiWiki/Plugin/filecheck.pm +++ b/IkiWiki/Plugin/filecheck.pm @@ -37,9 +37,9 @@ my %units=( #{{{ # size in bytes # ikiwiki, if you find you need larger data quantities, either modify # yourself to add them, or travel back in time to 2008 and kill me. # -- Joey -); #}}} +); -sub parsesize ($) { #{{{ +sub parsesize ($) { my $size=shift; no warnings; @@ -51,10 +51,10 @@ sub parsesize ($) { #{{{ } } return $base; -} #}}} +} # This is provided for other plugins that want to convert back the other way. -sub humansize ($) { #{{{ +sub humansize ($) { my $size=shift; foreach my $unit (reverse sort { $units{$a} <=> $units{$b} || $b cmp $a } keys %units) { @@ -63,11 +63,11 @@ sub humansize ($) { #{{{ } } return $size; # near zero, or negative -} #}}} +} package IkiWiki::PageSpec; -sub match_maxsize ($$;@) { #{{{ +sub match_maxsize ($$;@) { my $page=shift; my $maxsize=eval{IkiWiki::Plugin::filecheck::parsesize(shift)}; if ($@) { @@ -86,9 +86,9 @@ sub match_maxsize ($$;@) { #{{{ else { return IkiWiki::SuccessReason->new("file not too large"); } -} #}}} +} -sub match_minsize ($$;@) { #{{{ +sub match_minsize ($$;@) { my $page=shift; my $minsize=eval{IkiWiki::Plugin::filecheck::parsesize(shift)}; if ($@) { @@ -107,9 +107,9 @@ sub match_minsize ($$;@) { #{{{ else { return IkiWiki::SuccessReason->new("file not too small"); } -} #}}} +} -sub match_mimetype ($$;@) { #{{{ +sub match_mimetype ($$;@) { my $page=shift; my $wanted=shift; @@ -140,9 +140,9 @@ sub match_mimetype ($$;@) { #{{{ else { return IkiWiki::SuccessReason->new("file MIME type is $mimetype"); } -} #}}} +} -sub match_virusfree ($$;@) { #{{{ +sub match_virusfree ($$;@) { my $page=shift; my $wanted=shift; @@ -182,9 +182,9 @@ sub match_virusfree ($$;@) { #{{{ else { return IkiWiki::SuccessReason->new("file seems virusfree ($reason)"); } -} #}}} +} -sub match_ispage ($$;@) { #{{{ +sub match_ispage ($$;@) { my $filename=shift; if (defined IkiWiki::pagetype($filename)) { @@ -193,4 +193,4 @@ sub match_ispage ($$;@) { #{{{ else { return IkiWiki::FailReason->new("file is not a wiki page"); } -} #}}} +} diff --git a/IkiWiki/Plugin/format.pm b/IkiWiki/Plugin/format.pm index 1e21a0bdc..b4d3a3c5f 100644 --- a/IkiWiki/Plugin/format.pm +++ b/IkiWiki/Plugin/format.pm @@ -5,11 +5,11 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "preprocess", id => "format", call => \&preprocess); -} #}}} +} -sub preprocess (@) { #{{{ +sub preprocess (@) { my $format=$_[0]; shift; shift; my $text=$_[0]; @@ -25,6 +25,6 @@ sub preprocess (@) { #{{{ return IkiWiki::htmlize($params{page}, $params{destpage}, $format, IkiWiki::preprocess($params{page}, $params{destpage}, $text)); -} #}}} +} 1 diff --git a/IkiWiki/Plugin/fortune.pm b/IkiWiki/Plugin/fortune.pm index 456b63e9f..6a12f28fd 100644 --- a/IkiWiki/Plugin/fortune.pm +++ b/IkiWiki/Plugin/fortune.pm @@ -6,20 +6,20 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "fortune", call => \&getsetup); hook(type => "preprocess", id => "fortune", call => \&preprocess); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} -sub preprocess (@) { #{{{ +sub preprocess (@) { $ENV{PATH}="$ENV{PATH}:/usr/games:/usr/local/games"; my $f = `fortune 2>/dev/null`; @@ -29,6 +29,6 @@ sub preprocess (@) { #{{{ else { return "
$f
\n"; } -} # }}} +} 1 diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index 1a39d87e5..6a7f6c3ae 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -11,7 +11,7 @@ my $sha1_pattern = qr/[0-9a-fA-F]{40}/; # pattern to validate Git sha1sums my $dummy_commit_msg = 'dummy commit'; # message to skip in recent changes my $no_chdir=0; -sub import { #{{{ +sub import { hook(type => "checkconfig", id => "git", call => \&checkconfig); hook(type => "getsetup", id => "git", call => \&getsetup); hook(type => "rcs", id => "rcs_update", call => \&rcs_update); @@ -25,9 +25,9 @@ sub import { #{{{ hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff); hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime); hook(type => "rcs", id => "rcs_receive", call => \&rcs_receive); -} #}}} +} -sub checkconfig () { #{{{ +sub checkconfig () { if (! defined $config{gitorigin_branch}) { $config{gitorigin_branch}="origin"; } @@ -49,9 +49,9 @@ sub checkconfig () { #{{{ wrappermode => (defined $config{git_wrappermode} ? $config{git_wrappermode} : "06755"), }; } -} #}}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 0, # rcs plugin @@ -113,9 +113,9 @@ sub getsetup () { #{{{ safe => 0, # paranoia rebuild => 0, }, -} #}}} +} -sub safe_git (&@) { #{{{ +sub safe_git (&@) { # Start a child process safely without resorting /bin/sh. # Return command output or success state (in scalar context). @@ -152,9 +152,9 @@ sub safe_git (&@) { #{{{ sub run_or_die ($@) { safe_git(\&error, @_) } sub run_or_cry ($@) { safe_git(sub { warn @_ }, @_) } sub run_or_non ($@) { safe_git(undef, @_) } -#}}} -sub merge_past ($$$) { #{{{ + +sub merge_past ($$$) { # Unlike with Subversion, Git cannot make a 'svn merge -rN:M file'. # Git merge commands work with the committed changes, except in the # implicit case of '-m' of git checkout(1). So we should invent a @@ -246,9 +246,9 @@ sub merge_past ($$$) { #{{{ error("Git merge failed!\n$failure\n") if $failure; return $conflict; -} #}}} +} -sub parse_diff_tree ($@) { #{{{ +sub parse_diff_tree ($@) { # Parse the raw diff tree chunk and return the info hash. # See git-diff-tree(1) for the syntax. @@ -358,9 +358,9 @@ sub parse_diff_tree ($@) { #{{{ } return \%ci; -} #}}} +} -sub git_commit_info ($;$) { #{{{ +sub git_commit_info ($;$) { # Return an array of commit info hashes of num commits # starting from the given sha1sum. my ($sha1, $num) = @_; @@ -381,9 +381,9 @@ sub git_commit_info ($;$) { #{{{ warn "Cannot parse commit info for '$sha1' commit" if !@ci; return wantarray ? @ci : $ci[0]; -} #}}} +} -sub git_sha1 (;$) { #{{{ +sub git_sha1 (;$) { # Return head sha1sum (of given file). my $file = shift || q{--}; @@ -394,25 +394,25 @@ sub git_sha1 (;$) { #{{{ ($sha1) = $sha1 =~ m/($sha1_pattern)/; # sha1 is untainted now } else { debug("Empty sha1sum for '$file'.") } return defined $sha1 ? $sha1 : q{}; -} #}}} +} -sub rcs_update () { #{{{ +sub rcs_update () { # Update working directory. if (length $config{gitorigin_branch}) { run_or_cry('git', 'pull', $config{gitorigin_branch}); } -} #}}} +} -sub rcs_prepedit ($) { #{{{ +sub rcs_prepedit ($) { # Return the commit sha1sum of the file when editing begins. # This will be later used in rcs_commit if a merge is required. my ($file) = @_; return git_sha1($file); -} #}}} +} -sub rcs_commit ($$$;$$) { #{{{ +sub rcs_commit ($$$;$$) { # Try to commit the page; returns undef on _success_ and # a version of the page with the rcs's conflict markers on # failure. @@ -431,7 +431,7 @@ sub rcs_commit ($$$;$$) { #{{{ rcs_add($file); return rcs_commit_staged($message, $user, $ipaddr); -} #}}} +} sub rcs_commit_staged ($$$) { # Commits all staged changes. Changes can be staged using rcs_add, @@ -472,29 +472,29 @@ sub rcs_commit_staged ($$$) { return undef; # success } -sub rcs_add ($) { # {{{ +sub rcs_add ($) { # Add file to archive. my ($file) = @_; run_or_cry('git', 'add', $file); -} #}}} +} -sub rcs_remove ($) { # {{{ +sub rcs_remove ($) { # Remove file from archive. my ($file) = @_; run_or_cry('git', 'rm', '-f', $file); -} #}}} +} -sub rcs_rename ($$) { # {{{ +sub rcs_rename ($$) { my ($src, $dest) = @_; run_or_cry('git', 'mv', '-f', $src, $dest); -} #}}} +} -sub rcs_recentchanges ($) { #{{{ +sub rcs_recentchanges ($) { # List of recent changes. my ($num) = @_; @@ -562,9 +562,9 @@ sub rcs_recentchanges ($) { #{{{ } return @rets; -} #}}} +} -sub rcs_diff ($) { #{{{ +sub rcs_diff ($) { my $rev=shift; my ($sha1) = $rev =~ /^($sha1_pattern)$/; # untaint my @lines; @@ -579,9 +579,9 @@ sub rcs_diff ($) { #{{{ else { return join("", @lines); } -} #}}} +} -sub rcs_getctime ($) { #{{{ +sub rcs_getctime ($) { my $file=shift; # Remove srcdir prefix $file =~ s/^\Q$config{srcdir}\E\/?//; @@ -592,9 +592,9 @@ sub rcs_getctime ($) { #{{{ debug("ctime for '$file': ". localtime($ctime)); return $ctime; -} #}}} +} -sub rcs_receive () { #{{{ +sub rcs_receive () { # The wiki may not be the only thing in the git repo. # Determine if it is in a subdirectory by examining the srcdir, # and its parents, looking for the .git directory. @@ -685,6 +685,6 @@ sub rcs_receive () { #{{{ } return reverse @rets; -} #}}} +} 1 diff --git a/IkiWiki/Plugin/goodstuff.pm b/IkiWiki/Plugin/goodstuff.pm index a18e626d4..92bc8200a 100644 --- a/IkiWiki/Plugin/goodstuff.pm +++ b/IkiWiki/Plugin/goodstuff.pm @@ -24,19 +24,19 @@ my @bundle=qw{ toggle }; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "goodstuff", call => \&getsetup); foreach my $plugin (@bundle) { IkiWiki::loadplugin($plugin); } -} # }}} +} -sub getsetup { #{{{ +sub getsetup { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} 1 diff --git a/IkiWiki/Plugin/google.pm b/IkiWiki/Plugin/google.pm index 92b9b29eb..5394c5a6f 100644 --- a/IkiWiki/Plugin/google.pm +++ b/IkiWiki/Plugin/google.pm @@ -8,21 +8,21 @@ use URI; my $host; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "google", call => \&getsetup); hook(type => "checkconfig", id => "google", call => \&checkconfig); hook(type => "pagetemplate", id => "google", call => \&pagetemplate); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => 1, }, -} #}}} +} -sub checkconfig () { #{{{ +sub checkconfig () { if (! length $config{url}) { error(sprintf(gettext("Must specify %s when using the google search plugin"), "url")); } @@ -31,10 +31,10 @@ sub checkconfig () { #{{{ error(gettext("Failed to parse url, cannot determine domain name")); } $host=$uri->host; -} #}}} +} my $form; -sub pagetemplate (@) { #{{{ +sub pagetemplate (@) { my %params=@_; my $page=$params{page}; my $template=$params{template}; @@ -49,6 +49,6 @@ sub pagetemplate (@) { #{{{ $template->param(searchform => $form); } -} #}}} +} 1 diff --git a/IkiWiki/Plugin/googlecalendar.pm b/IkiWiki/Plugin/googlecalendar.pm index 81a3ad677..9e09d7dbb 100644 --- a/IkiWiki/Plugin/googlecalendar.pm +++ b/IkiWiki/Plugin/googlecalendar.pm @@ -5,24 +5,24 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "googlecalendar", call => \&getsetup); hook(type => "preprocess", id => "googlecalendar", call => \&preprocess); hook(type => "format", id => "googlecalendar", call => \&format); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} -sub preprocess (@) { #{{{ +sub preprocess (@) { my %params=@_; # Parse the html, looking for the url to embed for the calendar. @@ -35,21 +35,21 @@ sub preprocess (@) { #{{{ my ($width)=$params{html}=~m#width="(\d+)"#; return "
"; -} # }}} +} -sub format (@) { #{{{ +sub format (@) { my %params=@_; $params{content}=~s/
<\/div>/gencal($1,$2,$3)/eg; return $params{content}; -} # }}} +} -sub gencal ($$$) { #{{{ +sub gencal ($$$) { my $url=shift; my $height=shift; my $width=shift; return qq{}; -} #}}} +} 1 diff --git a/IkiWiki/Plugin/graphviz.pm b/IkiWiki/Plugin/graphviz.pm index 20b419413..23631da30 100644 --- a/IkiWiki/Plugin/graphviz.pm +++ b/IkiWiki/Plugin/graphviz.pm @@ -8,24 +8,24 @@ use strict; use IkiWiki 2.00; use IPC::Open2; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "graphviz", call => \&getsetup); hook(type => "preprocess", id => "graph", call => \&graph); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} my %graphviz_programs = ( "dot" => 1, "neato" => 1, "fdp" => 1, "twopi" => 1, "circo" => 1 ); -sub render_graph (\%) { #{{{ +sub render_graph (\%) { my %params = %{(shift)}; my $src = "$params{type} g {\n"; @@ -84,9 +84,9 @@ sub render_graph (\%) { #{{{ else { return "\n"; } -} #}}} +} -sub graph (@) { #{{{ +sub graph (@) { my %params=@_; $params{src} = "" unless defined $params{src}; $params{type} = "digraph" unless defined $params{type}; @@ -94,6 +94,6 @@ sub graph (@) { #{{{ error gettext("prog not a valid graphviz program") unless $graphviz_programs{$params{prog}}; return render_graph(%params); -} # }}} +} 1 diff --git a/IkiWiki/Plugin/haiku.pm b/IkiWiki/Plugin/haiku.pm index eb8b786e8..fe68c6eec 100644 --- a/IkiWiki/Plugin/haiku.pm +++ b/IkiWiki/Plugin/haiku.pm @@ -6,20 +6,20 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "haiku", call => \&getsetup); hook(type => "preprocess", id => "haiku", call => \&preprocess); -} # }}} +} -sub getsetup { #{{{ +sub getsetup { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} -sub preprocess (@) { #{{{ +sub preprocess (@) { my %params=@_; my $haiku; @@ -54,6 +54,6 @@ sub preprocess (@) { #{{{ $haiku=~s/\n/
\n/mg; return "\n\n

$haiku

\n\n"; -} # }}} +} 1 diff --git a/IkiWiki/Plugin/hnb.pm b/IkiWiki/Plugin/hnb.pm index 40e4f9452..d5b5ce3b4 100644 --- a/IkiWiki/Plugin/hnb.pm +++ b/IkiWiki/Plugin/hnb.pm @@ -13,20 +13,20 @@ use strict; use IkiWiki 2.00; use File::Temp qw(:mktemp); -sub import { #{{{ +sub import { hook(type => "getsetup", id => "hnb", call => \&getsetup); hook(type => "htmlize", id => "hnb", call => \&htmlize); -} #}}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => 1, # format plugin }, -} #}}} +} -sub htmlize (@) { #{{{ +sub htmlize (@) { my %params = @_; # hnb outputs version number etc. every time to STDOUT, so @@ -52,6 +52,6 @@ sub htmlize (@) { #{{{ $ret =~ s/.*//si; return $ret; -} #}}} +} 1; diff --git a/IkiWiki/Plugin/html.pm b/IkiWiki/Plugin/html.pm index b75207578..9b9547cca 100644 --- a/IkiWiki/Plugin/html.pm +++ b/IkiWiki/Plugin/html.pm @@ -6,7 +6,7 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "html", call => \&getsetup); hook(type => "htmlize", id => "html", call => \&htmlize); hook(type => "htmlize", id => "htm", call => \&htmlize); @@ -14,19 +14,19 @@ sub import { #{{{ # ikiwiki defaults to skipping .html files as a security measure; # make it process them so this plugin can take effect $config{wiki_file_prune_regexps} = [ grep { !m/\\\.x\?html\?\$/ } @{$config{wiki_file_prune_regexps}} ]; -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => 1, # format plugin }, -} #}}} +} -sub htmlize (@) { #{{{ +sub htmlize (@) { my %params=@_; return $params{content}; -} #}}} +} 1 diff --git a/IkiWiki/Plugin/htmlbalance.pm b/IkiWiki/Plugin/htmlbalance.pm index dcd92055f..acbe40a5d 100644 --- a/IkiWiki/Plugin/htmlbalance.pm +++ b/IkiWiki/Plugin/htmlbalance.pm @@ -13,20 +13,20 @@ use IkiWiki 2.00; use HTML::TreeBuilder; use HTML::Entities; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "htmlbalance", call => \&getsetup); hook(type => "sanitize", id => "htmlbalance", call => \&sanitize); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} -sub sanitize (@) { #{{{ +sub sanitize (@) { my %params=@_; my $ret = ''; @@ -52,6 +52,6 @@ sub sanitize (@) { #{{{ } $tree->delete(); return $ret; -} # }}} +} 1 diff --git a/IkiWiki/Plugin/htmlscrubber.pm b/IkiWiki/Plugin/htmlscrubber.pm index 7398c8478..823b3d806 100644 --- a/IkiWiki/Plugin/htmlscrubber.pm +++ b/IkiWiki/Plugin/htmlscrubber.pm @@ -9,7 +9,7 @@ use IkiWiki 2.00; # Feel free to use it from other plugins. our $safe_url_regexp; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "htmlscrubber", call => \&getsetup); hook(type => "sanitize", id => "htmlscrubber", call => \&sanitize); @@ -33,9 +33,9 @@ sub import { #{{{ # data is a special case. Allow data:image/*, but # disallow data:text/javascript and everything else. $safe_url_regexp=qr/^(?:(?:$uri_schemes):|data:image\/|[^:]+(?:$|\/))/i; -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, @@ -49,9 +49,9 @@ sub getsetup () { #{{{ safe => 1, rebuild => undef, }, -} #}}} +} -sub sanitize (@) { #{{{ +sub sanitize (@) { my %params=@_; if (exists $config{htmlscrubber_skip} && @@ -62,10 +62,10 @@ sub sanitize (@) { #{{{ } return scrubber()->scrub($params{content}); -} # }}} +} my $_scrubber; -sub scrubber { #{{{ +sub scrubber { return $_scrubber if defined $_scrubber; eval q{use HTML::Scrubber}; @@ -111,6 +111,6 @@ sub scrubber { #{{{ }], ); return $_scrubber; -} # }}} +} 1 diff --git a/IkiWiki/Plugin/htmltidy.pm b/IkiWiki/Plugin/htmltidy.pm index 9ba5e9592..02438ebef 100644 --- a/IkiWiki/Plugin/htmltidy.pm +++ b/IkiWiki/Plugin/htmltidy.pm @@ -12,20 +12,20 @@ use strict; use IkiWiki 2.00; use IPC::Open2; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "tidy", call => \&getsetup); hook(type => "sanitize", id => "tidy", call => \&sanitize); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} -sub sanitize (@) { #{{{ +sub sanitize (@) { my %params=@_; my $pid; @@ -49,6 +49,6 @@ sub sanitize (@) { #{{{ return "" if $sigpipe || ! defined $ret; return $ret; -} # }}} +} 1 diff --git a/IkiWiki/Plugin/httpauth.pm b/IkiWiki/Plugin/httpauth.pm index fc0cffb1e..39edff615 100644 --- a/IkiWiki/Plugin/httpauth.pm +++ b/IkiWiki/Plugin/httpauth.pm @@ -6,26 +6,26 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "httpauth", call => \&getsetup); hook(type => "auth", id => "httpauth", call => \&auth); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => 0, }, -} #}}} +} -sub auth ($$) { #{{{ +sub auth ($$) { my $cgi=shift; my $session=shift; if (defined $cgi->remote_user()) { $session->param("name", $cgi->remote_user()); } -} #}}} +} 1 diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm index 7b89ab673..395890c0e 100644 --- a/IkiWiki/Plugin/img.pm +++ b/IkiWiki/Plugin/img.pm @@ -9,20 +9,20 @@ use IkiWiki 2.00; my %imgdefaults; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "img", call => \&getsetup); hook(type => "preprocess", id => "img", call => \&preprocess, scan => 1); -} #}}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} -sub preprocess (@) { #{{{ +sub preprocess (@) { my ($image) = $_[0] =~ /$config{wiki_file_regexp}/; # untaint my %params=@_; @@ -149,6 +149,6 @@ sub preprocess (@) { #{{{ else { return $imgtag; } -} #}}} +} 1 diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index d6ef6c54c..d37db97ec 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -13,7 +13,7 @@ my %page_numfeeds; my @inline; my $nested=0; -sub import { #{{{ +sub import { hook(type => "getopt", id => "inline", call => \&getopt); hook(type => "getsetup", id => "inline", call => \&getsetup); hook(type => "checkconfig", id => "inline", call => \&checkconfig); @@ -27,9 +27,9 @@ sub import { #{{{ # This ensures each page only pings once and prevents slow # pings interrupting page builds. hook(type => "change", id => "inline", call => \&IkiWiki::pingurl); -} # }}} +} -sub getopt () { #{{{ +sub getopt () { eval q{use Getopt::Long}; error($@) if $@; Getopt::Long::Configure('pass_through'); @@ -42,9 +42,9 @@ sub getopt () { #{{{ push @{$config{pingurl}}, $_[1]; }, ); -} #}}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, @@ -85,9 +85,9 @@ sub getsetup () { #{{{ safe => 1, rebuild => 0, }, -} #}}} +} -sub checkconfig () { #{{{ +sub checkconfig () { if (($config{rss} || $config{atom}) && ! length $config{url}) { error(gettext("Must specify url to wiki with --url when using --rss or --atom")); } @@ -100,9 +100,9 @@ sub checkconfig () { #{{{ if (! exists $config{pingurl}) { $config{pingurl}=[]; } -} #}}} +} -sub format (@) { #{{{ +sub format (@) { my %params=@_; # Fill in the inline content generated earlier. This is actually an @@ -111,9 +111,9 @@ sub format (@) { #{{{ delete @inline[$1,] }eg; return $params{content}; -} #}}} +} -sub sessioncgi ($$) { #{{{ +sub sessioncgi ($$) { my $q=shift; my $session=shift; @@ -148,7 +148,7 @@ package IkiWiki; my %toping; my %feedlinks; -sub preprocess_inline (@) { #{{{ +sub preprocess_inline (@) { my %params=@_; if (! exists $params{pages}) { @@ -416,18 +416,18 @@ sub preprocess_inline (@) { #{{{ return $ret if $raw || $nested; push @inline, $ret; return "
\n\n"; -} #}}} +} -sub pagetemplate_inline (@) { #{{{ +sub pagetemplate_inline (@) { my %params=@_; my $page=$params{page}; my $template=$params{template}; $template->param(feedlinks => $feedlinks{$page}) if exists $feedlinks{$page} && $template->query(name => "feedlinks"); -} #}}} +} -sub get_inline_content ($$) { #{{{ +sub get_inline_content ($$) { my $page=shift; my $destpage=shift; @@ -446,9 +446,9 @@ sub get_inline_content ($$) { #{{{ else { return ""; } -} #}}} +} -sub date_822 ($) { #{{{ +sub date_822 ($) { my $time=shift; my $lc_time=POSIX::setlocale(&POSIX::LC_TIME); @@ -456,9 +456,9 @@ sub date_822 ($) { #{{{ my $ret=POSIX::strftime("%a, %d %b %Y %H:%M:%S %z", localtime($time)); POSIX::setlocale(&POSIX::LC_TIME, $lc_time); return $ret; -} #}}} +} -sub date_3339 ($) { #{{{ +sub date_3339 ($) { my $time=shift; my $lc_time=POSIX::setlocale(&POSIX::LC_TIME); @@ -466,9 +466,9 @@ sub date_3339 ($) { #{{{ my $ret=POSIX::strftime("%Y-%m-%dT%H:%M:%SZ", gmtime($time)); POSIX::setlocale(&POSIX::LC_TIME, $lc_time); return $ret; -} #}}} +} -sub absolute_urls ($$) { #{{{ +sub absolute_urls ($$) { # sucky sub because rss sucks my $content=shift; my $baseurl=shift; @@ -489,9 +489,9 @@ sub absolute_urls ($$) { #{{{ $content=~s/(output; -} #}}} +} -sub pingurl (@) { #{{{ +sub pingurl (@) { return unless @{$config{pingurl}} && %toping; eval q{require RPC::XML::Client}; @@ -624,6 +624,6 @@ sub pingurl (@) { #{{{ } exit 0; # daemon done -} #}}} +} 1 diff --git a/IkiWiki/Plugin/link.pm b/IkiWiki/Plugin/link.pm index 0638d4bdd..3799209d0 100644 --- a/IkiWiki/Plugin/link.pm +++ b/IkiWiki/Plugin/link.pm @@ -7,23 +7,23 @@ use IkiWiki 2.00; my $link_regexp; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "link", call => \&getsetup); hook(type => "checkconfig", id => "link", call => \&checkconfig); hook(type => "linkify", id => "link", call => \&linkify); hook(type => "scan", id => "link", call => \&scan); hook(type => "renamepage", id => "link", call => \&renamepage); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => 1, }, -} #}}} +} -sub checkconfig () { #{{{ +sub checkconfig () { if ($config{prefix_directives}) { $link_regexp = qr{ \[\[(?=[^!]) # beginning of link @@ -58,9 +58,9 @@ sub checkconfig () { #{{{ \]\] # end of link }x, } -} #}}} +} -sub linkify (@) { #{{{ +sub linkify (@) { my %params=@_; my $page=$params{page}; my $destpage=$params{destpage}; @@ -78,9 +78,9 @@ sub linkify (@) { #{{{ }eg; return $params{content}; -} #}}} +} -sub scan (@) { #{{{ +sub scan (@) { my %params=@_; my $page=$params{page}; my $content=$params{content}; @@ -88,9 +88,9 @@ sub scan (@) { #{{{ while ($content =~ /(? "getsetup", id => "linkmap", call => \&getsetup); hook(type => "preprocess", id => "linkmap", call => \&preprocess); hook(type => "format", id => "linkmap", call => \&format); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} my $mapnum=0; my %maps; -sub preprocess (@) { #{{{ +sub preprocess (@) { my %params=@_; $params{pages}="*" unless defined $params{pages}; @@ -39,17 +39,17 @@ sub preprocess (@) { #{{{ $mapnum++; $maps{$mapnum}=\%params; return "
"; -} # }}} +} -sub format (@) { #{{{ +sub format (@) { my %params=@_; $params{content}=~s/
<\/div>/genmap($1)/eg; return $params{content}; -} # }}} +} -sub genmap ($) { #{{{ +sub genmap ($) { my $mapnum=shift; return "" unless exists $maps{$mapnum}; my %params=%{$maps{$mapnum}}; @@ -106,6 +106,6 @@ sub genmap ($) { #{{{ error gettext("failed to run dot") if $sigpipe; return $ret; -} #}}} +} 1 diff --git a/IkiWiki/Plugin/listdirectives.pm b/IkiWiki/Plugin/listdirectives.pm index 2ab3e4665..be82b0495 100644 --- a/IkiWiki/Plugin/listdirectives.pm +++ b/IkiWiki/Plugin/listdirectives.pm @@ -6,15 +6,15 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { add_underlay("directives"); hook(type => "getsetup", id => "listdirectives", call => \&getsetup); hook(type => "checkconfig", id => "listdirectives", call => \&checkconfig); hook(type => "needsbuild", id => "listdirectives", call => \&needsbuild); hook(type => "preprocess", id => "listdirectives", call => \&preprocess); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, @@ -27,22 +27,22 @@ sub getsetup () { #{{{ safe => 1, rebuild => 1, }, -} #}}} +} my @fulllist; my @shortlist; my $pluginstring; -sub checkconfig () { #{{{ +sub checkconfig () { if (! defined $config{directive_description_dir}) { $config{directive_description_dir} = "ikiwiki/directive"; } else { $config{directive_description_dir} =~ s/\/+$//; } -} #}}} +} -sub needsbuild (@) { #{{{ +sub needsbuild (@) { my $needsbuild=shift; @fulllist = sort keys %{$IkiWiki::hooks{preprocess}}; @@ -63,9 +63,9 @@ sub needsbuild (@) { #{{{ } } } -} # }}} +} -sub preprocess (@) { #{{{ +sub preprocess (@) { my %params=@_; $pagestate{$params{destpage}}{listdirectives}{shown}=$pluginstring; @@ -92,6 +92,6 @@ sub preprocess (@) { #{{{ $result .= ""; return $result; -} # }}} +} 1 diff --git a/IkiWiki/Plugin/lockedit.pm b/IkiWiki/Plugin/lockedit.pm index f6cac6cdd..31a9e70cd 100644 --- a/IkiWiki/Plugin/lockedit.pm +++ b/IkiWiki/Plugin/lockedit.pm @@ -5,14 +5,14 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "lockedit", call => \&getsetup); hook(type => "canedit", id => "lockedit", call => \&canedit); hook(type => "formbuilder_setup", id => "lockedit", call => \&formbuilder_setup); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, @@ -26,9 +26,9 @@ sub getsetup () { #{{{ safe => 1, rebuild => 0, }, -} #}}} +} -sub canedit ($$) { #{{{ +sub canedit ($$) { my $page=shift; my $cgi=shift; my $session=shift; @@ -70,9 +70,9 @@ sub canedit ($$) { #{{{ } return undef; -} #}}} +} -sub formbuilder_setup (@) { #{{{ +sub formbuilder_setup (@) { my %params=@_; # XXX deprecated, should be removed eventually @@ -109,6 +109,6 @@ sub formbuilder_setup (@) { #{{{ } } } -} #}}} +} 1 diff --git a/IkiWiki/Plugin/map.pm b/IkiWiki/Plugin/map.pm index 18c584a30..af14ef5de 100644 --- a/IkiWiki/Plugin/map.pm +++ b/IkiWiki/Plugin/map.pm @@ -11,20 +11,20 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "map", call => \&getsetup); hook(type => "preprocess", id => "map", call => \&preprocess); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} -sub preprocess (@) { #{{{ +sub preprocess (@) { my %params=@_; $params{pages}="*" unless defined $params{pages}; @@ -144,6 +144,6 @@ sub preprocess (@) { #{{{ } $map .= "
\n"; return $map; -} # }}} +} 1 diff --git a/IkiWiki/Plugin/mdwn.pm b/IkiWiki/Plugin/mdwn.pm index 6c1d2ef3c..0d5f398a0 100644 --- a/IkiWiki/Plugin/mdwn.pm +++ b/IkiWiki/Plugin/mdwn.pm @@ -6,12 +6,12 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "mdwn", call => \&getsetup); hook(type => "htmlize", id => "mdwn", call => \&htmlize); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, @@ -24,10 +24,10 @@ sub getsetup () { #{{{ safe => 1, rebuild => 1, }, -} #}}} +} my $markdown_sub; -sub htmlize (@) { #{{{ +sub htmlize (@) { my %params=@_; my $content = $params{content}; @@ -83,6 +83,6 @@ sub htmlize (@) { #{{{ $content=Encode::decode_utf8($content); return $content; -} # }}} +} 1 diff --git a/IkiWiki/Plugin/mercurial.pm b/IkiWiki/Plugin/mercurial.pm index 7aceebcdb..82423286d 100644 --- a/IkiWiki/Plugin/mercurial.pm +++ b/IkiWiki/Plugin/mercurial.pm @@ -7,7 +7,7 @@ use IkiWiki; use Encode; use open qw{:utf8 :std}; -sub import { #{{{ +sub import { hook(type => "checkconfig", id => "mercurial", call => \&checkconfig); hook(type => "getsetup", id => "mercurial", call => \&getsetup); hook(type => "rcs", id => "rcs_update", call => \&rcs_update); @@ -20,18 +20,18 @@ sub import { #{{{ hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges); hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff); hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime); -} #}}} +} -sub checkconfig () { #{{{ +sub checkconfig () { if (exists $config{mercurial_wrapper} && length $config{mercurial_wrapper}) { push @{$config{wrappers}}, { wrapper => $config{mercurial_wrapper}, wrappermode => (defined $config{mercurial_wrappermode} ? $config{mercurial_wrappermode} : "06755"), }; } -} #}}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 0, # rcs plugin @@ -65,9 +65,9 @@ sub getsetup () { #{{{ safe => 1, rebuild => 1, }, -} #}}} +} -sub mercurial_log ($) { #{{{ +sub mercurial_log ($) { my $out = shift; my @infos; @@ -111,20 +111,20 @@ sub mercurial_log ($) { #{{{ close $out; return @infos; -} #}}} +} -sub rcs_update () { #{{{ +sub rcs_update () { my @cmdline = ("hg", "-q", "-R", "$config{srcdir}", "update"); if (system(@cmdline) != 0) { warn "'@cmdline' failed: $!"; } -} #}}} +} -sub rcs_prepedit ($) { #{{{ +sub rcs_prepedit ($) { return ""; -} #}}} +} -sub rcs_commit ($$$;$$) { #{{{ +sub rcs_commit ($$$;$$) { my ($file, $message, $rcstoken, $user, $ipaddr) = @_; if (defined $user) { @@ -149,7 +149,7 @@ sub rcs_commit ($$$;$$) { #{{{ } return undef; # success -} #}}} +} sub rcs_commit_staged ($$$) { # Commits all staged changes. Changes can be staged using rcs_add, @@ -159,28 +159,28 @@ sub rcs_commit_staged ($$$) { error("rcs_commit_staged not implemented for mercurial"); # TODO } -sub rcs_add ($) { # {{{ +sub rcs_add ($) { my ($file) = @_; my @cmdline = ("hg", "-q", "-R", "$config{srcdir}", "add", "$config{srcdir}/$file"); if (system(@cmdline) != 0) { warn "'@cmdline' failed: $!"; } -} #}}} +} -sub rcs_remove ($) { # {{{ +sub rcs_remove ($) { my ($file) = @_; error("rcs_remove not implemented for mercurial"); # TODO -} #}}} +} -sub rcs_rename ($$) { # {{{ +sub rcs_rename ($$) { my ($src, $dest) = @_; error("rcs_rename not implemented for mercurial"); # TODO -} #}}} +} -sub rcs_recentchanges ($) { #{{{ +sub rcs_recentchanges ($) { my ($num) = @_; my @cmdline = ("hg", "-R", $config{srcdir}, "log", "-v", "-l", $num, @@ -225,13 +225,13 @@ sub rcs_recentchanges ($) { #{{{ } return @ret; -} #}}} +} -sub rcs_diff ($) { #{{{ +sub rcs_diff ($) { # TODO -} #}}} +} -sub rcs_getctime ($) { #{{{ +sub rcs_getctime ($) { my ($file) = @_; # XXX filename passes through the shell here, should try to avoid @@ -251,6 +251,6 @@ sub rcs_getctime ($) { #{{{ my $ctime = str2time($log[0]->{"date"}); return $ctime; -} #}}} +} 1 diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm index 3991797c0..ea60be507 100644 --- a/IkiWiki/Plugin/meta.pm +++ b/IkiWiki/Plugin/meta.pm @@ -8,22 +8,22 @@ use IkiWiki 2.00; my %metaheaders; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "meta", call => \&getsetup); hook(type => "needsbuild", id => "meta", call => \&needsbuild); hook(type => "preprocess", id => "meta", call => \&preprocess, scan => 1); hook(type => "pagetemplate", id => "meta", call => \&pagetemplate); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} -sub needsbuild (@) { #{{{ +sub needsbuild (@) { my $needsbuild=shift; foreach my $page (keys %pagestate) { if (exists $pagestate{$page}{meta}) { @@ -38,7 +38,7 @@ sub needsbuild (@) { #{{{ } } -sub scrub ($$) { #{{{ +sub scrub ($$) { if (IkiWiki::Plugin::htmlscrubber->can("sanitize")) { return IkiWiki::Plugin::htmlscrubber::sanitize( content => shift, destpage => shift); @@ -46,9 +46,9 @@ sub scrub ($$) { #{{{ else { return shift; } -} #}}} +} -sub safeurl ($) { #{{{ +sub safeurl ($) { my $url=shift; if (exists $IkiWiki::Plugin::htmlscrubber::{safe_url_regexp} && defined $IkiWiki::Plugin::htmlscrubber::safe_url_regexp) { @@ -57,9 +57,9 @@ sub safeurl ($) { #{{{ else { return 1; } -} #}}} +} -sub htmlize ($$$) { #{{{ +sub htmlize ($$$) { my $page = shift; my $destpage = shift; @@ -68,7 +68,7 @@ sub htmlize ($$$) { #{{{ IkiWiki::preprocess($page, $destpage, shift))); } -sub preprocess (@) { #{{{ +sub preprocess (@) { return "" unless @_; my %params=@_; my $key=shift; @@ -230,9 +230,9 @@ sub preprocess (@) { #{{{ } return ""; -} # }}} +} -sub pagetemplate (@) { #{{{ +sub pagetemplate (@) { my %params=@_; my $page=$params{page}; my $destpage=$params{destpage}; @@ -260,9 +260,9 @@ sub pagetemplate (@) { #{{{ $template->param($field => htmlize($page, $destpage, $pagestate{$page}{meta}{$field})); } } -} # }}} +} -sub match { #{{{ +sub match { my $field=shift; my $page=shift; @@ -288,28 +288,28 @@ sub match { #{{{ else { return IkiWiki::FailReason->new("$page does not have a $field"); } -} #}}} +} package IkiWiki::PageSpec; -sub match_title ($$;@) { #{{{ +sub match_title ($$;@) { IkiWiki::Plugin::meta::match("title", @_); -} #}}} +} -sub match_author ($$;@) { #{{{ +sub match_author ($$;@) { IkiWiki::Plugin::meta::match("author", @_); -} #}}} +} -sub match_authorurl ($$;@) { #{{{ +sub match_authorurl ($$;@) { IkiWiki::Plugin::meta::match("authorurl", @_); -} #}}} +} -sub match_license ($$;@) { #{{{ +sub match_license ($$;@) { IkiWiki::Plugin::meta::match("license", @_); -} #}}} +} -sub match_copyright ($$;@) { #{{{ +sub match_copyright ($$;@) { IkiWiki::Plugin::meta::match("copyright", @_); -} #}}} +} 1 diff --git a/IkiWiki/Plugin/mirrorlist.pm b/IkiWiki/Plugin/mirrorlist.pm index aab60c435..b726386f6 100644 --- a/IkiWiki/Plugin/mirrorlist.pm +++ b/IkiWiki/Plugin/mirrorlist.pm @@ -5,12 +5,12 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "mirrorlist", call => \&getsetup); hook(type => "pagetemplate", id => "mirrorlist", call => \&pagetemplate); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, @@ -23,9 +23,9 @@ sub getsetup () { #{{{ safe => 1, rebuild => 1, }, -} #}}} +} -sub pagetemplate (@) { #{{{ +sub pagetemplate (@) { my %params=@_; my $template=$params{template}; @@ -34,9 +34,9 @@ sub pagetemplate (@) { #{{{ $value.=mirrorlist($params{page}); $template->param(extrafooter => $value); } -} # }}} +} -sub mirrorlist ($) { #{{{ +sub mirrorlist ($) { my $page=shift; return "

". (keys %{$config{mirrorlist}} > 1 ? gettext("Mirrors") : gettext("Mirror")). @@ -49,6 +49,6 @@ sub mirrorlist ($) { #{{{ } keys %{$config{mirrorlist}} ). "

"; -} # }}} +} 1 diff --git a/IkiWiki/Plugin/monotone.pm b/IkiWiki/Plugin/monotone.pm index 3a8b267a3..38abb9a07 100644 --- a/IkiWiki/Plugin/monotone.pm +++ b/IkiWiki/Plugin/monotone.pm @@ -10,7 +10,7 @@ use Date::Format qw(time2str); my $sha1_pattern = qr/[0-9a-fA-F]{40}/; # pattern to validate sha1sums -sub import { #{{{ +sub import { hook(type => "checkconfig", id => "monotone", call => \&checkconfig); hook(type => "getsetup", id => "monotone", call => \&getsetup); hook(type => "rcs", id => "rcs_update", call => \&rcs_update); @@ -23,9 +23,9 @@ sub import { #{{{ hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges); hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff); hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime); -} #}}} +} -sub checkconfig () { #{{{ +sub checkconfig () { if (!defined($config{mtnrootdir})) { $config{mtnrootdir} = $config{srcdir}; } @@ -61,9 +61,9 @@ sub checkconfig () { #{{{ wrappermode => (defined $config{mtn_wrappermode} ? $config{mtn_wrappermode} : "06755"), }; } -} #}}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 0, # rcs plugin @@ -117,9 +117,9 @@ sub getsetup () { #{{{ safe => 0, # path rebuild => 0, }, -} #}}} +} -sub get_rev () { #{{{ +sub get_rev () { my $sha1 = `mtn --root=$config{mtnrootdir} automate get_base_revision_id`; ($sha1) = $sha1 =~ m/($sha1_pattern)/; # sha1 is untainted now @@ -128,9 +128,9 @@ sub get_rev () { #{{{ } return $sha1; -} #}}} +} -sub get_rev_auto ($) { #{{{ +sub get_rev_auto ($) { my $automator=shift; my @results = $automator->call("get_base_revision_id"); @@ -142,9 +142,9 @@ sub get_rev_auto ($) { #{{{ } return $sha1; -} #}}} +} -sub mtn_merge ($$$$) { #{{{ +sub mtn_merge ($$$$) { my $leftRev=shift; my $rightRev=shift; my $branch=shift; @@ -172,9 +172,9 @@ sub mtn_merge ($$$$) { #{{{ debug("merged $leftRev, $rightRev to make $mergeRev"); return $mergeRev; -} #}}} +} -sub commit_file_to_new_rev ($$$$$$$$) { #{{{ +sub commit_file_to_new_rev ($$$$$$$$) { my $automator=shift; my $wsfilename=shift; my $oldFileID=shift; @@ -219,9 +219,9 @@ sub commit_file_to_new_rev ($$$$$$$$) { #{{{ debug("Added certs for rev: $newRevID"); return $newRevID; -} #}}} +} -sub read_certs ($$) { #{{{ +sub read_certs ($$) { my $automator=shift; my $rev=shift; my @results = $automator->call("certs", $rev); @@ -239,9 +239,9 @@ sub read_certs ($$) { #{{{ } return @ret; -} #}}} +} -sub get_changed_files ($$) { #{{{ +sub get_changed_files ($$) { my $automator=shift; my $rev=shift; @@ -261,9 +261,9 @@ sub get_changed_files ($$) { #{{{ } return @ret; -} #}}} +} -sub rcs_update () { #{{{ +sub rcs_update () { chdir $config{srcdir} or error("Cannot chdir to $config{srcdir}: $!"); @@ -278,9 +278,9 @@ sub rcs_update () { #{{{ if (system("mtn", "--root=$config{mtnrootdir}", "update", "--quiet") != 0) { debug("monotone update failed"); } -} #}}} +} -sub rcs_prepedit ($) { #{{{ +sub rcs_prepedit ($) { my $file=shift; chdir $config{srcdir} @@ -289,9 +289,9 @@ sub rcs_prepedit ($) { #{{{ # For monotone, return the revision of the file when # editing begins. return get_rev(); -} #}}} +} -sub rcs_commit ($$$;$$) { #{{{ +sub rcs_commit ($$$;$$) { # Tries to commit the page; returns undef on _success_ and # a version of the page with the rcs's conflict markers on failure. # The file is relative to the srcdir. @@ -434,7 +434,7 @@ sub rcs_commit ($$$;$$) { #{{{ } return undef # success -} #}}} +} sub rcs_commit_staged ($$$) { # Commits all staged changes. Changes can be staged using rcs_add, @@ -466,7 +466,7 @@ sub rcs_commit_staged ($$$) { } } -sub rcs_add ($) { #{{{ +sub rcs_add ($) { my $file=shift; chdir $config{srcdir} @@ -476,9 +476,9 @@ sub rcs_add ($) { #{{{ $file) != 0) { error("Monotone add failed"); } -} #}}} +} -sub rcs_remove ($) { # {{{ +sub rcs_remove ($) { my $file = shift; chdir $config{srcdir} @@ -495,9 +495,9 @@ sub rcs_remove ($) { # {{{ $file) != 0) { error("Monotone remove failed"); } -} #}}} +} -sub rcs_rename ($$) { # {{{ +sub rcs_rename ($$) { my ($src, $dest) = @_; chdir $config{srcdir} @@ -507,9 +507,9 @@ sub rcs_rename ($$) { # {{{ $src, $dest) != 0) { error("Monotone rename failed"); } -} #}}} +} -sub rcs_recentchanges ($) { #{{{ +sub rcs_recentchanges ($) { my $num=shift; my @ret; @@ -614,9 +614,9 @@ sub rcs_recentchanges ($) { #{{{ $automator->close(); return @ret; -} #}}} +} -sub rcs_diff ($) { #{{{ +sub rcs_diff ($) { my $rev=shift; my ($sha1) = $rev =~ /^($sha1_pattern)$/; # untaint @@ -638,9 +638,9 @@ sub rcs_diff ($) { #{{{ else { return join("", @lines); } -} #}}} +} -sub rcs_getctime ($) { #{{{ +sub rcs_getctime ($) { my $file=shift; chdir $config{srcdir} @@ -690,6 +690,6 @@ sub rcs_getctime ($) { #{{{ $date=str2time($date, 'UTC'); debug("found ctime ".localtime($date)." for $file"); return $date; -} #}}} +} 1 diff --git a/IkiWiki/Plugin/more.pm b/IkiWiki/Plugin/more.pm index 4484441c3..f1216ad3d 100644 --- a/IkiWiki/Plugin/more.pm +++ b/IkiWiki/Plugin/more.pm @@ -7,20 +7,20 @@ use IkiWiki 2.00; my $linktext = gettext("more"); -sub import { #{{{ +sub import { hook(type => "getsetup", id => "more", call => \&getsetup); hook(type => "preprocess", id => "more", call => \&preprocess); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} -sub preprocess (@) { #{{{ +sub preprocess (@) { my %params=@_; $params{linktext} = $linktext unless defined $params{linktext}; diff --git a/IkiWiki/Plugin/norcs.pm b/IkiWiki/Plugin/norcs.pm index 58c26b633..bfe84c0e1 100644 --- a/IkiWiki/Plugin/norcs.pm +++ b/IkiWiki/Plugin/norcs.pm @@ -6,7 +6,7 @@ use warnings; use strict; use IkiWiki; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "norcs", call => \&getsetup); hook(type => "rcs", id => "rcs_update", call => \&rcs_update); hook(type => "rcs", id => "rcs_prepedit", call => \&rcs_prepedit); @@ -18,51 +18,51 @@ sub import { #{{{ hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges); hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff); hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime); -} #}}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 0, # rcs plugin rebuild => 0, }, -} #}}} +} -sub rcs_update () { #{{{ -} #}}} +sub rcs_update () { +} -sub rcs_prepedit ($) { #{{{ +sub rcs_prepedit ($) { return "" -} #}}} +} -sub rcs_commit ($$$;$$) { #{{{ +sub rcs_commit ($$$;$$) { my ($file, $message, $rcstoken, $user, $ipaddr) = @_; return undef # success -} #}}} +} -sub rcs_commit_staged ($$$) { #{{{ +sub rcs_commit_staged ($$$) { my ($message, $user, $ipaddr)=@_; return undef # success -} #}}} +} -sub rcs_add ($) { #{{{ -} #}}} +sub rcs_add ($) { +} -sub rcs_remove ($) { #{{{ -} #}}} +sub rcs_remove ($) { +} -sub rcs_rename ($$) { #{{{ -} #}}} +sub rcs_rename ($$) { +} -sub rcs_recentchanges ($) { #{{{ -} #}}} +sub rcs_recentchanges ($) { +} -sub rcs_diff ($) { #{{{ -} #}}} +sub rcs_diff ($) { +} -sub rcs_getctime ($) { #{{{ +sub rcs_getctime ($) { error gettext("getctime not implemented"); -} #}}} +} 1 diff --git a/IkiWiki/Plugin/opendiscussion.pm b/IkiWiki/Plugin/opendiscussion.pm index 96a74aee8..95220d7b3 100644 --- a/IkiWiki/Plugin/opendiscussion.pm +++ b/IkiWiki/Plugin/opendiscussion.pm @@ -5,20 +5,20 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "opendiscussion", call => \&getsetup); hook(type => "canedit", id => "opendiscussion", call => \&canedit); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => 0, }, -} #}}} +} -sub canedit ($$) { #{{{ +sub canedit ($$) { my $page=shift; my $cgi=shift; my $session=shift; @@ -26,6 +26,6 @@ sub canedit ($$) { #{{{ my $discussion=gettext("discussion"); return "" if $page=~/(\/|^)\Q$discussion\E$/; return undef; -} #}}} +} 1 diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index f12cbdaa3..2933c9ed9 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -6,22 +6,22 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getopt", id => "openid", call => \&getopt); hook(type => "getsetup", id => "openid", call => \&getsetup); hook(type => "auth", id => "openid", call => \&auth); hook(type => "formbuilder_setup", id => "openid", call => \&formbuilder_setup, last => 1); -} # }}} +} -sub getopt () { #{{{ +sub getopt () { eval q{use Getopt::Long}; error($@) if $@; Getopt::Long::Configure('pass_through'); GetOptions("openidsignup=s" => \$config{openidsignup}); -} #}}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, @@ -34,9 +34,9 @@ sub getsetup () { #{{{ safe => 1, rebuild => 0, }, -} #}}} +} -sub formbuilder_setup (@) { #{{{ +sub formbuilder_setup (@) { my %params=@_; my $form=$params{form}; @@ -92,7 +92,7 @@ sub formbuilder_setup (@) { #{{{ } } -sub validate ($$$;$) { #{{{ +sub validate ($$$;$) { my $q=shift; my $session=shift; my $openid_url=shift; @@ -121,9 +121,9 @@ sub validate ($$$;$) { #{{{ # eventually bounce them back to auth() IkiWiki::redirect($q, $check_url); exit 0; -} #}}} +} -sub auth ($$) { #{{{ +sub auth ($$) { my $q=shift; my $session=shift; @@ -147,9 +147,9 @@ sub auth ($$) { #{{{ # myopenid.com affiliate support validate($q, $session, $q->param('openid_identifier')); } -} #}}} +} -sub getobj ($$) { #{{{ +sub getobj ($$) { my $q=shift; my $session=shift; @@ -178,13 +178,13 @@ sub getobj ($$) { #{{{ consumer_secret => sub { return shift()+$secret }, required_root => $config{cgiurl}, ); -} #}}} +} package IkiWiki; # This is not used by this plugin, but this seems the best place to put it. # Used elsewhere to pretty-display the name of an openid user. -sub openiduser ($) { #{{{ +sub openiduser ($) { my $user=shift; if ($user =~ m!^https?://! && diff --git a/IkiWiki/Plugin/orphans.pm b/IkiWiki/Plugin/orphans.pm index 32cbc5dd5..8e9ab0ff4 100644 --- a/IkiWiki/Plugin/orphans.pm +++ b/IkiWiki/Plugin/orphans.pm @@ -6,20 +6,20 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "orphans", call => \&getsetup); hook(type => "preprocess", id => "orphans", call => \&preprocess); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} -sub preprocess (@) { #{{{ +sub preprocess (@) { my %params=@_; $params{pages}="*" unless defined $params{pages}; @@ -58,6 +58,6 @@ sub preprocess (@) { #{{{ "" } sort @orphans). "\n"; -} # }}} +} 1 diff --git a/IkiWiki/Plugin/otl.pm b/IkiWiki/Plugin/otl.pm index ef76d6215..280b19db0 100644 --- a/IkiWiki/Plugin/otl.pm +++ b/IkiWiki/Plugin/otl.pm @@ -7,22 +7,22 @@ use strict; use IkiWiki 2.00; use open qw{:utf8 :std}; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "otl", call => \&getsetup); hook(type => "filter", id => "otl", call => \&filter); hook(type => "htmlize", id => "otl", call => \&htmlize); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => 1, # format plugin }, -} #}}} +} -sub filter (@) { #{{{ +sub filter (@) { my %params=@_; # Munge up check boxes to look a little bit better. This is a hack. @@ -34,9 +34,9 @@ sub filter (@) { #{{{ $params{content}=~s/^(\s*)\[_\]\s/${1}$unchecked /mg; return $params{content}; -} # }}} +} -sub htmlize (@) { #{{{ +sub htmlize (@) { my %params=@_; # Can't use open2 since otl2html doesn't play nice with buffering. @@ -95,6 +95,6 @@ sub htmlize (@) { #{{{ $ret=~s/.*//s; $ret=~s/ EODIV -} # }}} +} -sub format(@) { #{{{ +sub format(@) { my %params = @_; # If HTMLScrubber has removed the style attribute, then bring it back @@ -74,6 +74,6 @@ sub format(@) { #{{{ $params{content} =~ s!
($percentage_pattern)
!
$1
!g; return $params{content}; -} #}}} +} 1 diff --git a/IkiWiki/Plugin/rawhtml.pm b/IkiWiki/Plugin/rawhtml.pm index 74ca13f3b..73093439d 100644 --- a/IkiWiki/Plugin/rawhtml.pm +++ b/IkiWiki/Plugin/rawhtml.pm @@ -6,17 +6,17 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "rawhtml", call => \&getsetup); $config{wiki_file_prune_regexps} = [ grep { !m/\\\.x\?html\?\$/ } @{$config{wiki_file_prune_regexps}} ]; -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => 1, # changes file types }, -} #}}} +} 1 diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm index 4d7023c1c..12577e9ef 100644 --- a/IkiWiki/Plugin/recentchanges.pm +++ b/IkiWiki/Plugin/recentchanges.pm @@ -7,16 +7,16 @@ use IkiWiki 2.00; use Encode; use HTML::Entities; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "recentchanges", call => \&getsetup); hook(type => "checkconfig", id => "recentchanges", call => \&checkconfig); hook(type => "refresh", id => "recentchanges", call => \&refresh); hook(type => "pagetemplate", id => "recentchanges", call => \&pagetemplate); hook(type => "htmlize", id => "_change", call => \&htmlize); hook(type => "cgi", id => "recentchanges", call => \&cgi); -} #}}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, @@ -36,14 +36,14 @@ sub getsetup () { #{{{ safe => 1, rebuild => 0, }, -} #}}} +} -sub checkconfig () { #{{{ +sub checkconfig () { $config{recentchangespage}='recentchanges' unless defined $config{recentchangespage}; $config{recentchangesnum}=100 unless defined $config{recentchangesnum}; -} #}}} +} -sub refresh ($) { #{{{ +sub refresh ($) { my %seen; # add new changes @@ -57,10 +57,10 @@ sub refresh ($) { #{{{ unlink($config{srcdir}.'/'.$pagesources{$page}); } } -} #}}} +} # Enable the recentchanges link on wiki pages. -sub pagetemplate (@) { #{{{ +sub pagetemplate (@) { my %params=@_; my $template=$params{template}; my $page=$params{page}; @@ -71,15 +71,15 @@ sub pagetemplate (@) { #{{{ $template->param(recentchangesurl => urlto($config{recentchangespage}, $page)); $template->param(have_actions => 1); } -} #}}} +} # Pages with extension _change have plain html markup, pass through. -sub htmlize (@) { #{{{ +sub htmlize (@) { my %params=@_; return $params{content}; -} #}}} +} -sub cgi ($) { #{{{ +sub cgi ($) { my $cgi=shift; if (defined $cgi->param('do') && $cgi->param('do') eq "recentchanges_link") { # This is a link from a change page to some @@ -112,7 +112,7 @@ sub cgi ($) { #{{{ } } -sub store ($$$) { #{{{ +sub store ($$$) { my $change=shift; my $page="$config{recentchangespage}/change_".titlepage($change->{rev}); @@ -192,6 +192,6 @@ sub store ($$$) { #{{{ utime $change->{when}, $change->{when}, "$config{srcdir}/$file"; return $page; -} #}}} +} 1 diff --git a/IkiWiki/Plugin/recentchangesdiff.pm b/IkiWiki/Plugin/recentchangesdiff.pm index 08cec3f5a..4dea9c26b 100644 --- a/IkiWiki/Plugin/recentchangesdiff.pm +++ b/IkiWiki/Plugin/recentchangesdiff.pm @@ -8,22 +8,22 @@ use HTML::Entities; my $maxlines=200; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "recentchangesdiff", call => \&getsetup); hook(type => "pagetemplate", id => "recentchangesdiff", call => \&pagetemplate); -} #}}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => 1, }, -} #}}} +} -sub pagetemplate (@) { #{{{ +sub pagetemplate (@) { my %params=@_; my $template=$params{template}; if ($config{rcs} && exists $params{rev} && length $params{rev} && @@ -46,6 +46,6 @@ sub pagetemplate (@) { #{{{ $template->param(diff => $diff); } } -} #}}} +} 1 diff --git a/IkiWiki/Plugin/relativedate.pm b/IkiWiki/Plugin/relativedate.pm index dc8f7d538..e5fa8e1a5 100644 --- a/IkiWiki/Plugin/relativedate.pm +++ b/IkiWiki/Plugin/relativedate.pm @@ -8,22 +8,22 @@ use IkiWiki 2.00; use POSIX; use Encode; -sub import { #{{{ +sub import { add_underlay("javascript"); hook(type => "getsetup", id => "relativedate", call => \&getsetup); hook(type => "format", id => "relativedate", call => \&format); inject(name => "IkiWiki::displaytime", call => \&mydisplaytime); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => 1, }, -} #}}} +} -sub format (@) { #{{{ +sub format (@) { my %params=@_; if (! ($params{content}=~s!^()!$1.include_javascript($params{page})!em)) { @@ -31,9 +31,9 @@ sub format (@) { #{{{ $params{content}=include_javascript($params{page}, 1).$params{content}; } return $params{content}; -} # }}} +} -sub include_javascript ($;$) { #{{{ +sub include_javascript ($;$) { my $page=shift; my $absolute=shift; @@ -41,9 +41,9 @@ sub include_javascript ($;$) { #{{{ '" type="text/javascript" charset="utf-8">'."\n". ''; -} #}}} +} -sub mydisplaytime ($;$) { #{{{ +sub mydisplaytime ($;$) { my $time=shift; my $format=shift; @@ -55,6 +55,6 @@ sub mydisplaytime ($;$) { #{{{ return ''. IkiWiki::formattime($time, $format).''; -} #}}} +} 1 diff --git a/IkiWiki/Plugin/remove.pm b/IkiWiki/Plugin/remove.pm index c512b3b97..781501662 100644 --- a/IkiWiki/Plugin/remove.pm +++ b/IkiWiki/Plugin/remove.pm @@ -5,23 +5,23 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "remove", call => \&getsetup); hook(type => "formbuilder_setup", id => "remove", call => \&formbuilder_setup); hook(type => "formbuilder", id => "remove", call => \&formbuilder); hook(type => "sessioncgi", id => "remove", call => \&sessioncgi); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => 0, }, -} #}}} +} -sub check_canremove ($$$) { #{{{ +sub check_canremove ($$$) { my $page=shift; my $q=shift; my $session=shift; @@ -54,9 +54,9 @@ sub check_canremove ($$$) { #{{{ error("renaming of attachments is not allowed"); } } -} #}}} +} -sub formbuilder_setup (@) { #{{{ +sub formbuilder_setup (@) { my %params=@_; my $form=$params{form}; my $q=$params{cgi}; @@ -67,9 +67,9 @@ sub formbuilder_setup (@) { #{{{ push @{$params{buttons}}, "Remove" if $form->field("do") eq "edit"; $form->tmpl_param("field-remove" => ''); } -} #}}} +} -sub confirmation_form ($$) { #{{{ +sub confirmation_form ($$) { my $q=shift; my $session=shift; @@ -90,9 +90,9 @@ sub confirmation_form ($$) { #{{{ $f->field(name => "do", type => "hidden", value => "remove", force => 1); return $f, ["Remove", "Cancel"]; -} #}}} +} -sub removal_confirm ($$@) { #{{{ +sub removal_confirm ($$@) { my $q=shift; my $session=shift; my $attachment=shift; @@ -122,9 +122,9 @@ sub removal_confirm ($$@) { #{{{ IkiWiki::showform($f, $buttons, $session, $q); exit 0; -} #}}} +} -sub postremove ($) { #{{{ +sub postremove ($) { my $session=shift; # Load saved form state and return to edit form. @@ -132,9 +132,9 @@ sub postremove ($) { #{{{ $session->clear("postremove"); IkiWiki::cgi_savesession($session); IkiWiki::cgi($postremove, $session); -} #}}} +} -sub formbuilder (@) { #{{{ +sub formbuilder (@) { my %params=@_; my $form=$params{form}; @@ -154,9 +154,9 @@ sub formbuilder (@) { #{{{ removal_confirm($q, $session, 1, @selected); } } -} #}}} +} -sub sessioncgi ($$) { #{{{ +sub sessioncgi ($$) { my $q=shift; if ($q->param("do") eq 'remove') { diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm index e4201cc94..b1bb15767 100644 --- a/IkiWiki/Plugin/rename.pm +++ b/IkiWiki/Plugin/rename.pm @@ -5,23 +5,23 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "rename", call => \&getsetup); hook(type => "formbuilder_setup", id => "rename", call => \&formbuilder_setup); hook(type => "formbuilder", id => "rename", call => \&formbuilder); hook(type => "sessioncgi", id => "rename", call => \&sessioncgi); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => 0, }, -} #}}} +} -sub check_canrename ($$$$$$) { #{{{ +sub check_canrename ($$$$$$) { my $src=shift; my $srcfile=shift; my $dest=shift; @@ -87,9 +87,9 @@ sub check_canrename ($$$$$$) { #{{{ IkiWiki::Plugin::attachment::check_canattach($session, $dest, $srcfile); } } -} #}}} +} -sub rename_form ($$$) { #{{{ +sub rename_form ($$$) { my $q=shift; my $session=shift; my $page=shift; @@ -145,9 +145,9 @@ sub rename_form ($$$) { #{{{ $f->field(name => "attachment", type => "hidden"); return $f, ["Rename", "Cancel"]; -} #}}} +} -sub rename_start ($$$$) { #{{{ +sub rename_start ($$$$) { my $q=shift; my $session=shift; my $attachment=shift; @@ -171,9 +171,9 @@ sub rename_start ($$$$) { #{{{ my ($f, $buttons)=rename_form($q, $session, $page); IkiWiki::showform($f, $buttons, $session, $q); exit 0; -} #}}} +} -sub postrename ($;$$$) { #{{{ +sub postrename ($;$$$) { my $session=shift; my $src=shift; my $dest=shift; @@ -204,9 +204,9 @@ sub postrename ($;$$$) { #{{{ } IkiWiki::cgi_editpage($postrename, $session); -} #}}} +} -sub formbuilder (@) { #{{{ +sub formbuilder (@) { my %params=@_; my $form=$params{form}; @@ -229,11 +229,11 @@ sub formbuilder (@) { #{{{ rename_start($q, $session, 1, $selected[0]); } } -} #}}} +} my $renamesummary; -sub formbuilder_setup (@) { #{{{ +sub formbuilder_setup (@) { my %params=@_; my $form=$params{form}; my $q=$params{cgi}; @@ -248,9 +248,9 @@ sub formbuilder_setup (@) { #{{{ $form->tmpl_param(message => $renamesummary); } } -} #}}} +} -sub sessioncgi ($$) { #{{{ +sub sessioncgi ($$) { my $q=shift; if ($q->param("do") eq 'rename') { @@ -418,9 +418,9 @@ sub sessioncgi ($$) { #{{{ exit 0; } -} #}}} +} -sub renamepage_hook ($$$$) { #{{{ +sub renamepage_hook ($$$$) { my ($page, $src, $dest, $content)=@_; IkiWiki::run_hooks(renamepage => sub { @@ -433,9 +433,9 @@ sub renamepage_hook ($$$$) { #{{{ }); return $content; -}# }}} +} -sub do_rename ($$$) { #{{{ +sub do_rename ($$$) { my $rename=shift; my $q=shift; my $session=shift; @@ -460,9 +460,9 @@ sub do_rename ($$$) { #{{{ } } -} # }}} +} -sub fixlinks ($$$) { #{{{ +sub fixlinks ($$$) { my $rename=shift; my $session=shift; @@ -498,6 +498,6 @@ sub fixlinks ($$$) { #{{{ } return @fixedlinks; -} #}}} +} 1 diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm index e40f4888c..cc2130ad5 100644 --- a/IkiWiki/Plugin/search.pm +++ b/IkiWiki/Plugin/search.pm @@ -6,16 +6,16 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "search", call => \&getsetup); hook(type => "checkconfig", id => "search", call => \&checkconfig); hook(type => "pagetemplate", id => "search", call => \&pagetemplate); hook(type => "postscan", id => "search", call => \&index); hook(type => "delete", id => "search", call => \&delete); hook(type => "cgi", id => "search", call => \&cgi); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, @@ -28,9 +28,9 @@ sub getsetup () { #{{{ safe => 0, # external program rebuild => 0, }, -} #}}} +} -sub checkconfig () { #{{{ +sub checkconfig () { foreach my $required (qw(url cgiurl)) { if (! length $config{$required}) { error(sprintf(gettext("Must specify %s when using the search plugin"), $required)); @@ -40,10 +40,10 @@ sub checkconfig () { #{{{ if (! defined $config{omega_cgi}) { $config{omega_cgi}="/usr/lib/cgi-bin/omega/omega"; } -} #}}} +} my $form; -sub pagetemplate (@) { #{{{ +sub pagetemplate (@) { my %params=@_; my $page=$params{page}; my $template=$params{template}; @@ -58,11 +58,11 @@ sub pagetemplate (@) { #{{{ $template->param(searchform => $form); } -} #}}} +} my $scrubber; my $stemmer; -sub index (@) { #{{{ +sub index (@) { my %params=@_; setupfiles(); @@ -146,17 +146,17 @@ sub index (@) { #{{{ $doc->add_term($pageterm); $db->replace_document_by_term($pageterm, $doc); -} #}}} +} -sub delete (@) { #{{{ +sub delete (@) { my $db=xapiandb(); foreach my $page (@_) { my $pageterm=pageterm(pagename($page)); $db->delete_document_by_term($pageterm) if defined $pageterm; } -} #}}} +} -sub cgi ($) { #{{{ +sub cgi ($) { my $cgi=shift; if (defined $cgi->param('P')) { @@ -169,9 +169,9 @@ sub cgi ($) { #{{{ noimageinline => 1, linktext => "Help"); exec($config{omega_cgi}) || error("$config{omega_cgi} failed: $!"); } -} #}}} +} -sub pageterm ($) { #{{{ +sub pageterm ($) { my $page=shift; # 240 is the number used by omindex to decide when to hash an @@ -190,10 +190,10 @@ sub pageterm ($) { #{{{ else { return "U:".$page; } -} #}}} +} my $db; -sub xapiandb () { #{{{ +sub xapiandb () { if (! defined $db) { eval q{ use Search::Xapian; @@ -204,11 +204,11 @@ sub xapiandb () { #{{{ Search::Xapian::DB_CREATE_OR_OPEN()); } return $db; -} #}}} +} { my $setup=0; -sub setupfiles () { #{{{ +sub setupfiles () { if (! $setup and (! -e $config{wikistatedir}."/xapian" || $config{rebuild})) { writefile("omega.conf", $config{wikistatedir}."/xapian", "database_dir .\n". @@ -218,7 +218,7 @@ sub setupfiles () { #{{{ readfile(IkiWiki::template_file("searchquery.tmpl")))); $setup=1; } -} #}}} +} } 1 diff --git a/IkiWiki/Plugin/shortcut.pm b/IkiWiki/Plugin/shortcut.pm index dec8afdb5..33d158d3e 100644 --- a/IkiWiki/Plugin/shortcut.pm +++ b/IkiWiki/Plugin/shortcut.pm @@ -5,21 +5,21 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "shortcut", call => \&getsetup); hook(type => "checkconfig", id => "shortcut", call => \&checkconfig); hook(type => "preprocess", id => "shortcut", call => \&preprocess_shortcut); -} #}}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} -sub checkconfig () { #{{{ +sub checkconfig () { if (defined $config{srcdir}) { # Preprocess the shortcuts page to get all the available shortcuts # defined before other pages are rendered. @@ -29,9 +29,9 @@ sub checkconfig () { #{{{ } IkiWiki::preprocess("shortcuts", "shortcuts", readfile($srcfile)); } -} # }}} +} -sub preprocess_shortcut (@) { #{{{ +sub preprocess_shortcut (@) { my %params=@_; if (! defined $params{name} || ! defined $params{url}) { @@ -46,9 +46,9 @@ sub preprocess_shortcut (@) { #{{{ #translators: First parameter is the name of the shortcut, the second #translators: is an URL. return sprintf(gettext("shortcut %s points to %s"), $params{name}, $params{url}); -} # }}} +} -sub shortcut_expand ($$@) { #{{{ +sub shortcut_expand ($$@) { my $url=shift; my $desc=shift; my %params=@_; @@ -85,6 +85,6 @@ sub shortcut_expand ($$@) { #{{{ } return "$desc"; -} #}}} +} 1 diff --git a/IkiWiki/Plugin/sidebar.pm b/IkiWiki/Plugin/sidebar.pm index 9697e1198..746fa93bb 100644 --- a/IkiWiki/Plugin/sidebar.pm +++ b/IkiWiki/Plugin/sidebar.pm @@ -8,20 +8,20 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "sidebar", call => \&getsetup); hook(type => "pagetemplate", id => "sidebar", call => \&pagetemplate); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => 1, }, -} #}}} +} -sub sidebar_content ($) { #{{{ +sub sidebar_content ($) { my $page=shift; my $sidebar_page=bestlink($page, "sidebar") || return; @@ -42,9 +42,9 @@ sub sidebar_content ($) { #{{{ IkiWiki::filter($sidebar_page, $page, $content)))); } -} # }}} +} -sub pagetemplate (@) { #{{{ +sub pagetemplate (@) { my %params=@_; my $page=$params{page}; @@ -56,6 +56,6 @@ sub pagetemplate (@) { #{{{ $template->param(sidebar => $content); } } -} # }}} +} 1 diff --git a/IkiWiki/Plugin/signinedit.pm b/IkiWiki/Plugin/signinedit.pm index ef7b9b428..321c93ed5 100644 --- a/IkiWiki/Plugin/signinedit.pm +++ b/IkiWiki/Plugin/signinedit.pm @@ -5,21 +5,21 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "signinedit", call => \&getsetup); hook(type => "canedit", id => "signinedit", call => \&canedit, last => 1); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => 0, }, -} #}}} +} -sub canedit ($$$) { #{{{ +sub canedit ($$$) { my $page=shift; my $cgi=shift; my $session=shift; @@ -34,6 +34,6 @@ sub canedit ($$$) { #{{{ else { return ""; } -} #}}} +} 1 diff --git a/IkiWiki/Plugin/skeleton.pm.example b/IkiWiki/Plugin/skeleton.pm.example index f844ddb91..96c4a5d6b 100644 --- a/IkiWiki/Plugin/skeleton.pm.example +++ b/IkiWiki/Plugin/skeleton.pm.example @@ -8,7 +8,7 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getopt", id => "skeleton", call => \&getopt); hook(type => "getsetup", id => "skeleton", call => \&getsetup); hook(type => "checkconfig", id => "skeleton", call => \&checkconfig); @@ -34,13 +34,13 @@ sub import { #{{{ hook(type => "formbuilder_setup", id => "skeleton", call => \&formbuilder_setup); hook(type => "formbuilder", id => "skeleton", call => \&formbuilder); hook(type => "savestate", id => "skeleton", call => \&savestate); -} # }}} +} -sub getopt () { #{{{ +sub getopt () { debug("skeleton plugin getopt"); -} #}}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, @@ -53,155 +53,155 @@ sub getsetup () { #{{{ safe => 0, rebuild => 0, }, -} #}}} +} -sub checkconfig () { #{{{ +sub checkconfig () { debug("skeleton plugin checkconfig"); -} #}}} +} -sub refresh () { #{{{ +sub refresh () { debug("skeleton plugin refresh"); -} #}}} +} -sub needsbuild () { #{{{ +sub needsbuild () { debug("skeleton plugin needsbuild"); -} #}}} +} -sub preprocess (@) { #{{{ +sub preprocess (@) { my %params=@_; return "skeleton plugin result"; -} # }}} +} -sub filter (@) { #{{{ +sub filter (@) { my %params=@_; debug("skeleton plugin running as filter"); return $params{content}; -} # }}} +} -sub linkify (@) { #{{{ +sub linkify (@) { my %params=@_; debug("skeleton plugin running as linkify"); return $params{content}; -} # }}} +} sub scan (@) { #{{{a my %params=@_; debug("skeleton plugin running as scan"); -} # }}} +} -sub htmlize (@) { #{{{ +sub htmlize (@) { my %params=@_; debug("skeleton plugin running as htmlize"); return $params{content}; -} # }}} +} -sub sanitize (@) { #{{{ +sub sanitize (@) { my %params=@_; debug("skeleton plugin running as a sanitizer"); return $params{content}; -} # }}} +} -sub postscan (@) { #{{{ +sub postscan (@) { my %params=@_; debug("skeleton plugin running as postscan"); -} # }}} +} -sub format (@) { #{{{ +sub format (@) { my %params=@_; debug("skeleton plugin running as a formatter"); return $params{content}; -} # }}} +} -sub pagetemplate (@) { #{{{ +sub pagetemplate (@) { my %params=@_; my $page=$params{page}; my $template=$params{template}; debug("skeleton plugin running as a pagetemplate hook"); -} # }}} +} -sub templatefile (@) { #{{{ +sub templatefile (@) { my %params=@_; my $page=$params{page}; debug("skeleton plugin running as a templatefile hook"); -} # }}} +} -sub delete (@) { #{{{ +sub delete (@) { my @files=@_; debug("skeleton plugin told that files were deleted: @files"); -} #}}} +} -sub change (@) { #{{{ +sub change (@) { my @files=@_; debug("skeleton plugin told that changed files were rendered: @files"); -} #}}} +} -sub cgi ($) { #{{{ +sub cgi ($) { my $cgi=shift; debug("skeleton plugin running in cgi"); -} #}}} +} -sub auth ($$) { #{{{ +sub auth ($$) { my $cgi=shift; my $session=shift; debug("skeleton plugin running in auth"); -} #}}} +} -sub sessioncgi ($$) { #{{{ +sub sessioncgi ($$) { my $cgi=shift; my $session=shift; debug("skeleton plugin running in sessioncgi"); -} #}}} +} -sub canedit ($$$) { #{{{ +sub canedit ($$$) { my $page=shift; my $cgi=shift; my $session=shift; debug("skeleton plugin running in canedit"); -} #}}} +} -sub editcontent ($$$) { #{{{ +sub editcontent ($$$) { my %params=@_; debug("skeleton plugin running in editcontent"); return $params{content}; -} #}}} +} -sub formbuilder_setup (@) { #{{{ +sub formbuilder_setup (@) { my %params=@_; debug("skeleton plugin running in formbuilder_setup"); -} # }}} +} -sub formbuilder (@) { #{{{ +sub formbuilder (@) { my %params=@_; debug("skeleton plugin running in formbuilder"); -} # }}} +} -sub savestate () { #{{{ +sub savestate () { debug("skeleton plugin running in savestate"); -} #}}} +} 1 diff --git a/IkiWiki/Plugin/smiley.pm b/IkiWiki/Plugin/smiley.pm index 2633b1ea1..70b8cef74 100644 --- a/IkiWiki/Plugin/smiley.pm +++ b/IkiWiki/Plugin/smiley.pm @@ -8,13 +8,13 @@ use IkiWiki 2.00; my %smileys; my $smiley_regexp; -sub import { #{{{ +sub import { add_underlay("smiley"); hook(type => "getsetup", id => "smiley", call => \&getsetup); hook(type => "sanitize", id => "smiley", call => \&sanitize); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, @@ -22,9 +22,9 @@ sub getsetup () { #{{{ # removes the smileys, which would break links rebuild => 1, }, -} #}}} +} -sub build_regexp () { #{{{ +sub build_regexp () { my $list=readfile(srcfile("smileys.mdwn")); while ($list =~ m/^\s*\*\s+\\\\([^\s]+)\s+\[\[([^]]+)\]\]/mg) { my $smiley=$1; @@ -50,9 +50,9 @@ sub build_regexp () { #{{{ $smiley_regexp='('.join('|', map { quotemeta } reverse sort keys %smileys).')'; #debug($smiley_regexp); -} #}}} +} -sub sanitize (@) { #{{{ +sub sanitize (@) { my %params=@_; build_regexp() unless defined $smiley_regexp; @@ -95,6 +95,6 @@ MATCH: while (m{(?:^|(?<=\s|>))(\\?)$smiley_regexp(?:(?=\s|<)|$)}g) { } return $_; -} # }}} +} 1 diff --git a/IkiWiki/Plugin/sparkline.pm b/IkiWiki/Plugin/sparkline.pm index 901c2f683..dca755c63 100644 --- a/IkiWiki/Plugin/sparkline.pm +++ b/IkiWiki/Plugin/sparkline.pm @@ -14,20 +14,20 @@ my %locmap=( left => 'TEXT_LEFT', ); -sub import { #{{{ +sub import { hook(type => "getsetup", id => "sparkline", call => \&getsetup); hook(type => "preprocess", id => "sparkline", call => \&preprocess); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} -sub preprocess (@) { #{{{ +sub preprocess (@) { my %params=@_; my $php; @@ -166,6 +166,6 @@ sub preprocess (@) { #{{{ } return 'graph'; -} # }}} +} 1 diff --git a/IkiWiki/Plugin/svn.pm b/IkiWiki/Plugin/svn.pm index d738720be..fe55e7d08 100644 --- a/IkiWiki/Plugin/svn.pm +++ b/IkiWiki/Plugin/svn.pm @@ -6,7 +6,7 @@ use strict; use IkiWiki; use POSIX qw(setlocale LC_CTYPE); -sub import { #{{{ +sub import { hook(type => "checkconfig", id => "svn", call => \&checkconfig); hook(type => "getsetup", id => "svn", call => \&getsetup); hook(type => "rcs", id => "rcs_update", call => \&rcs_update); @@ -19,9 +19,9 @@ sub import { #{{{ hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges); hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff); hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime); -} #}}} +} -sub checkconfig () { #{{{ +sub checkconfig () { if (! defined $config{svnpath}) { $config{svnpath}="trunk"; } @@ -37,9 +37,9 @@ sub checkconfig () { #{{{ wrappermode => (defined $config{svn_wrappermode} ? $config{svn_wrappermode} : "04755"), }; } -} #}}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 0, # rcs plugin @@ -87,7 +87,7 @@ sub getsetup () { #{{{ safe => 1, rebuild => 1, }, -} #}}} +} # svn needs LC_CTYPE set to a UTF-8 locale, so try to find one. Any will do. sub find_lc_ctype() { @@ -107,27 +107,27 @@ sub find_lc_ctype() { # fallback to the current locale return $current; -} # }}} +} $ENV{LC_CTYPE} = $ENV{LC_CTYPE} || find_lc_ctype(); -sub svn_info ($$) { #{{{ +sub svn_info ($$) { my $field=shift; my $file=shift; my $info=`LANG=C svn info $file`; my ($ret)=$info=~/^$field: (.*)$/m; return $ret; -} #}}} +} -sub rcs_update () { #{{{ +sub rcs_update () { if (-d "$config{srcdir}/.svn") { if (system("svn", "update", "--quiet", $config{srcdir}) != 0) { warn("svn update failed\n"); } } -} #}}} +} -sub rcs_prepedit ($) { #{{{ +sub rcs_prepedit ($) { # Prepares to edit a file under revision control. Returns a token # that must be passed into rcs_commit when the file is ready # for committing. @@ -140,9 +140,9 @@ sub rcs_prepedit ($) { #{{{ my $rev=svn_info("Revision", "$config{srcdir}/$file"); return defined $rev ? $rev : ""; } -} #}}} +} -sub rcs_commit ($$$;$$) { #{{{ +sub rcs_commit ($$$;$$) { # Tries to commit the page; returns undef on _success_ and # a version of the page with the rcs's conflict markers on failure. # The file is relative to the srcdir. @@ -185,7 +185,7 @@ sub rcs_commit ($$$;$$) { #{{{ } } return undef # success -} #}}} +} sub rcs_commit_staged ($$$) { # Commits all staged changes. Changes can be staged using rcs_add, @@ -209,7 +209,7 @@ sub rcs_commit_staged ($$$) { return undef # success } -sub rcs_add ($) { #{{{ +sub rcs_add ($) { # filename is relative to the root of the srcdir my $file=shift; @@ -224,9 +224,9 @@ sub rcs_add ($) { #{{{ warn("svn add failed\n"); } } -} #}}} +} -sub rcs_remove ($) { #{{{ +sub rcs_remove ($) { # filename is relative to the root of the srcdir my $file=shift; @@ -235,9 +235,9 @@ sub rcs_remove ($) { #{{{ warn("svn rm failed\n"); } } -} #}}} +} -sub rcs_rename ($$) { #{{{ +sub rcs_rename ($$) { # filenames relative to the root of the srcdir my ($src, $dest)=@_; @@ -258,9 +258,9 @@ sub rcs_rename ($$) { #{{{ warn("svn rename failed\n"); } } -} #}}} +} -sub rcs_recentchanges ($) { #{{{ +sub rcs_recentchanges ($) { my $num=shift; my @ret; @@ -341,14 +341,14 @@ sub rcs_recentchanges ($) { #{{{ } return @ret; -} #}}} +} -sub rcs_diff ($) { #{{{ +sub rcs_diff ($) { my $rev=IkiWiki::possibly_foolish_untaint(int(shift)); return `svnlook diff $config{svnrepo} -r$rev --no-diff-deleted`; -} #}}} +} -sub rcs_getctime ($) { #{{{ +sub rcs_getctime ($) { my $file=shift; my $svn_log_infoline=qr/^r\d+\s+\|\s+[^\s]+\s+\|\s+(\d+-\d+-\d+\s+\d+:\d+:\d+\s+[-+]?\d+).*/; @@ -376,6 +376,6 @@ sub rcs_getctime ($) { #{{{ $date=str2time($date); debug("found ctime ".localtime($date)." for $file"); return $date; -} #}}} +} 1 diff --git a/IkiWiki/Plugin/table.pm b/IkiWiki/Plugin/table.pm index e782fc238..b6f53f607 100644 --- a/IkiWiki/Plugin/table.pm +++ b/IkiWiki/Plugin/table.pm @@ -6,20 +6,20 @@ use strict; use Encode; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "table", call => \&getsetup); hook(type => "preprocess", id => "table", call => \&preprocess); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} -sub preprocess (@) { #{{{ +sub preprocess (@) { my %params =( format => 'auto', header => 'row', @@ -102,16 +102,16 @@ sub preprocess (@) { #{{{ else { return $html; } -} #}}} +} -sub is_dsv_data ($) { #{{{ +sub is_dsv_data ($) { my $text = shift; my ($line) = split(/\n/, $text); return $line =~ m{.+\|}; } -sub split_csv ($$) { #{{{ +sub split_csv ($$) { my @text_lines = split(/\n/, shift); my $delimiter = shift; @@ -137,9 +137,9 @@ sub split_csv ($$) { #{{{ } return @data; -} #}}} +} -sub split_dsv ($$) { #{{{ +sub split_dsv ($$) { my @text_lines = split(/\n/, shift); my $delimiter = shift; $delimiter="|" unless defined $delimiter; @@ -150,9 +150,9 @@ sub split_dsv ($$) { #{{{ } return @data; -} #}}} +} -sub genrow ($@) { #{{{ +sub genrow ($@) { my %params=%{shift()}; my $elt = shift; my @data = @_; @@ -190,6 +190,6 @@ sub genrow ($@) { #{{{ push @ret, "\t\t"; return @ret; -} #}}} +} 1 diff --git a/IkiWiki/Plugin/tag.pm b/IkiWiki/Plugin/tag.pm index d725ef9b3..ecc77cbb1 100644 --- a/IkiWiki/Plugin/tag.pm +++ b/IkiWiki/Plugin/tag.pm @@ -8,22 +8,22 @@ use IkiWiki 2.00; my %tags; -sub import { #{{{ +sub import { hook(type => "getopt", id => "tag", call => \&getopt); hook(type => "getsetup", id => "tag", call => \&getsetup); hook(type => "preprocess", id => "tag", call => \&preprocess_tag, scan => 1); hook(type => "preprocess", id => "taglink", call => \&preprocess_taglink, scan => 1); hook(type => "pagetemplate", id => "tag", call => \&pagetemplate); -} # }}} +} -sub getopt () { #{{{ +sub getopt () { eval q{use Getopt::Long}; error($@) if $@; Getopt::Long::Configure('pass_through'); GetOptions("tagbase=s" => \$config{tagbase}); -} #}}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, @@ -36,9 +36,9 @@ sub getsetup () { #{{{ safe => 1, rebuild => 1, }, -} #}}} +} -sub tagpage ($) { #{{{ +sub tagpage ($) { my $tag=shift; if ($tag !~ m{^\.?/} && @@ -48,18 +48,18 @@ sub tagpage ($) { #{{{ } return $tag; -} #}}} +} -sub taglink ($$$;@) { #{{{ +sub taglink ($$$;@) { my $page=shift; my $destpage=shift; my $tag=shift; my %opts=@_; return htmllink($page, $destpage, tagpage($tag), %opts); -} #}}} +} -sub preprocess_tag (@) { #{{{ +sub preprocess_tag (@) { if (! @_) { return ""; } @@ -77,9 +77,9 @@ sub preprocess_tag (@) { #{{{ } return ""; -} # }}} +} -sub preprocess_taglink (@) { #{{{ +sub preprocess_taglink (@) { if (! @_) { return ""; } @@ -102,9 +102,9 @@ sub preprocess_taglink (@) { #{{{ grep { $_ ne 'page' && $_ ne 'destpage' && $_ ne 'preview' } keys %params); -} # }}} +} -sub pagetemplate (@) { #{{{ +sub pagetemplate (@) { my %params=@_; my $page=$params{page}; my $destpage=$params{destpage}; @@ -123,6 +123,6 @@ sub pagetemplate (@) { #{{{ sort keys %{$tags{$page}}]); } } -} # }}} +} 1 diff --git a/IkiWiki/Plugin/template.pm b/IkiWiki/Plugin/template.pm index c980df48f..1b7eb91bf 100644 --- a/IkiWiki/Plugin/template.pm +++ b/IkiWiki/Plugin/template.pm @@ -8,20 +8,20 @@ use IkiWiki 2.00; use HTML::Template; use Encode; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "template", call => \&getsetup); hook(type => "preprocess", id => "template", call => \&preprocess); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} -sub preprocess (@) { #{{{ +sub preprocess (@) { my %params=@_; if (! exists $params{id}) { @@ -71,6 +71,6 @@ sub preprocess (@) { #{{{ return IkiWiki::preprocess($params{page}, $params{destpage}, IkiWiki::filter($params{page}, $params{destpage}, $template->output)); -} # }}} +} 1 diff --git a/IkiWiki/Plugin/testpagespec.pm b/IkiWiki/Plugin/testpagespec.pm index 9f9b50f01..a6e94dbbb 100644 --- a/IkiWiki/Plugin/testpagespec.pm +++ b/IkiWiki/Plugin/testpagespec.pm @@ -5,20 +5,20 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "testpagespec", call => \&getsetup); hook(type => "preprocess", id => "testpagespec", call => \&preprocess); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} -sub preprocess (@) { #{{{ +sub preprocess (@) { my %params=@_; foreach my $param (qw{match pagespec}) { @@ -37,6 +37,6 @@ sub preprocess (@) { #{{{ else { return "no match: $ret"; } -} # }}} +} 1 diff --git a/IkiWiki/Plugin/teximg.pm b/IkiWiki/Plugin/teximg.pm index 661d97b1f..57b23147e 100644 --- a/IkiWiki/Plugin/teximg.pm +++ b/IkiWiki/Plugin/teximg.pm @@ -21,12 +21,12 @@ EOPREFIX my $default_postfix = '\\end{document}'; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "teximg", call => \&getsetup); hook(type => "preprocess", id => "teximg", call => \&preprocess); -} #}}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, @@ -52,9 +52,9 @@ sub getsetup () { #{{{ safe => 0, # Not sure how secure LaTeX is... rebuild => 1, }, -} #}}} +} -sub preprocess (@) { #{{{ +sub preprocess (@) { my %params = @_; my $height = $params{height}; @@ -76,9 +76,9 @@ sub preprocess (@) { #{{{ else { error gettext("code includes disallowed latex commands") } -} #}}} +} -sub check_height ($) { #{{{ +sub check_height ($) { # Since latex doesn't support unlimited scaling this function # returns the closest supported size. my $height =shift; @@ -95,9 +95,9 @@ sub check_height ($) { #{{{ } } return $ret; -} #}}} +} -sub create ($$$) { #{{{ +sub create ($$$) { # This function calls the image generating function and returns # the for the generated image. my $code = shift; @@ -127,9 +127,9 @@ sub create ($$$) { #{{{ else { error qq{}.gettext("failed to generate image from code").""; } -} #}}} +} -sub gen_image ($$$$) { #{{{ +sub gen_image ($$$$) { # Actually creates the image. my $code = shift; my $height = shift; @@ -180,18 +180,18 @@ sub gen_image ($$$$) { #{{{ return 0; } -} #}}} +} -sub create_tmp_dir ($) { #{{{ +sub create_tmp_dir ($) { # Create a temp directory, it will be removed when ikiwiki exits. my $base = shift; my $template = $base.".XXXXXXXXXX"; my $tmpdir = tempdir($template, TMPDIR => 1, CLEANUP => 1); return $tmpdir; -} #}}} +} -sub check ($) { #{{{ +sub check ($) { # Check if the code is ok my $code = shift; @@ -219,6 +219,6 @@ sub check ($) { #{{{ } } return 1; -} #}}} +} 1 diff --git a/IkiWiki/Plugin/textile.pm b/IkiWiki/Plugin/textile.pm index bbd282f0c..d1b927b74 100644 --- a/IkiWiki/Plugin/textile.pm +++ b/IkiWiki/Plugin/textile.pm @@ -9,26 +9,26 @@ use strict; use IkiWiki 2.00; use Encode; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "textile", call => \&getsetup); hook(type => "htmlize", id => "txtl", call => \&htmlize); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => 1, # format plugin }, -} #}}} +} -sub htmlize (@) { #{{{ +sub htmlize (@) { my %params=@_; my $content = decode_utf8(encode_utf8($params{content})); eval q{use Text::Textile}; return $content if $@; return Text::Textile::textile($content); -} # }}} +} 1 diff --git a/IkiWiki/Plugin/tla.pm b/IkiWiki/Plugin/tla.pm index 0a5c161b2..f4b20a6ec 100644 --- a/IkiWiki/Plugin/tla.pm +++ b/IkiWiki/Plugin/tla.pm @@ -5,7 +5,7 @@ use warnings; use strict; use IkiWiki; -sub import { #{{{ +sub import { hook(type => "checkconfig", id => "tla", call => \&checkconfig); hook(type => "getsetup", id => "tla", call => \&getsetup); hook(type => "rcs", id => "rcs_update", call => \&rcs_update); @@ -18,18 +18,18 @@ sub import { #{{{ hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges); hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff); hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime); -} #}}} +} -sub checkconfig () { #{{{ +sub checkconfig () { if (defined $config{tla_wrapper} && length $config{tla_wrapper}) { push @{$config{wrappers}}, { wrapper => $config{tla_wrapper}, wrappermode => (defined $config{tla_wrappermode} ? $config{tla_wrappermode} : "06755"), }; } -} #}}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 0, # rcs plugin @@ -63,9 +63,9 @@ sub getsetup () { #{{{ safe => 1, rebuild => 1, }, -} #}}} +} -sub quiet_system (@) { #{{{ +sub quiet_system (@) { # See Debian bug #385939. open (SAVEOUT, ">&STDOUT"); close STDOUT; @@ -75,17 +75,17 @@ sub quiet_system (@) { #{{{ open (STDOUT, ">&SAVEOUT"); close SAVEOUT; return $ret; -} #}}} +} -sub rcs_update () { #{{{ +sub rcs_update () { if (-d "$config{srcdir}/{arch}") { if (quiet_system("tla", "replay", "-d", $config{srcdir}) != 0) { warn("tla replay failed\n"); } } -} #}}} +} -sub rcs_prepedit ($) { #{{{ +sub rcs_prepedit ($) { my $file=shift; if (-d "$config{srcdir}/{arch}") { @@ -94,9 +94,9 @@ sub rcs_prepedit ($) { #{{{ my $rev=`tla tree-id $config{srcdir}`; return defined $rev ? $rev : ""; } -} #}}} +} -sub rcs_commit ($$$;$$) { #{{{ +sub rcs_commit ($$$;$$) { my $file=shift; my $message=shift; my $rcstoken=shift; @@ -135,7 +135,7 @@ sub rcs_commit ($$$;$$) { #{{{ } } return undef # success -} #}}} +} sub rcs_commit_staged ($$$) { # Commits all staged changes. Changes can be staged using rcs_add, @@ -145,7 +145,7 @@ sub rcs_commit_staged ($$$) { error("rcs_commit_staged not implemented for tla"); # TODO } -sub rcs_add ($) { #{{{ +sub rcs_add ($) { my $file=shift; if (-d "$config{srcdir}/{arch}") { @@ -153,19 +153,19 @@ sub rcs_add ($) { #{{{ warn("tla add failed\n"); } } -} #}}} +} -sub rcs_remove ($) { # {{{ +sub rcs_remove ($) { my $file = shift; error("rcs_remove not implemented for tla"); # TODO -} #}}} +} sub rcs_rename ($$) { # {{{a my ($src, $dest) = @_; error("rcs_rename not implemented for tla"); # TODO -} #}}} +} sub rcs_recentchanges ($) { my $num=shift; @@ -239,7 +239,7 @@ sub rcs_recentchanges ($) { return @ret; } -sub rcs_diff ($) { #{{{ +sub rcs_diff ($) { my $rev=shift; my $logs = `tla logs -d $config{srcdir}`; my @changesets = reverse split(/\n/, $logs); @@ -251,9 +251,9 @@ sub rcs_diff ($) { #{{{ my $revminusone = $changesets[$i+1]; return `tla diff -d $config{srcdir} $revminusone`; -} #}}} +} -sub rcs_getctime ($) { #{{{ +sub rcs_getctime ($) { my $file=shift; eval q{use Date::Parse}; error($@) if $@; @@ -281,6 +281,6 @@ sub rcs_getctime ($) { #{{{ my $date=str2time($sdate, 'UTC'); debug("found ctime ".localtime($date)." for $file"); return $date; -} #}}} +} 1 diff --git a/IkiWiki/Plugin/toc.pm b/IkiWiki/Plugin/toc.pm index dff9d9aa5..460837b1d 100644 --- a/IkiWiki/Plugin/toc.pm +++ b/IkiWiki/Plugin/toc.pm @@ -7,23 +7,23 @@ use strict; use IkiWiki 2.00; use HTML::Parser; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "toc", call => \&getsetup); hook(type => "preprocess", id => "toc", call => \&preprocess); hook(type => "format", id => "toc", call => \&format); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} my %tocpages; -sub preprocess (@) { #{{{ +sub preprocess (@) { my %params=@_; if ($params{page} eq $params{destpage}) { @@ -40,9 +40,9 @@ sub preprocess (@) { #{{{ # right. return ""; } -} # }}} +} -sub format (@) { #{{{ +sub format (@) { my %params=@_; my $content=$params{content}; diff --git a/IkiWiki/Plugin/toggle.pm b/IkiWiki/Plugin/toggle.pm index 657d8d3c2..967b07fcc 100644 --- a/IkiWiki/Plugin/toggle.pm +++ b/IkiWiki/Plugin/toggle.pm @@ -5,7 +5,7 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { add_underlay("javascript"); hook(type => "getsetup", id => "toggle", call => \&getsetup); hook(type => "preprocess", id => "toggle", @@ -13,17 +13,17 @@ sub import { #{{{ hook(type => "preprocess", id => "toggleable", call => \&preprocess_toggleable); hook(type => "format", id => "toggle", call => \&format); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} -sub genid ($$) { #{{{ +sub genid ($$) { my $page=shift; my $id=shift; @@ -35,16 +35,16 @@ sub genid ($$) { #{{{ $id="id$id"; } return $id; -} #}}} +} -sub preprocess_toggle (@) { #{{{ +sub preprocess_toggle (@) { my %params=(id => "default", text => "more", @_); my $id=genid($params{page}, $params{id}); return "$params{text}"; -} # }}} +} -sub preprocess_toggleable (@) { #{{{ +sub preprocess_toggleable (@) { my %params=(id => "default", text => "", open => "no", @_); # Preprocess the text to expand any preprocessor directives @@ -61,9 +61,9 @@ sub preprocess_toggleable (@) { #{{{ my ($indent)=$params{text}=~/( +)$/; $indent="" unless defined $indent; return "
\n\n$params{text}\n$indent
"; -} # }}} +} -sub format (@) { #{{{ +sub format (@) { my %params=@_; if ($params{content}=~s!(
\s*)
!$1!g) { @@ -74,9 +74,9 @@ sub format (@) { #{{{ } } return $params{content}; -} # }}} +} -sub include_javascript ($;$) { #{{{ +sub include_javascript ($;$) { my $page=shift; my $absolute=shift; @@ -84,6 +84,6 @@ sub include_javascript ($;$) { #{{{ '" type="text/javascript" charset="utf-8">'."\n". ''; -} #}}} +} 1 diff --git a/IkiWiki/Plugin/txt.pm b/IkiWiki/Plugin/txt.pm index e157bf07e..d65bb2036 100644 --- a/IkiWiki/Plugin/txt.pm +++ b/IkiWiki/Plugin/txt.pm @@ -24,13 +24,13 @@ sub import { } } -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => 1, # format plugin }, -} #}}} +} # We use filter to convert raw text to HTML # (htmlize is called after other plugins insert HTML) diff --git a/IkiWiki/Plugin/typography.pm b/IkiWiki/Plugin/typography.pm index 27089b390..e395b2143 100644 --- a/IkiWiki/Plugin/typography.pm +++ b/IkiWiki/Plugin/typography.pm @@ -6,20 +6,20 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getopt", id => "typography", call => \&getopt); hook(type => "getsetup", id => "typography", call => \&getsetup); IkiWiki::hook(type => "sanitize", id => "typography", call => \&sanitize); -} # }}} +} -sub getopt () { #{{{ +sub getopt () { eval q{use Getopt::Long}; error($@) if $@; Getopt::Long::Configure('pass_through'); GetOptions("typographyattributes=s" => \$config{typographyattributes}); -} #}}} +} -sub getsetup () { #{{{ +sub getsetup () { eval q{use Text::Typography}; error($@) if $@; @@ -36,9 +36,9 @@ sub getsetup () { #{{{ safe => 1, rebuild => 1, }, -} #}}} +} -sub sanitize (@) { #{{{ +sub sanitize (@) { my %params=@_; eval q{use Text::Typography}; @@ -46,6 +46,6 @@ sub sanitize (@) { #{{{ my $attributes=defined $config{typographyattributes} ? $config{typographyattributes} : '3'; return Text::Typography::typography($params{content}, $attributes); -} # }}} +} 1 diff --git a/IkiWiki/Plugin/version.pm b/IkiWiki/Plugin/version.pm index 18e9613ae..3526dafde 100644 --- a/IkiWiki/Plugin/version.pm +++ b/IkiWiki/Plugin/version.pm @@ -6,21 +6,21 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "version", call => \&getsetup); hook(type => "needsbuild", id => "version", call => \&needsbuild); hook(type => "preprocess", id => "version", call => \&preprocess); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, rebuild => undef, }, -} #}}} +} -sub needsbuild (@) { #{{{ +sub needsbuild (@) { my $needsbuild=shift; foreach my $page (keys %pagestate) { if (exists $pagestate{$page}{version}{shown}) { @@ -36,11 +36,11 @@ sub needsbuild (@) { #{{{ } } } -} # }}} +} -sub preprocess (@) { #{{{ +sub preprocess (@) { my %params=@_; $pagestate{$params{destpage}}{version}{shown}=$IkiWiki::version; -} # }}} +} 1 diff --git a/IkiWiki/Plugin/websetup.pm b/IkiWiki/Plugin/websetup.pm index 827ee3099..66dacfde3 100644 --- a/IkiWiki/Plugin/websetup.pm +++ b/IkiWiki/Plugin/websetup.pm @@ -5,15 +5,15 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "websetup", call => \&getsetup); hook(type => "checkconfig", id => "websetup", call => \&checkconfig); hook(type => "sessioncgi", id => "websetup", call => \&sessioncgi); hook(type => "formbuilder_setup", id => "websetup", call => \&formbuilder_setup); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, @@ -33,15 +33,15 @@ sub getsetup () { #{{{ safe => 0, rebuild => 0, }, -} #}}} +} -sub checkconfig () { #{{{ +sub checkconfig () { if (! exists $config{websetup_show_unsafe}) { $config{websetup_show_unsafe}=1; } -} #}}} +} -sub formatexample ($$) { #{{{ +sub formatexample ($$) { my $example=shift; my $value=shift; @@ -54,9 +54,9 @@ sub formatexample ($$) { #{{{ else { return ""; } -} #}}} +} -sub showfields ($$$@) { #{{{ +sub showfields ($$$@) { my $form=shift; my $plugin=shift; my $enabled=shift; @@ -207,16 +207,16 @@ sub showfields ($$$@) { #{{{ } return %enabledfields; -} #}}} +} -sub enable_plugin ($) { #{{{ +sub enable_plugin ($) { my $plugin=shift; $config{disable_plugins}=[grep { $_ ne $plugin } @{$config{disable_plugins}}]; push @{$config{add_plugins}}, $plugin; } -sub disable_plugin ($) { #{{{ +sub disable_plugin ($) { my $plugin=shift; if (grep { $_ eq $plugin } @{$config{add_plugins}}) { @@ -227,7 +227,7 @@ sub disable_plugin ($) { #{{{ } } -sub showform ($$) { #{{{ +sub showform ($$) { my $cgi=shift; my $session=shift; @@ -441,9 +441,9 @@ sub showform ($$) { #{{{ } IkiWiki::showform($form, $buttons, $session, $cgi); -} #}}} +} -sub sessioncgi ($$) { #{{{ +sub sessioncgi ($$) { my $cgi=shift; my $session=shift; @@ -451,9 +451,9 @@ sub sessioncgi ($$) { #{{{ showform($cgi, $session); exit; } -} #}}} +} -sub formbuilder_setup (@) { #{{{ +sub formbuilder_setup (@) { my %params=@_; my $form=$params{form}; @@ -464,6 +464,6 @@ sub formbuilder_setup (@) { #{{{ exit; } } -} #}}} +} 1 diff --git a/IkiWiki/Plugin/wikitext.pm b/IkiWiki/Plugin/wikitext.pm index c47ccb7b1..50571e524 100644 --- a/IkiWiki/Plugin/wikitext.pm +++ b/IkiWiki/Plugin/wikitext.pm @@ -6,27 +6,27 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "getsetup", id => "wiki", call => \&getsetup); hook(type => "htmlize", id => "wiki", call => \&htmlize); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 0, # format plugin rebuild => undef, }, -} #}}} +} -sub htmlize (@) { #{{{ +sub htmlize (@) { my %params=@_; my $content = $params{content}; eval q{use Text::WikiFormat}; return $content if $@; return Text::WikiFormat::format($content, undef, { implicit_links => 0 }); -} # }}} +} 1 diff --git a/IkiWiki/Receive.pm b/IkiWiki/Receive.pm index 72668d26a..37b6f2a62 100644 --- a/IkiWiki/Receive.pm +++ b/IkiWiki/Receive.pm @@ -6,21 +6,21 @@ use warnings; use strict; use IkiWiki; -sub getuser () { #{{{ +sub getuser () { my $user=(getpwuid(exists $ENV{CALLER_UID} ? $ENV{CALLER_UID} : $<))[0]; if (! defined $user) { error("cannot determine username for $<"); } return $user; -} #}}} +} -sub trusted () { #{{{ +sub trusted () { my $user=getuser(); return ! ref $config{untrusted_committers} || ! grep { $_ eq $user } @{$config{untrusted_committers}}; -} #}}} +} -sub gen_wrapper () { #{{{ +sub gen_wrapper () { # Test for commits from untrusted committers in the wrapper, to # avoid loading ikiwiki at all for trusted commits. @@ -43,9 +43,9 @@ EOF } EOF return $ret; -} #}}} +} -sub test () { #{{{ +sub test () { exit 0 if trusted(); IkiWiki::lockwiki(); @@ -130,6 +130,6 @@ sub test () { #{{{ } exit 0; -} #}}} +} 1 diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 389063d46..adae9f0d5 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -10,7 +10,7 @@ use Encode; my %backlinks; my $backlinks_calculated=0; -sub calculate_backlinks () { #{{{ +sub calculate_backlinks () { return if $backlinks_calculated; %backlinks=(); foreach my $page (keys %links) { @@ -22,9 +22,9 @@ sub calculate_backlinks () { #{{{ } } $backlinks_calculated=1; -} #}}} +} -sub backlinks ($) { #{{{ +sub backlinks ($) { my $page=shift; calculate_backlinks(); @@ -45,9 +45,9 @@ sub backlinks ($) { #{{{ push @links, { url => $href, page => pagetitle($p_trimmed) }; } return @links; -} #}}} +} -sub genpage ($$) { #{{{ +sub genpage ($$) { my $page=shift; my $content=shift; @@ -131,9 +131,9 @@ sub genpage ($$) { #{{{ }); return $content; -} #}}} +} -sub scan ($) { #{{{ +sub scan ($) { my $file=shift; my $type=pagetype($file); @@ -165,9 +165,9 @@ sub scan ($) { #{{{ else { will_render($file, $file, 1); } -} #}}} +} -sub fast_file_copy (@) { #{{{ +sub fast_file_copy (@) { my $srcfile=shift; my $destfile=shift; my $srcfd=shift; @@ -191,7 +191,7 @@ sub fast_file_copy (@) { #{{{ } } -sub render ($) { #{{{ +sub render ($) { my $file=shift; my $type=pagetype($file); @@ -233,9 +233,9 @@ sub render ($) { #{{{ fast_file_copy($srcfile, $file, $srcfd, @_); }); } -} #}}} +} -sub prune ($) { #{{{ +sub prune ($) { my $file=shift; unlink($file); @@ -243,9 +243,9 @@ sub prune ($) { #{{{ while (rmdir($dir)) { $dir=dirname($dir); } -} #}}} +} -sub refresh () { #{{{ +sub refresh () { # security check, avoid following symlinks in the srcdir path by default my $test=$config{srcdir}; while (length $test) { @@ -507,9 +507,9 @@ sub refresh () { #{{{ if (%rendered) { run_hooks(change => sub { shift->(keys %rendered) }); } -} #}}} +} -sub commandline_render () { #{{{ +sub commandline_render () { lockwiki(); loadindex(); unlockwiki(); @@ -532,6 +532,6 @@ sub commandline_render () { #{{{ print genpage($page, $content); exit 0; -} #}}} +} 1 diff --git a/IkiWiki/Setup.pm b/IkiWiki/Setup.pm index 77afdd608..6ee112096 100644 --- a/IkiWiki/Setup.pm +++ b/IkiWiki/Setup.pm @@ -10,7 +10,7 @@ use IkiWiki; use open qw{:utf8 :std}; use File::Spec; -sub load ($) { # {{{ +sub load ($) { my $setup=IkiWiki::possibly_foolish_untaint(shift); $config{setupfile}=File::Spec->rel2abs($setup); @@ -27,7 +27,7 @@ sub load ($) { # {{{ eval $code; error("$setup: ".$@) if $@; -} #}}} +} sub merge ($) { # Merge setup into existing config and untaint. @@ -71,9 +71,9 @@ sub merge ($) { wrappermode => (defined $config{cgi_wrappermode} ? $config{cgi_wrappermode} : "06755"), }; } -} #}}} +} -sub getsetup () { #{{{ +sub getsetup () { # Gets all available setup data from all plugins. Returns an # ordered list of [plugin, setup] pairs. my @ret; @@ -105,9 +105,9 @@ sub getsetup () { #{{{ $config{syslog}=$syslog; return @ret; -} #}}} +} -sub dump ($) { #{{{ +sub dump ($) { my $file=IkiWiki::possibly_foolish_untaint(shift); require IkiWiki::Setup::Standard; diff --git a/IkiWiki/Setup/Automator.pm b/IkiWiki/Setup/Automator.pm index 88e9f3d24..9f2380d52 100644 --- a/IkiWiki/Setup/Automator.pm +++ b/IkiWiki/Setup/Automator.pm @@ -10,20 +10,20 @@ use IkiWiki::UserInfo; use Term::ReadLine; use File::Path; -sub ask ($$) { #{{{ +sub ask ($$) { my ($question, $default)=@_; my $r=Term::ReadLine->new("ikiwiki"); $r->readline($question." ", $default); -} #}}} +} -sub prettydir ($) { #{{{ +sub prettydir ($) { my $dir=shift; $dir=~s/^\Q$ENV{HOME}\E\//~\//; return $dir; -} #}}} +} -sub import (@) { #{{{ +sub import (@) { my $this=shift; IkiWiki::Setup::merge({@_}); @@ -142,6 +142,6 @@ sub import (@) { #{{{ print "To modify settings, edit ".prettydir($config{dumpsetup})." and then run:\n"; print " ikiwiki -setup ".prettydir($config{dumpsetup})."\n"; exit 0; -} #}}} +} 1 diff --git a/IkiWiki/Setup/Standard.pm b/IkiWiki/Setup/Standard.pm index e6bff2826..951bcfc56 100644 --- a/IkiWiki/Setup/Standard.pm +++ b/IkiWiki/Setup/Standard.pm @@ -9,11 +9,11 @@ use warnings; use strict; use IkiWiki; -sub import { #{{{ +sub import { IkiWiki::Setup::merge($_[1]); -} #}}} +} -sub dumpline ($$$$) { #{{{ +sub dumpline ($$$$) { my $key=shift; my $value=shift; my $type=shift; @@ -55,9 +55,9 @@ sub dumpline ($$$$) { #{{{ } return "\t$prefix$key => $dumpedvalue,"; -} #}}} +} -sub dumpvalues ($@) { #{{{ +sub dumpvalues ($@) { my $setup=shift; my @ret; while (@_) { @@ -80,9 +80,9 @@ sub dumpvalues ($@) { #{{{ } } return @ret; -} #}}} +} -sub gendump ($) { #{{{ +sub gendump ($) { my $description=shift; my %setup=(%config); my @ret; @@ -112,6 +112,6 @@ sub gendump ($) { #{{{ push @ret, "}"; return @ret; -} #}}} +} 1 diff --git a/IkiWiki/UserInfo.pm b/IkiWiki/UserInfo.pm index dcf99da09..3423dc923 100644 --- a/IkiWiki/UserInfo.pm +++ b/IkiWiki/UserInfo.pm @@ -7,12 +7,12 @@ use strict; use Storable; use IkiWiki; -sub userinfo_retrieve () { #{{{ +sub userinfo_retrieve () { my $userinfo=eval{ Storable::lock_retrieve("$config{wikistatedir}/userdb") }; return $userinfo; -} #}}} +} -sub userinfo_store ($) { #{{{ +sub userinfo_store ($) { my $userinfo=shift; my $newfile="$config{wikistatedir}/userdb.new"; @@ -26,9 +26,9 @@ sub userinfo_store ($) { #{{{ } } return $ret; -} #}}} +} -sub userinfo_get ($$) { #{{{ +sub userinfo_get ($$) { my $user=shift; my $field=shift; @@ -39,9 +39,9 @@ sub userinfo_get ($$) { #{{{ return ""; } return $userinfo->{$user}->{$field}; -} #}}} +} -sub userinfo_set ($$$) { #{{{ +sub userinfo_set ($$$) { my $user=shift; my $field=shift; my $value=shift; @@ -54,9 +54,9 @@ sub userinfo_set ($$$) { #{{{ $userinfo->{$user}->{$field}=$value; return userinfo_store($userinfo); -} #}}} +} -sub userinfo_setall ($$) { #{{{ +sub userinfo_setall ($$) { my $user=shift; my $info=shift; @@ -66,32 +66,32 @@ sub userinfo_setall ($$) { #{{{ } $userinfo->{$user}=$info; return userinfo_store($userinfo); -} #}}} +} -sub is_admin ($) { #{{{ +sub is_admin ($) { my $user_name=shift; return grep { $_ eq $user_name } @{$config{adminuser}}; -} #}}} +} # XXX deprecated, should be removed eventually -sub get_banned_users () { #{{{ +sub get_banned_users () { my @ret; my $userinfo=userinfo_retrieve(); foreach my $user (keys %{$userinfo}) { push @ret, $user if $userinfo->{$user}->{banned}; } return @ret; -} #}}} +} # XXX deprecated, should be removed eventually -sub set_banned_users (@) { #{{{ +sub set_banned_users (@) { my %banned=map { $_ => 1 } @_; my $userinfo=userinfo_retrieve(); foreach my $user (keys %{$userinfo}) { $userinfo->{$user}->{banned} = $banned{$user}; } return userinfo_store($userinfo); -} #}}} +} 1 diff --git a/IkiWiki/Wrapper.pm b/IkiWiki/Wrapper.pm index 31e30ad2e..dd9971a34 100644 --- a/IkiWiki/Wrapper.pm +++ b/IkiWiki/Wrapper.pm @@ -8,7 +8,7 @@ use File::Spec; use Data::Dumper; use IkiWiki; -sub gen_wrapper () { #{{{ +sub gen_wrapper () { $config{srcdir}=File::Spec->rel2abs($config{srcdir}); $config{destdir}=File::Spec->rel2abs($config{destdir}); my $this=File::Spec->rel2abs($0); @@ -173,6 +173,6 @@ EOF #translators: The parameter is a filename. printf(gettext("successfully generated %s"), $wrapper); print "\n"; -} #}}} +} 1 diff --git a/debian/changelog b/debian/changelog index b884dd596..f7085169c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -19,6 +19,7 @@ ikiwiki (2.71) UNRELEASED; urgency=low * rename: Fix double-escaping of page name in edit box. * monotone: When getting the log, tell monotone how many entries we want, rather than closing the pipe, which it dislikes. (thm) + * Coding style change: Remove explcit vim folding markers. -- Joey Hess Mon, 17 Nov 2008 14:02:10 -0500 diff --git a/doc/bugs/Allow_overriding_of_symlink_restriction.mdwn b/doc/bugs/Allow_overriding_of_symlink_restriction.mdwn index 07badd646..efdd9004e 100644 --- a/doc/bugs/Allow_overriding_of_symlink_restriction.mdwn +++ b/doc/bugs/Allow_overriding_of_symlink_restriction.mdwn @@ -34,9 +34,9 @@ Is there a huge objection to this patch? index 990fcaa..0fb78ba 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm - @@ -260,13 +260,15 @@ sub prune ($) { #{{{ + @@ -260,13 +260,15 @@ sub prune ($) { - sub refresh () { #{{{ + sub refresh () { # security check, avoid following symlinks in the srcdir path - my $test=$config{srcdir}; - while (length $test) { @@ -108,7 +108,7 @@ like this being accepted before I bothered. use IkiWiki; +use File::Spec; - sub gen_wrapper () { #{{{ + sub gen_wrapper () { - $config{srcdir}=abs_path($config{srcdir}); - $config{destdir}=abs_path($config{destdir}); - my $this=abs_path($0); diff --git a/doc/bugs/Can__39__t_create_root_page.mdwn b/doc/bugs/Can__39__t_create_root_page.mdwn index 60cbcd530..91c2eae60 100644 --- a/doc/bugs/Can__39__t_create_root_page.mdwn +++ b/doc/bugs/Can__39__t_create_root_page.mdwn @@ -33,7 +33,7 @@ This type of page name (with leading slash) also gets created by the aggregate p index 99cead6..23d9616 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm - @@ -305,9 +305,11 @@ sub cgi_editpage ($$) { #{{{ + @@ -305,9 +305,11 @@ sub cgi_editpage ($$) { my $page=$form->field('page'); $page=possibly_foolish_untaint($page); if (! defined $page || ! length $page || @@ -46,7 +46,7 @@ This type of page name (with leading slash) also gets created by the aggregate p my $baseurl=$config{url}."/".htmlpage($page); - @@ -425,6 +427,7 @@ sub cgi_editpage ($$) { #{{{ + @@ -425,6 +427,7 @@ sub cgi_editpage ($$) { $from ne $form->field('from') || file_pruned($from, $config{srcdir}) || $from=~/^\// || diff --git a/doc/bugs/Insecure_dependency_in_eval_while_running_with_-T_switch.mdwn b/doc/bugs/Insecure_dependency_in_eval_while_running_with_-T_switch.mdwn index 28b48e2c6..c3beb8219 100644 --- a/doc/bugs/Insecure_dependency_in_eval_while_running_with_-T_switch.mdwn +++ b/doc/bugs/Insecure_dependency_in_eval_while_running_with_-T_switch.mdwn @@ -53,7 +53,7 @@ I didn't apply your following old patch against `Ikiwiki.pm` file: + } + + return eval $newpagespec; - } #}}} + } package IkiWiki::PageSpec; @@ -83,7 +83,7 @@ to break the code I distribute in my backport ;) + my $ret=eval possibly_foolish_untaint(pagespec_translate($spec)); return IkiWiki::FailReason->new("syntax error") if $@; return $ret; - } #}}} + } >> Thanks a lot, Joey! It works :) >> diff --git a/doc/bugs/Monotone_rcs_support.mdwn b/doc/bugs/Monotone_rcs_support.mdwn index 3d1388312..8687e7983 100644 --- a/doc/bugs/Monotone_rcs_support.mdwn +++ b/doc/bugs/Monotone_rcs_support.mdwn @@ -11,7 +11,7 @@ diff --git a/IkiWiki/Rcs/monotone.pm b/IkiWiki/Rcs/monotone.pm index cde6029..34f8f96 100644 --- a/IkiWiki/Rcs/monotone.pm +++ b/IkiWiki/Rcs/monotone.pm -@@ -186,8 +186,9 @@ sub rcs_update () { #{{{ +@@ -186,8 +186,9 @@ sub rcs_update () { check_config(); if (defined($config{mtnsync}) && $config{mtnsync}) { diff --git a/doc/bugs/No_link_for_blog_items_when_filename_contains_a_colon.mdwn b/doc/bugs/No_link_for_blog_items_when_filename_contains_a_colon.mdwn index 019970899..bb3f92f9c 100644 --- a/doc/bugs/No_link_for_blog_items_when_filename_contains_a_colon.mdwn +++ b/doc/bugs/No_link_for_blog_items_when_filename_contains_a_colon.mdwn @@ -38,19 +38,19 @@ At the moment I see two possible solutions: +++ IkiWiki.pm 2008-07-21 20:41:35.000000000 +0200 @@ -477,13 +477,13 @@ - sub titlepage ($) { #{{{ + sub titlepage ($) { my $title=shift; - $title=~s/([^-[:alnum:]:+\/.])/$1 eq ' ' ? '_' : "__".ord($1)."__"/eg; + $title=~s/([^-[:alnum:]+\/.])/$1 eq ' ' ? '_' : "__".ord($1)."__"/eg; return $title; - } #}}} + } - sub linkpage ($) { #{{{ + sub linkpage ($) { my $link=shift; - $link=~s/([^-[:alnum:]:+\/._])/$1 eq ' ' ? '_' : "__".ord($1)."__"/eg; + $link=~s/([^-[:alnum:]+\/._])/$1 eq ' ' ? '_' : "__".ord($1)."__"/eg; return $link; - } #}}} + } What do you think about that? Does the patch have any side-effects I didn't see? diff --git a/doc/bugs/Problem_with_toc.pm_plug-in.mdwn b/doc/bugs/Problem_with_toc.pm_plug-in.mdwn index 8ae347d42..6be5f89b5 100644 --- a/doc/bugs/Problem_with_toc.pm_plug-in.mdwn +++ b/doc/bugs/Problem_with_toc.pm_plug-in.mdwn @@ -9,7 +9,7 @@ Here is a patch for toc.pm for producing non-empty 'a' elements. --- IkiWiki/Plugin/toc.pm.orig Thu Jun 7 11:53:53 2007 +++ IkiWiki/Plugin/toc.pm Thu Jun 7 13:00:00 2007 - @@ -47,7 +47,7 @@ sub format (@) { #{{{ + @@ -47,7 +47,7 @@ sub format (@) { if ($tagname =~ /^h(\d+)$/i) { my $level=$1; my $anchor="index".++$anchors{$level}."h$level"; @@ -18,7 +18,7 @@ Here is a patch for toc.pm for producing non-empty 'a' elements. # Take the first header level seen as the topmost level, # even if there are higher levels seen later on. - @@ -90,6 +90,16 @@ sub format (@) { #{{{ + @@ -90,6 +90,16 @@ sub format (@) { "\n"; $p->handler(text => undef); }, "dtext"); diff --git a/doc/bugs/Problems_with_graphviz.pm_plug-in.mdwn b/doc/bugs/Problems_with_graphviz.pm_plug-in.mdwn index 9a26e505a..c9f698158 100644 --- a/doc/bugs/Problems_with_graphviz.pm_plug-in.mdwn +++ b/doc/bugs/Problems_with_graphviz.pm_plug-in.mdwn @@ -15,7 +15,7 @@ It also generates image URLs relative to the page being rendered, which means th --- IkiWiki/Plugin/graphviz.pm.orig 2007-07-27 11:35:05.000000000 +0200 +++ IkiWiki/Plugin/graphviz.pm 2007-07-27 11:36:02.000000000 +0200 - @@ -69,7 +69,12 @@ sub render_graph (\%) { #{{{ + @@ -69,7 +69,12 @@ sub render_graph (\%) { } } @@ -26,9 +26,9 @@ It also generates image URLs relative to the page being rendered, which means th + else { + return "\n"; + } - } #}}} + } - sub graph (@) { #{{{ + sub graph (@) { >> --[[HenrikBrixAndersen]] @@ -38,7 +38,7 @@ The patch below fixes these two issues. --- graphviz.pm.orig Thu Jun 7 15:45:16 2007 +++ graphviz.pm Fri Jun 8 12:03:38 2007 - @@ -41,7 +41,6 @@ sub render_graph (\%) { #{{{ + @@ -41,7 +41,6 @@ sub render_graph (\%) { $pid=open2(*IN, *OUT, "$params{prog} -Tpng"); # open2 doesn't respect "use open ':utf8'" @@ -46,7 +46,7 @@ The patch below fixes these two issues. binmode (OUT, ':utf8'); print OUT $src; - @@ -70,7 +69,12 @@ sub render_graph (\%) { #{{{ + @@ -70,7 +69,12 @@ sub render_graph (\%) { } } @@ -57,6 +57,6 @@ The patch below fixes these two issues. + else { + return "\n"; + } - } #}}} + } - sub graph (@) { #{{{ + sub graph (@) { diff --git a/doc/bugs/RecentChanges_broken_with_empty_svnpath.mdwn b/doc/bugs/RecentChanges_broken_with_empty_svnpath.mdwn index 836c39a71..c852df5e9 100644 --- a/doc/bugs/RecentChanges_broken_with_empty_svnpath.mdwn +++ b/doc/bugs/RecentChanges_broken_with_empty_svnpath.mdwn @@ -13,7 +13,7 @@ I can not see why this check is needed in the first place, so here's a patch for diff -upr ikiwiki-1.49.orig/IkiWiki/Rcs/svn.pm ikiwiki-1.49/IkiWiki/Rcs/svn.pm --- ikiwiki-1.49.orig/IkiWiki/Rcs/svn.pm Mon Apr 16 15:15:09 2007 +++ ikiwiki-1.49/IkiWiki/Rcs/svn.pm Mon Apr 16 15:15:47 2007 - @@ -176,7 +176,6 @@ sub rcs_recentchanges ($) { #{{{ + @@ -176,7 +176,6 @@ sub rcs_recentchanges ($) { } foreach (keys %{$logentry->{paths}}) { diff --git a/doc/bugs/Titles_are_lower-cased_when_creating_a_page.mdwn b/doc/bugs/Titles_are_lower-cased_when_creating_a_page.mdwn index cc53c0aea..f2c60309b 100644 --- a/doc/bugs/Titles_are_lower-cased_when_creating_a_page.mdwn +++ b/doc/bugs/Titles_are_lower-cased_when_creating_a_page.mdwn @@ -6,7 +6,7 @@ If I click on "Czars in Russia", I'd like Ikiwiki to create "Czars\_in\_Russia.m > --- a/IkiWiki.pm > +++ b/IkiWiki.pm -> @@ -584,7 +584,7 @@ sub htmllink ($$$;@) { #{{{ +> @@ -584,7 +584,7 @@ sub htmllink ($$$;@) { > return " cgiurl( > do => "create", diff --git a/doc/bugs/Warns_about_use_of_uninitialized_value_if_prefix__95__directives_is_on_and_a_directive_does_not_contain_a_space.mdwn b/doc/bugs/Warns_about_use_of_uninitialized_value_if_prefix__95__directives_is_on_and_a_directive_does_not_contain_a_space.mdwn index a30f110a4..efb5c70b8 100644 --- a/doc/bugs/Warns_about_use_of_uninitialized_value_if_prefix__95__directives_is_on_and_a_directive_does_not_contain_a_space.mdwn +++ b/doc/bugs/Warns_about_use_of_uninitialized_value_if_prefix__95__directives_is_on_and_a_directive_does_not_contain_a_space.mdwn @@ -6,7 +6,7 @@ In `IkiWiki::preprocess`, the last capturing group in the regex used to parse di index 241a7c0..d2c35a2 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm - @@ -1167,7 +1167,8 @@ sub preprocess ($$$;$$) { #{{{ + @@ -1167,7 +1167,8 @@ sub preprocess ($$$;$$) { }sx; } @@ -14,6 +14,6 @@ In `IkiWiki::preprocess`, the last capturing group in the regex used to parse di + # $4 can be undef if the directive was \[[!foo]] + $content =~ s{$regex}{$handle->($1, $2, $3, ($4 or ""))}eg; return $content; - } #}}} + } [[cherry-picked|done]] --[[Joey]] diff --git a/doc/bugs/bugfix_for:___34__mtn:_operation_canceled:_Broken_pipe__34_____40__patch__41__.mdwn b/doc/bugs/bugfix_for:___34__mtn:_operation_canceled:_Broken_pipe__34_____40__patch__41__.mdwn index aa13ec339..b7f38fd29 100644 --- a/doc/bugs/bugfix_for:___34__mtn:_operation_canceled:_Broken_pipe__34_____40__patch__41__.mdwn +++ b/doc/bugs/bugfix_for:___34__mtn:_operation_canceled:_Broken_pipe__34_____40__patch__41__.mdwn @@ -3,7 +3,7 @@ When using monotone as revision control system, a "mtn: operation canceled: Brok diff -up ikiwiki/IkiWiki/Plugin/monotone.pm.orig ikiwiki/IkiWiki/Plugin/monotone.pm --- ikiwiki/IkiWiki/Plugin/monotone.pm.orig 2008-11-12 23:45:24.000000000 +0100 +++ ikiwiki/IkiWiki/Plugin/monotone.pm 2008-12-16 12:41:38.000000000 +0100 - @@ -525,13 +525,12 @@ sub rcs_recentchanges ($) { #{{{ + @@ -525,13 +525,12 @@ sub rcs_recentchanges ($) { my $child = open(MTNLOG, "-|"); if (! $child) { exec("mtn", "log", "--root=$config{mtnrootdir}", "--no-graph", diff --git a/doc/bugs/git_stderr_output_causes_problems.mdwn b/doc/bugs/git_stderr_output_causes_problems.mdwn index 4146a5869..c25ef6927 100644 --- a/doc/bugs/git_stderr_output_causes_problems.mdwn +++ b/doc/bugs/git_stderr_output_causes_problems.mdwn @@ -6,7 +6,7 @@ Ikiwiki's git handling is sending a bunch of output to stderr. The following pa index 425536f..5734bb2 100644 --- a/IkiWiki/Rcs/git.pm +++ b/IkiWiki/Rcs/git.pm - @@ -24,6 +24,7 @@ sub _safe_git (&@) { #{{{ + @@ -24,6 +24,7 @@ sub _safe_git (&@) { if (!$pid) { # In child. # Git commands want to be in wc. diff --git a/doc/bugs/img_plugin_should_pass_through_class_attribute.mdwn b/doc/bugs/img_plugin_should_pass_through_class_attribute.mdwn index 2e67d6357..f72ecade2 100644 --- a/doc/bugs/img_plugin_should_pass_through_class_attribute.mdwn +++ b/doc/bugs/img_plugin_should_pass_through_class_attribute.mdwn @@ -26,7 +26,7 @@ And here's a patch to implement it. Will this survive markdown munging? It seems index 7226231..3eb1ae7 100644 --- a/Plugin/img.pm +++ b/Plugin/img.pm - @@ -93,9 +93,15 @@ sub preprocess (@) { #{{{ + @@ -93,9 +93,15 @@ sub preprocess (@) { $imgurl="$config{url}/$imglink"; } @@ -42,7 +42,7 @@ And here's a patch to implement it. Will this survive markdown munging? It seems + $result .= '/>'; + + return $result; - } #}}} + } 1 -- diff --git a/doc/bugs/inline_sort-by-title_issues.mdwn b/doc/bugs/inline_sort-by-title_issues.mdwn index 884846b32..ff4555067 100644 --- a/doc/bugs/inline_sort-by-title_issues.mdwn +++ b/doc/bugs/inline_sort-by-title_issues.mdwn @@ -23,7 +23,7 @@ And here is a [[patch]] for this. It makes `sort=title` actually sort on the ti index 9c336e7..99f6de3 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm - @@ -185,9 +185,12 @@ sub preprocess_inline (@) { #{{{ + @@ -185,9 +185,12 @@ sub preprocess_inline (@) { } } diff --git a/doc/bugs/mercurial_fail_to_add.mdwn b/doc/bugs/mercurial_fail_to_add.mdwn index dab40d684..3bbf4e5fd 100644 --- a/doc/bugs/mercurial_fail_to_add.mdwn +++ b/doc/bugs/mercurial_fail_to_add.mdwn @@ -6,7 +6,7 @@ Here is a patch that's seems to work, although I'm not quite sure what's wrong w --- mercurial.pm 2007-03-24 16:14:35.000000000 +0100 +++ /home/hbernard/mercurial.pm 2007-04-19 19:05:47.000000000 +0200 @@ -95,7 +95,7 @@ - sub rcs_add ($) { # {{{ + sub rcs_add ($) { my ($file) = @_; - my @cmdline = ("hg", "-q", "-R", "$config{srcdir}", "add", "$file"); diff --git a/doc/bugs/methodResponse_in_add__95__plugins.mdwn b/doc/bugs/methodResponse_in_add__95__plugins.mdwn index 8a88f4eda..c82b532db 100644 --- a/doc/bugs/methodResponse_in_add__95__plugins.mdwn +++ b/doc/bugs/methodResponse_in_add__95__plugins.mdwn @@ -26,7 +26,7 @@ index e476521..d43abd4 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm - @@ -471,7 +471,11 @@ sub loadplugins () { #{{{ + @@ -471,7 +471,11 @@ sub loadplugins () { unshift @INC, possibly_foolish_untaint($config{libdir}); } diff --git a/doc/bugs/multiple_pages_with_same_name.mdwn b/doc/bugs/multiple_pages_with_same_name.mdwn index 5ddfb1f6b..20c38c062 100644 --- a/doc/bugs/multiple_pages_with_same_name.mdwn +++ b/doc/bugs/multiple_pages_with_same_name.mdwn @@ -28,14 +28,14 @@ Suggestions welcome. index 4e4da11..853f905 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm - @@ -618,7 +618,7 @@ sub pagename ($) { #{{{ + @@ -618,7 +618,7 @@ sub pagename ($) { my $type=pagetype($file); my $page=$file; - $page=~s/\Q.$type\E*$// if defined $type; + $page=~s/\Q.$type\E*$// if defined $type && !$hooks{htmlize}{$type}{leavesuffix}; return $page; - } #}}} + } diff --git a/t/pagename.t b/t/pagename.t index 96e6a87..58811b9 100755 @@ -61,7 +61,7 @@ I wonder if this patch will also be useful: index 752d176..3f1b67b 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm - @@ -279,7 +279,11 @@ sub refresh () { #{{{ + @@ -279,7 +279,11 @@ sub refresh () { else { $f=~s/^\Q$config{srcdir}\E\/?//; push @files, $f; diff --git a/doc/bugs/pagespec_parsing_chokes_on_function__40____41__.mdwn b/doc/bugs/pagespec_parsing_chokes_on_function__40____41__.mdwn index a2eba694c..78fed0e5d 100644 --- a/doc/bugs/pagespec_parsing_chokes_on_function__40____41__.mdwn +++ b/doc/bugs/pagespec_parsing_chokes_on_function__40____41__.mdwn @@ -54,7 +54,7 @@ case the user is given to rebuilding the wiki by hand. --Ethan + } return IkiWiki::FailReason->new("syntax error") if $@; return $ret; - } #}}} + } > Thanks, [[done]] --[[Joey]] diff --git a/doc/bugs/prune_causing_taint_mode_failures.mdwn b/doc/bugs/prune_causing_taint_mode_failures.mdwn index 1876d9129..5fc1d8b75 100644 --- a/doc/bugs/prune_causing_taint_mode_failures.mdwn +++ b/doc/bugs/prune_causing_taint_mode_failures.mdwn @@ -11,7 +11,7 @@ I've no idea what's happening (hey, I'm a C programmer), but I've hacked prune()
 use Scalar::Util qw(tainted);
 
-sub prune ($) { #{{{
+sub prune ($) {
         my $file=shift;
 
         unlink($file);
@@ -25,7 +25,7 @@ sub prune ($) { #{{{
                         $dir = $1;
                 }
         }
-} #}}}
+}
 
> Old versions of perl are known to have bugs with taint checking. diff --git a/doc/bugs/quieten_mercurial.mdwn b/doc/bugs/quieten_mercurial.mdwn index 26f833e5f..3fd75ea1b 100644 --- a/doc/bugs/quieten_mercurial.mdwn +++ b/doc/bugs/quieten_mercurial.mdwn @@ -6,7 +6,7 @@ messages which are then taken for CGI output, causing errors and general trouble @@ -55,7 +55,7 @@ } - sub rcs_update () { #{{{ + sub rcs_update () { - my @cmdline = ("hg", "-R", "$config{srcdir}", "update"); + my @cmdline = ("hg", "-q", "-R", "$config{srcdir}", "update"); if (system(@cmdline) != 0) { @@ -22,7 +22,7 @@ messages which are then taken for CGI output, causing errors and general trouble if (system(@cmdline) != 0) { warn "'@cmdline' failed: $!"; @@ -92,7 +92,7 @@ - sub rcs_add ($) { # {{{ + sub rcs_add ($) { my ($file) = @_; - my @cmdline = ("hg", "-R", "$config{srcdir}", "add", "$file"); diff --git a/doc/bugs/search_for_locale_data_in_the_installed_location.mdwn b/doc/bugs/search_for_locale_data_in_the_installed_location.mdwn index 0a2b1efea..dace2ca19 100644 --- a/doc/bugs/search_for_locale_data_in_the_installed_location.mdwn +++ b/doc/bugs/search_for_locale_data_in_the_installed_location.mdwn @@ -2,7 +2,7 @@ It seems like gettext only searches for locale information in /usr/share/locale, --- a/IkiWiki.pm +++ b/IkiWiki.pm - @@ -1057,6 +1057,7 @@ sub gettext { #{{{ + @@ -1057,6 +1057,7 @@ sub gettext { $gettext_obj=undef; return shift; } diff --git a/doc/bugs/tbasewiki__95__brokenlinks.t_broken.mdwn b/doc/bugs/tbasewiki__95__brokenlinks.t_broken.mdwn index ac895896a..db3917d21 100644 --- a/doc/bugs/tbasewiki__95__brokenlinks.t_broken.mdwn +++ b/doc/bugs/tbasewiki__95__brokenlinks.t_broken.mdwn @@ -25,12 +25,12 @@ After some digging I found that HTML::Template is being required after the new s filter => sub { my $text_ref = shift; @@ -857,6 +856,7 @@ - } #}}} + } - sub template ($;@) { #{{{ + sub template ($;@) { + require HTML::Template; HTML::Template->new(template_params(@_)); - } #}}} + } **That** gave me: diff --git a/doc/plugins/contrib/headinganchors.mdwn b/doc/plugins/contrib/headinganchors.mdwn index ef2fa122a..c80cc0b49 100644 --- a/doc/plugins/contrib/headinganchors.mdwn +++ b/doc/plugins/contrib/headinganchors.mdwn @@ -12,9 +12,9 @@ rst and any other format that produces html. The code is available here: use strict; use IkiWiki 2.00; - sub import { #{{{ + sub import { hook(type => "sanitize", id => "headinganchors", call => \&headinganchors); - } # }}} + } sub text_to_anchor { my $str = shift; @@ -26,11 +26,11 @@ rst and any other format that produces html. The code is available here: return $str; } - sub headinganchors (@) { #{{{ + sub headinganchors (@) { my %params=@_; my $content=$params{content}; $content=~s{([^>]*)}{''.$2.''}gie; return $content; - } # }}} + } 1 diff --git a/doc/plugins/contrib/siterel2pagerel.mdwn b/doc/plugins/contrib/siterel2pagerel.mdwn index 956b6728f..9b09657bf 100644 --- a/doc/plugins/contrib/siterel2pagerel.mdwn +++ b/doc/plugins/contrib/siterel2pagerel.mdwn @@ -13,11 +13,11 @@ other format that produces html. The code is available here: use strict; use IkiWiki 2.00; - sub import { #{{{ + sub import { hook(type => "sanitize", id => "siterel2pagerel", call => \&siterel2pagerel); - } # }}} + } - sub siterel2pagerel (@) { #{{{ + sub siterel2pagerel (@) { my %params=@_; my $baseurl=IkiWiki::baseurl($params{page}); my $content=$params{content}; @@ -25,6 +25,6 @@ other format that produces html. The code is available here: $content=~s/( "getsetup", id => "unixauth", call => \&getsetup); hook(type => "formbuilder_setup", id => "unixauth", call => \&formbuilder_setup); hook(type => "formbuilder", id => "unixauth", call => \&formbuilder); hook(type => "sessioncgi", id => "unixauth", call => \&sessioncgi); - } # }}} + } - sub getsetup () { #{{{ + sub getsetup () { return unixauth_type => { type => "string", @@ -83,10 +83,10 @@ __Security__: [As with passwordauth](/security/#index14h2), be wary of sending u safe => 0, rebuild => 1, }, - } #}}} + } # Checks if a string matches a user's password, and returns true or false. - sub checkpassword ($$;$) { #{{{ + sub checkpassword ($$;$) { my $user=shift; my $password=shift; my $field=shift || "password"; @@ -131,9 +131,9 @@ __Security__: [As with passwordauth](/security/#index14h2), be wary of sending u } return $ret; - } #}}} + } - sub formbuilder_setup (@) { #{{{ + sub formbuilder_setup (@) { my %params=@_; my $form=$params{form}; @@ -204,7 +204,7 @@ __Security__: [As with passwordauth](/security/#index14h2), be wary of sending u } } - sub formbuilder (@) { #{{{ + sub formbuilder (@) { my %params=@_; my $form=$params{form}; @@ -225,12 +225,12 @@ __Security__: [As with passwordauth](/security/#index14h2), be wary of sending u my $user_name=$form->field('name'); } } - } #}}} + } - sub sessioncgi ($$) { #{{{ + sub sessioncgi ($$) { my $q=shift; my $session=shift; - } #}}} + } 1 diff --git a/doc/todo/Add_DATE_parameter_for_use_in_templates.mdwn b/doc/todo/Add_DATE_parameter_for_use_in_templates.mdwn index c908f57c8..8ecdf36d0 100644 --- a/doc/todo/Add_DATE_parameter_for_use_in_templates.mdwn +++ b/doc/todo/Add_DATE_parameter_for_use_in_templates.mdwn @@ -44,7 +44,7 @@ regenerate this one against that). %config %links %renderedfiles %pagesources %destsources); our $VERSION = 2.00; # plugin interface version, next is ikiwiki version our $version="2.1";my $installdir="/usr"; - @@ -70,6 +70,7 @@ sub defaultconfig () { #{{{ + @@ -70,6 +70,7 @@ sub defaultconfig () { plugin => [qw{mdwn inline htmlscrubber passwordauth openid signinedit lockedit conditional}], timeformat => '%c', @@ -52,27 +52,27 @@ regenerate this one against that). locale => undef, sslcookie => 0, httpauth => 0, - @@ -447,6 +448,15 @@ sub displaytime ($) { #{{{ + @@ -447,6 +448,15 @@ sub displaytime ($) { $config{timeformat}, localtime($time))); - } #}}} + } - +sub displaydate ($) { #{{{ + +sub displaydate ($) { + my $time=shift; + + # strftime doesn't know about encodings, so make sure + # its output is properly treated as utf8 + return decode_utf8(POSIX::strftime( + $config{dateformat}, localtime($time))); - +} #}}} + +} + - sub beautify_url ($) { #{{{ + sub beautify_url ($) { my $url=shift; diff --git a/Plugin/inline.pm b/Plugin/inline.pm index 8f6ab51..7bd6147 100644 --- a/Plugin/inline.pm +++ b/Plugin/inline.pm - @@ -148,6 +148,7 @@ sub preprocess_inline (@) { #{{{ + @@ -148,6 +148,7 @@ sub preprocess_inline (@) { $template->param(pageurl => urlto(bestlink($params{page}, $page), $params{destpage})); $template->param(title => pagetitle(basename($page))); $template->param(ctime => displaytime($pagectime{$page})); diff --git a/doc/todo/Add_support_for_latest_Text::Markdown_as_found_on_CPAN.mdwn b/doc/todo/Add_support_for_latest_Text::Markdown_as_found_on_CPAN.mdwn index 222cd8c46..6b9fa0535 100644 --- a/doc/todo/Add_support_for_latest_Text::Markdown_as_found_on_CPAN.mdwn +++ b/doc/todo/Add_support_for_latest_Text::Markdown_as_found_on_CPAN.mdwn @@ -12,7 +12,7 @@ This patch allows IkiWiki to work with either of the two: --- IkiWiki/Plugin/mdwn.pm.orig 2008-03-08 11:33:50.000000000 +0100 +++ IkiWiki/Plugin/mdwn.pm 2008-03-08 13:37:21.000000000 +0100 - @@ -28,14 +28,20 @@ sub htmlize (@) { #{{{ + @@ -28,14 +28,20 @@ sub htmlize (@) { $markdown_sub=\&Markdown::Markdown; } else { diff --git a/doc/todo/Allow_change_of_wiki_file_types.mdwn b/doc/todo/Allow_change_of_wiki_file_types.mdwn index 8a398f2e0..19574b175 100644 --- a/doc/todo/Allow_change_of_wiki_file_types.mdwn +++ b/doc/todo/Allow_change_of_wiki_file_types.mdwn @@ -12,7 +12,7 @@ I was hoping that the [[plugins/rename]] plugin would allow web uses to change t index 527ee88..123b772 100644 --- a/IkiWiki/Plugin/rename.pm +++ b/IkiWiki/Plugin/rename.pm - @@ -43,7 +43,7 @@ sub check_canrename ($$$$$$$) { #{{{ + @@ -43,7 +43,7 @@ sub check_canrename ($$$$$$$) { # Dest checks can be omitted by passing undef. if (defined $dest) { @@ -21,7 +21,7 @@ I was hoping that the [[plugins/rename]] plugin would allow web uses to change t error(gettext("no change to the file name was specified")); } - @@ -54,7 +54,7 @@ sub check_canrename ($$$$$$$) { #{{{ + @@ -54,7 +54,7 @@ sub check_canrename ($$$$$$$) { } # Must not be a known source file. @@ -30,7 +30,7 @@ I was hoping that the [[plugins/rename]] plugin would allow web uses to change t error(sprintf(gettext("%s already exists"), htmllink("", "", $dest, noimageinline => 1))); } - @@ -97,6 +97,24 @@ sub rename_form ($$$) { #{{{ + @@ -97,6 +97,24 @@ sub rename_form ($$$) { $f->field(name => "do", type => "hidden", value => "rename", force => 1); $f->field(name => "page", type => "hidden", value => $page, force => 1); $f->field(name => "new_name", value => IkiWiki::pagetitle($page), size => 60); @@ -55,7 +55,7 @@ I was hoping that the [[plugins/rename]] plugin would allow web uses to change t $f->field(name => "attachment", type => "hidden"); return $f, ["Rename", "Cancel"]; - @@ -223,12 +241,19 @@ sub sessioncgi ($$) { #{{{ + @@ -223,12 +241,19 @@ sub sessioncgi ($$) { my $dest=IkiWiki::possibly_foolish_untaint(IkiWiki::titlepage($q->param("new_name"))); # The extension of dest is the same as src if it's diff --git a/doc/todo/Allow_edittemplate_to_set_file_type.mdwn b/doc/todo/Allow_edittemplate_to_set_file_type.mdwn index b49968c18..1b99a4e05 100644 --- a/doc/todo/Allow_edittemplate_to_set_file_type.mdwn +++ b/doc/todo/Allow_edittemplate_to_set_file_type.mdwn @@ -14,7 +14,7 @@ edittemplate there. --[[Joey]] index 98308de..c381940 100644 --- a/IkiWiki/Plugin/edittemplate.pm +++ b/IkiWiki/Plugin/edittemplate.pm - @@ -56,8 +56,14 @@ sub preprocess (@) { #{{{ + @@ -56,8 +56,14 @@ sub preprocess (@) { $pagestate{$params{page}}{edittemplate}{$params{match}}=$params{template}; @@ -28,10 +28,10 @@ edittemplate there. --[[Joey]] + + return sprintf(gettext("edittemplate: %s registered for %s"), + $linkHTML, $params{match}); - } # }}} + } - sub formbuilder (@) { #{{{ - @@ -89,6 +95,9 @@ sub formbuilder (@) { #{{{ + sub formbuilder (@) { + @@ -89,6 +95,9 @@ sub formbuilder (@) { if (pagespec_match($p, $pagespec, location => $registering_page)) { $form->field(name => "editcontent", value => filltemplate($pagestate{$registering_page}{edittemplate}{$pagespec}, $page)); diff --git a/doc/todo/Bestdir_along_with_bestlink_in_IkiWiki.pm.mdwn b/doc/todo/Bestdir_along_with_bestlink_in_IkiWiki.pm.mdwn index 73157a326..95c38f794 100644 --- a/doc/todo/Bestdir_along_with_bestlink_in_IkiWiki.pm.mdwn +++ b/doc/todo/Bestdir_along_with_bestlink_in_IkiWiki.pm.mdwn @@ -8,9 +8,9 @@ This patch adds function bestdir() which returns best directory from the directo +++ IkiWiki.pm (working copy) @@ -391,6 +391,35 @@ return ""; - } #}}} + } - +sub bestdir ($$) { #{{{ + +sub bestdir ($$) { + my $page=shift; + my $link=shift; + my $cwd=$page; @@ -37,9 +37,9 @@ This patch adds function bestdir() which returns best directory from the directo + } + + return ""; - +} #}}} + +} + - sub isinlinableimage ($) { #{{{ + sub isinlinableimage ($) { my $file=shift; ---- diff --git a/doc/todo/Default_text_for_new_pages.mdwn b/doc/todo/Default_text_for_new_pages.mdwn index 4a17bbf8b..a904f8287 100644 --- a/doc/todo/Default_text_for_new_pages.mdwn +++ b/doc/todo/Default_text_for_new_pages.mdwn @@ -15,7 +15,7 @@ Inline below is a [[patch]] that implements this: index bb21ed2..10c985c 100644 --- a/IkiWiki/Plugin/editpage.pm +++ b/IkiWiki/Plugin/editpage.pm - @@ -60,7 +60,7 @@ sub cgi_editpage ($$) { #{{{ + @@ -60,7 +60,7 @@ sub cgi_editpage ($$) { decode_cgi_utf8($q); @@ -24,7 +24,7 @@ Inline below is a [[patch]] that implements this: my @buttons=("Save Page", "Preview", "Cancel"); eval q{use CGI::FormBuilder}; error($@) if $@; - @@ -117,9 +117,20 @@ sub cgi_editpage ($$) { #{{{ + @@ -117,9 +117,20 @@ sub cgi_editpage ($$) { } else { $type=$form->param('type'); @@ -45,7 +45,7 @@ Inline below is a [[patch]] that implements this: elsif (defined $from && exists $pagesources{$from}) { # favor the type of linking page $type=pagetype($pagesources{$from}); - @@ -129,7 +140,7 @@ sub cgi_editpage ($$) { #{{{ + @@ -129,7 +140,7 @@ sub cgi_editpage ($$) { if (! $form->submitted) { $form->field(name => "rcsinfo", value => "", force => 1); } @@ -58,7 +58,7 @@ Inline below is a [[patch]] that implements this: index 8efef3f..075d7d8 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm - @@ -271,6 +271,7 @@ sub preprocess_inline (@) { #{{{ + @@ -271,6 +271,7 @@ sub preprocess_inline (@) { $rootpage=$params{page}; } $formtemplate->param(rootpage => $rootpage); diff --git a/doc/todo/Give_access_to_more_TMPL__95__VAR_variables_in_templates_inserted_by_the_template_plugin.mdwn b/doc/todo/Give_access_to_more_TMPL__95__VAR_variables_in_templates_inserted_by_the_template_plugin.mdwn index a644e236b..c71250b3a 100644 --- a/doc/todo/Give_access_to_more_TMPL__95__VAR_variables_in_templates_inserted_by_the_template_plugin.mdwn +++ b/doc/todo/Give_access_to_more_TMPL__95__VAR_variables_in_templates_inserted_by_the_template_plugin.mdwn @@ -94,7 +94,7 @@ most possible of these pages. > index a6e34fc..bb9dd8d 100644 > --- a/IkiWiki/Plugin/template.pm > +++ b/IkiWiki/Plugin/template.pm -> @@ -57,6 +57,8 @@ sub preprocess (@) { #{{{ +> @@ -57,6 +57,8 @@ sub preprocess (@) { > } > } > diff --git a/doc/todo/Inline_plugin_option_to_show_full_page_path.mdwn b/doc/todo/Inline_plugin_option_to_show_full_page_path.mdwn index 9f52a724a..691694009 100644 --- a/doc/todo/Inline_plugin_option_to_show_full_page_path.mdwn +++ b/doc/todo/Inline_plugin_option_to_show_full_page_path.mdwn @@ -19,7 +19,7 @@ Cheers, index 59eabb6..82913ba 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm - @@ -229,6 +229,7 @@ sub preprocess_inline (@) { #{{{ + @@ -229,6 +229,7 @@ sub preprocess_inline (@) { $template->param(content => $content); } $template->param(pageurl => urlto(bestlink($params{page}, $page), $params{destpage})); diff --git a/doc/todo/Move_teximg_latex_preamble_to_config_file.mdwn b/doc/todo/Move_teximg_latex_preamble_to_config_file.mdwn index d94d24ee4..3cedd5ae3 100644 --- a/doc/todo/Move_teximg_latex_preamble_to_config_file.mdwn +++ b/doc/todo/Move_teximg_latex_preamble_to_config_file.mdwn @@ -71,10 +71,10 @@ Happy TeXing. + +my $default_postfix = '\\end{document}'; + - sub import { #{{{ + sub import { hook(type => "getsetup", id => "teximg", call => \&getsetup); hook(type => "preprocess", id => "teximg", call => \&preprocess); - @@ -21,6 +33,26 @@ sub getsetup () { #{{{ + @@ -21,6 +33,26 @@ sub getsetup () { safe => 1, rebuild => undef, }, @@ -98,10 +98,10 @@ Happy TeXing. + safe => 0, # Not sure how secure LaTeX is... + rebuild => 1, + }, - } #}}} + } - sub preprocess (@) { #{{{ - @@ -105,25 +137,35 @@ sub gen_image ($$$$) { #{{{ + sub preprocess (@) { + @@ -105,25 +137,35 @@ sub gen_image ($$$$) { my $digest = shift; my $imagedir = shift; diff --git a/doc/todo/Set_arbitrary_date_to_be_used_by_calendar_plugin.mdwn b/doc/todo/Set_arbitrary_date_to_be_used_by_calendar_plugin.mdwn index a26433919..89167c084 100644 --- a/doc/todo/Set_arbitrary_date_to_be_used_by_calendar_plugin.mdwn +++ b/doc/todo/Set_arbitrary_date_to_be_used_by_calendar_plugin.mdwn @@ -42,13 +42,13 @@ Longer term plans: my %cache; my %linkcache; @@ -32,6 +34,7 @@ - sub import { #{{{ + sub import { hook(type => "needsbuild", id => "version", call => \&needsbuild); hook(type => "preprocess", id => "calendar", call => \&preprocess); + hook(type => "preprocess", id => "event", call => \&preprocess_event); - } #}}} + } - sub is_leap_year (@) { #{{{ + sub is_leap_year (@) { @@ -58,6 +61,7 @@ my $nmonth = $params{nmonth}; my $pyear = $params{pyear}; @@ -137,9 +137,9 @@ Longer term plans: # finish off the week @@ -304,6 +333,18 @@ return $calendar; - } #}}} + } - +sub preprocess_event (@) { #{{{ + +sub preprocess_event (@) { + my %params=@_; + # if now time is given, use now + $params{begin} = localtime($time) unless defined $params{begin}; @@ -151,7 +151,7 @@ Longer term plans: + return ""; +} #}} + - sub preprocess (@) { #{{{ + sub preprocess (@) { my %params=@_; $params{pages} = "*" unless defined $params{pages}; @@ -311,6 +352,8 @@ diff --git a/doc/todo/Silence_monotone_warning.mdwn b/doc/todo/Silence_monotone_warning.mdwn index e3f0224c2..d875900c5 100644 --- a/doc/todo/Silence_monotone_warning.mdwn +++ b/doc/todo/Silence_monotone_warning.mdwn @@ -4,7 +4,7 @@ A quick [[patch]] to silence a [[rcs/monotone]] warning I started seeing: index 4b9be31..9d4e280 100644 --- a/IkiWiki/Plugin/monotone.pm +++ b/IkiWiki/Plugin/monotone.pm - @@ -55,7 +55,7 @@ sub checkconfig () { #{{{ + @@ -55,7 +55,7 @@ sub checkconfig () { error("Monotone version too old, is $version but required 0.38"); } diff --git a/doc/todo/Support_wildcard_inside_of_link__40____41___within_a_pagespec.mdwn b/doc/todo/Support_wildcard_inside_of_link__40____41___within_a_pagespec.mdwn index 2837634d9..8320f72a6 100644 --- a/doc/todo/Support_wildcard_inside_of_link__40____41___within_a_pagespec.mdwn +++ b/doc/todo/Support_wildcard_inside_of_link__40____41___within_a_pagespec.mdwn @@ -20,7 +20,7 @@ That doesn't work in ikiwiki 2.1, but I have it index 38aa46a..cd42e8d 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm - @@ -1082,10 +1082,15 @@ sub match_link ($$;@) { #{{{ + @@ -1082,10 +1082,15 @@ sub match_link ($$;@) { my $links = $IkiWiki::links{$page} or return undef; return IkiWiki::FailReason->new("$page has no links") unless @$links; my $bestlink = IkiWiki::bestlink($from, $link); @@ -38,7 +38,7 @@ That doesn't work in ikiwiki 2.1, but I have it + } } return IkiWiki::FailReason->new("$page does not link to $link"); - } #}}} + } -- 1.5.1.1.g6aead diff --git a/doc/todo/Wrapper_config_with_multiline_regexp.mdwn b/doc/todo/Wrapper_config_with_multiline_regexp.mdwn index c0311bc92..7b4323de1 100644 --- a/doc/todo/Wrapper_config_with_multiline_regexp.mdwn +++ b/doc/todo/Wrapper_config_with_multiline_regexp.mdwn @@ -13,12 +13,12 @@ Second, the untainting of $configstring should allow newlines. +++ wiki-meta/perl/IkiWiki.pm Mon Jun 11 10:52:07 2007 @@ -205,7 +205,7 @@ - sub possibly_foolish_untaint ($) { #{{{ + sub possibly_foolish_untaint ($) { my $tainted=shift; - my ($untainted)=$tainted=~/(.*)/; + my ($untainted)=$tainted=~/(.*)/s; return $untainted; - } #}}} + } Modified: wiki-meta/perl/IkiWiki/Wrapper.pm diff --git a/doc/todo/add_forward_age_sorting_option_to_inline.mdwn b/doc/todo/add_forward_age_sorting_option_to_inline.mdwn index 684419f90..e91c5a42f 100644 --- a/doc/todo/add_forward_age_sorting_option_to_inline.mdwn +++ b/doc/todo/add_forward_age_sorting_option_to_inline.mdwn @@ -19,7 +19,7 @@ diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index d2e5832..9e52712 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm -@@ -194,6 +194,9 @@ sub preprocess_inline (@) { #{{{ +@@ -194,6 +194,9 @@ sub preprocess_inline (@) { elsif (! exists $params{sort} || $params{sort} eq 'age') { @list=sort { $pagectime{$b} <=> $pagectime{$a} } @list; } diff --git a/doc/todo/automatic_use_of_syntax_plugin_on_source_code_files/discussion.mdwn b/doc/todo/automatic_use_of_syntax_plugin_on_source_code_files/discussion.mdwn index 467ec350e..dc6c0001e 100644 --- a/doc/todo/automatic_use_of_syntax_plugin_on_source_code_files/discussion.mdwn +++ b/doc/todo/automatic_use_of_syntax_plugin_on_source_code_files/discussion.mdwn @@ -17,13 +17,13 @@ Updated to use fix noted in [[bugs/multiple_pages_with_same_name]]. my %metaheaders; - sub import { #{{{ + sub import { hook(type => "getsetup", id => "sourcecode", call => \&getsetup); hook(type => "checkconfig", id => "sourcecode", call => \&checkconfig); hook(type => "pagetemplate", id => "sourcecode", call => \&pagetemplate); - } # }}} + } - sub getsetup () { #{{{ + sub getsetup () { return plugin => { safe => 1, @@ -57,9 +57,9 @@ Updated to use fix noted in [[bugs/multiple_pages_with_same_name]]. safe => 1, rebuild => 1, }, - } #}}} + } - sub checkconfig () { #{{{ + sub checkconfig () { if (! $config{sourcecode_lang}) { error("The sourcecode plugin requires a list of suffixes in the 'sourcecode_lang' config option"); } @@ -97,9 +97,9 @@ Updated to use fix noted in [[bugs/multiple_pages_with_same_name]]. error("Your installation of source-highlight cannot handle sourcecode language $lang!"); } } - } #}}} + } - sub htmlize (@) { #{{{ + sub htmlize (@) { my %params=@_; my $page = $params{page}; @@ -141,9 +141,9 @@ Updated to use fix noted in [[bugs/multiple_pages_with_same_name]]. } return '
'."\r\n".join("\r\n",@html)."\r\n
\n"; - } # }}} + } - sub pagetemplate (@) { #{{{ + sub pagetemplate (@) { my %params=@_; my $page=$params{page}; @@ -154,6 +154,6 @@ Updated to use fix noted in [[bugs/multiple_pages_with_same_name]]. my %seen; $template->param(meta => join("\n", grep { (! $seen{$_}) && ($seen{$_}=1) } @{$metaheaders{$page}})); } - } # }}} + } 1 diff --git a/doc/todo/blogpost_plugin.mdwn b/doc/todo/blogpost_plugin.mdwn index 60b1e2515..bb91ffd02 100644 --- a/doc/todo/blogpost_plugin.mdwn +++ b/doc/todo/blogpost_plugin.mdwn @@ -51,13 +51,13 @@ Index: IkiWiki/Plugin/blogpost.pm +use POSIX; +use IkiWiki 2.00; + -+sub import { #{{{ ++sub import { + hook(type => "checkconfig", id => "blogpost", call => \&checkconfig); + hook(type => "authcgi", id => "blogpost", call => \&authcgi); + hook(type => "canedit", id => "blogpost", call => \&canedit); -+} # }}} ++} + -+sub checkconfig () { #{{{ ++sub checkconfig () { + if (! defined $config{blogformat}){ + $config{blogformat} = 'posts/%Y/%m/%d/$title'; + } @@ -72,9 +72,9 @@ Index: IkiWiki/Plugin/blogpost.pm + if (! defined $config{blogusers}) { + $config{blogusers} = (); # disallow all posting by default + } -+} #}}} ++} + -+sub authcgi ($$) { #{{{ ++sub authcgi ($$) { + my $cgi=shift; + my $session=shift; + @@ -115,16 +115,16 @@ Index: IkiWiki/Plugin/blogpost.pm + $cgi->param("page", $page); + } + -+} #}}} ++} + -+sub blogpage ($) { #{{{ ++sub blogpage ($) { + my $title=shift; + my $page=POSIX::strftime $config{blogformat}, localtime; + $page =~ s/\$title/$title/; + return $page; -+} #}}} ++} + -+sub canedit ($$$) { #{{{ ++sub canedit ($$$) { + my $page=shift; + my $cgi=shift; + my $session=shift; @@ -136,7 +136,7 @@ Index: IkiWiki/Plugin/blogpost.pm + return "" if ($config{blogusers} eq "*" || + grep {$_ eq $user} $config{blogusers}); + return ("not allowed to blog, $user"); -+} #}}} ++} + +1 Index: IkiWiki.pm diff --git a/doc/todo/bzr.mdwn b/doc/todo/bzr.mdwn index 179ea2f24..a50c58d26 100644 --- a/doc/todo/bzr.mdwn +++ b/doc/todo/bzr.mdwn @@ -56,15 +56,15 @@ and rcs_getctime and rcs_notify aren't written at all. --[[bma]] return @ret; } - sub rcs_update () { #{{{ + sub rcs_update () { # Not needed. - } #}}} + } - sub rcs_prepedit ($) { #{{{ + sub rcs_prepedit ($) { return ""; - } #}}} + } - sub rcs_commit ($$$;$$) { #{{{ + sub rcs_commit ($$$;$$) { my ($file, $message, $rcstoken, $user, $ipaddr) = @_; if (defined $user) { @@ -95,18 +95,18 @@ and rcs_getctime and rcs_notify aren't written at all. --[[bma]] system("bzr","whoami",$olduser); return undef; # success - } #}}} + } - sub rcs_add ($) { # {{{ + sub rcs_add ($) { my ($file) = @_; my @cmdline = ("bzr", "add", "--quiet", "$config{srcdir}/$file"); if (system(@cmdline) != 0) { warn "'@cmdline' failed: $!"; } - } #}}} + } - sub rcs_recentchanges ($) { #{{{ + sub rcs_recentchanges ($) { my ($num) = @_; eval q{use CGI 'escapeHTML'}; @@ -153,15 +153,15 @@ and rcs_getctime and rcs_notify aren't written at all. --[[bma]] } return @ret; - } #}}} + } - sub rcs_notify () { #{{{ + sub rcs_notify () { # TODO - } #}}} + } - sub rcs_getctime ($) { #{{{ + sub rcs_getctime ($) { # TODO - } #}}} + } 1 diff --git a/doc/todo/cas_authentication.mdwn b/doc/todo/cas_authentication.mdwn index c8ffe7005..8bf7042df 100644 --- a/doc/todo/cas_authentication.mdwn +++ b/doc/todo/cas_authentication.mdwn @@ -43,11 +43,11 @@ follows) ? > the use of it: `eval q{use AuthCAS}; error $@ if $@` + - +sub import { #{{{ + +sub import { + hook(type => "getopt", id => "cas", call => \&getopt); + hook(type => "auth", id => "cas", call => \&auth); + hook(type => "formbuilder_setup", id => "cas", call => \&formbuilder_setup); - +} # }}} + +} > Could you please use tabs for indentation of program flow? @@ -61,15 +61,15 @@ follows) ? > Why would you want to make other auth plugins not work? Could a site not > legitimatly chose to use this and another auth method? - +sub getopt () { #{{{ + +sub getopt () { + eval q{use Getopt::Long}; + error($@) if $@; + Getopt::Long::Configure('pass_through'); + GetOptions("cas_url=s" => \$config{cas_url}); + GetOptions("ca_file=s" => \$config{ca_file}); - +} #}}} + +} + - +sub auth ($$) { #{{{ + +sub auth ($$) { + my $q=shift; + my $session=shift; + @@ -98,11 +98,11 @@ follows) ? + error("CAS failure: ".&AuthCAS::get_errors()); + } + } - +} #}}} + +} + +# I use formbuilder_setup and not formbuilder type in order to bypass the +# Logout processing done in IkiWiki::CGI::cgi_prefs() - +sub formbuilder_setup (@) { #{{{ + +sub formbuilder_setup (@) { + my %params=@_; + + my $form=$params{form}; diff --git a/doc/todo/color_plugin.mdwn b/doc/todo/color_plugin.mdwn index 69afe837d..19fba3b35 100644 --- a/doc/todo/color_plugin.mdwn +++ b/doc/todo/color_plugin.mdwn @@ -132,12 +132,12 @@ Of course, I'm open for discussion or exchange of ideas :) --[[Paweł|ptecza]] +use strict; +use IkiWiki 2.00; + - +sub import { #{{{ + +sub import { + hook(type => "preprocess", id => "color", call => \&preprocess); + hook(type => "format", id => "color", call => \&format); - +} #}}} + +} + - +sub preserve_style ($$$) { #{{{ + +sub preserve_style ($$$) { + my $foreground = shift; + my $background = shift; + my $text = shift; @@ -162,18 +162,18 @@ Of course, I'm open for discussion or exchange of ideas :) --[[Paweł|ptecza]] + + return $preserved; + - +} #}}} + +} + - +sub replace_preserved_style ($) { #{{{ + +sub replace_preserved_style ($) { + my $content = shift; + + $content =~ s!((color: ([a-z]+|\#[0-9a-f]{3,6})?)?((; )?(background-color: ([a-z]+|\#[0-9a-f]{3,6})?)?)?)!!g; + $content =~ s!!!g; + + return $content; - +} #}}} + +} + - +sub preprocess (@) { #{{{ + +sub preprocess (@) { + my %params = @_; + + # Preprocess the text to expand any preprocessor directives @@ -182,14 +182,14 @@ Of course, I'm open for discussion or exchange of ideas :) --[[Paweł|ptecza]] + IkiWiki::filter($params{page}, $params{destpage}, $params{text})); + + return preserve_style($params{foreground}, $params{background}, $params{text}); - +} #}}} + +} + - +sub format (@) { #{{{ + +sub format (@) { + my %params = @_; + + $params{content} = replace_preserved_style($params{content}); + return $params{content}; - +} #}}} + +} + +1 --- /dev/null 2008-06-21 02:02:15.000000000 +0200 diff --git a/doc/todo/darcs.mdwn b/doc/todo/darcs.mdwn index e5bf5ee27..882a41379 100644 --- a/doc/todo/darcs.mdwn +++ b/doc/todo/darcs.mdwn @@ -219,14 +219,14 @@ This is my ([bma](bma@bmalee.eu)) darcs.pm - it's messy (my Perl isn't up to muc package IkiWiki; - sub rcs_update () { #{{{ + sub rcs_update () { # Do nothing - there's nowhere to update *from*. - } #}}} + } - sub rcs_prepedit ($) { #{{{ - } #}}} + sub rcs_prepedit ($) { + } - sub rcs_commit ($$$;$$) { #{{{ + sub rcs_commit ($$$;$$) { my ($file, $message, $rcstoken, $user, $ipaddr) = @_; # $user should probably be a name and an email address, by darcs @@ -257,16 +257,16 @@ This is my ([bma](bma@bmalee.eu)) darcs.pm - it's messy (my Perl isn't up to muc return undef; # success - sub rcs_add ($) { # {{{ + sub rcs_add ($) { my ($file) = @_; my @cmdline = ("darcs", "add", "--repodir", "$config{srcdir}", "-a", "-q", "$file"); if (system(@cmdline) != 0) { warn "'@cmdline' failed: $!"; } - } #}}} + } - sub rcs_recentchanges ($) { #{{{ + sub rcs_recentchanges ($) { # TODO: This is horrible code. It doesn't work perfectly, and uses regexes # rather than parsing Darcs' XML output. my $num=shift; @@ -314,15 +314,15 @@ This is my ([bma](bma@bmalee.eu)) darcs.pm - it's messy (my Perl isn't up to muc } } return @ret; - } #}}} + } - sub rcs_notify () { #{{{ + sub rcs_notify () { # TODO - } #}}} + } - sub rcs_getctime ($) { #{{{ + sub rcs_getctime ($) { error gettext("getctime not implemented"); - } #}}} + } 1 diff --git a/doc/todo/datearchives-plugin.mdwn b/doc/todo/datearchives-plugin.mdwn index 5a5560d6c..5f33cde4c 100644 --- a/doc/todo/datearchives-plugin.mdwn +++ b/doc/todo/datearchives-plugin.mdwn @@ -17,11 +17,11 @@ Index: IkiWiki/Plugin/datearchives.pm +use strict; +use IkiWiki; + -+sub import { #{{{ ++sub import { + hook(type => "pagetemplate", id => "datearchives", call => \&pagetemplate, scan => 1); -+} # }}} ++} + -+sub pagetemplate (@) { #{{{ ++sub pagetemplate (@) { + my %args = @_; + my $dt; + eval { @@ -37,7 +37,7 @@ Index: IkiWiki/Plugin/datearchives.pm + $template->param(ctime => htmllink( $args{page}, $args{destpage}, $link, 0, 0, + $template->param('ctime'))); + } -+} # }}} ++} + +1 diff --git a/doc/todo/different_search_engine.mdwn b/doc/todo/different_search_engine.mdwn index 2f309dea5..9d0fc92c9 100644 --- a/doc/todo/different_search_engine.mdwn +++ b/doc/todo/different_search_engine.mdwn @@ -126,7 +126,7 @@ Index: IkiWiki/Plugin/search.pm + $PLUCENE_DIR = $config{wikistatedir}.'/plucene'; +} + - sub import { #{{{ + sub import { - hook(type => "getopt", id => "hyperestraier", - call => \&getopt); - hook(type => "checkconfig", id => "hyperestraier", @@ -142,14 +142,14 @@ Index: IkiWiki/Plugin/search.pm call => \&change); - hook(type => "cgi", id => "hyperestraier", - call => \&cgi); - } # }}} + } --sub getopt () { #{{{ +-sub getopt () { - eval q{use Getopt::Long}; - error($@) if $@; - Getopt::Long::Configure('pass_through'); - GetOptions("estseek=s" => \$config{estseek}); --} #}}} +-} +sub writer { + init(); @@ -165,20 +165,20 @@ Index: IkiWiki/Plugin/search.pm + grep { defined pagetype($_) } @_; +} + - sub checkconfig () { #{{{ + sub checkconfig () { foreach my $required (qw(url cgiurl)) { if (! length $config{$required}) { @@ -36,112 +58,55 @@ } - } #}}} + } -my $form; --sub pagetemplate (@) { #{{{ +-sub pagetemplate (@) { - my %params=@_; - my $page=$params{page}; - my $template=$params{template}; +#my $form; -+#sub pagetemplate (@) { #{{{ ++#sub pagetemplate (@) { +# my %params=@_; +# my $page=$params{page}; +# my $template=$params{template}; @@ -193,7 +193,7 @@ Index: IkiWiki/Plugin/search.pm +# +# $template->param(searchform => $form); +# } -+#} #}}} ++#} - # Add search box to page header. - if ($template->query(name => "searchform")) { @@ -205,9 +205,9 @@ Index: IkiWiki/Plugin/search.pm - - $template->param(searchform => $form); - } --} #}}} +-} - - sub delete (@) { #{{{ + sub delete (@) { - debug(gettext("cleaning hyperestraier search index")); - estcmd("purge -cl"); - estcfg(); @@ -219,9 +219,9 @@ Index: IkiWiki/Plugin/search.pm + $reader->delete_term( Plucene::Index::Term->new({ field => "id", text => $_ })); + } + $reader->close; - } #}}} + } - sub change (@) { #{{{ + sub change (@) { - debug(gettext("updating hyperestraier search index")); - estcmd("gather -cm -bc -cl -sd", - map { @@ -250,9 +250,9 @@ Index: IkiWiki/Plugin/search.pm + $doc->add(Plucene::Document::Field->UnStored('text' => $data)); + $writer->add_document($doc); + } - } #}}} + } - --sub cgi ($) { #{{{ +-sub cgi ($) { - my $cgi=shift; - - if (defined $cgi->param('phrase') || defined $cgi->param("navi")) { @@ -260,10 +260,10 @@ Index: IkiWiki/Plugin/search.pm - chdir("$config{wikistatedir}/hyperestraier") || error("chdir: $!"); - exec("./".IkiWiki::basename($config{cgiurl})) || error("estseek.cgi failed"); - } --} #}}} +-} - -my $configured=0; --sub estcfg () { #{{{ +-sub estcfg () { - return if $configured; - $configured=1; - @@ -301,9 +301,9 @@ Index: IkiWiki/Plugin/search.pm - unlink($cgi); - my $estseek = defined $config{estseek} ? $config{estseek} : '/usr/lib/estraier/estseek.cgi'; - symlink($estseek, $cgi) || error("symlink $estseek $cgi: $!"); --} # }}} +-} - --sub estcmd ($;@) { #{{{ +-sub estcmd ($;@) { - my @params=split(' ', shift); - push @params, "-cl", "$config{wikistatedir}/hyperestraier"; - if (@_) { @@ -323,7 +323,7 @@ Index: IkiWiki/Plugin/search.pm - open(STDOUT, "/dev/null"); # shut it up (closing won't work) - exec("estcmd", @params) || error("can't run estcmd"); - } --} #}}} +-} - -1 +1; diff --git a/doc/todo/directive_docs.mdwn b/doc/todo/directive_docs.mdwn index 1f6307381..2baa61b40 100644 --- a/doc/todo/directive_docs.mdwn +++ b/doc/todo/directive_docs.mdwn @@ -40,15 +40,15 @@ defined them: --[[Joey]] index e476521..afe982a 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm - @@ -493,6 +493,7 @@ sub loadplugins () { #{{{ + @@ -493,6 +493,7 @@ sub loadplugins () { return 1; - } #}}} + } +my $loading_plugin; - sub loadplugin ($) { #{{{ + sub loadplugin ($) { my $plugin=shift; - @@ -502,14 +503,18 @@ sub loadplugin ($) { #{{{ + @@ -502,14 +503,18 @@ sub loadplugin ($) { "$installdir/lib/ikiwiki") { if (defined $dir && -x "$dir/plugins/$plugin") { require IkiWiki::Plugin::external; @@ -67,7 +67,7 @@ defined them: --[[Joey]] if ($@) { error("Failed to load plugin $mod: $@"); } - @@ -1429,6 +1434,9 @@ sub hook (@) { # {{{ + @@ -1429,6 +1434,9 @@ sub hook (@) { return if $param{no_override} && exists $hooks{$param{type}}{$param{id}}; @@ -76,4 +76,4 @@ defined them: --[[Joey]] + $hooks{$param{type}}{$param{id}}=\%param; return 1; - } # }}} + } diff --git a/doc/todo/enable-htaccess-files.mdwn b/doc/todo/enable-htaccess-files.mdwn index b3c174fba..e3b295123 100644 --- a/doc/todo/enable-htaccess-files.mdwn +++ b/doc/todo/enable-htaccess-files.mdwn @@ -5,7 +5,7 @@ @@ -26,7 +26,7 @@ memoize("file_pruned"); - sub defaultconfig () { #{{{ + sub defaultconfig () { - wiki_file_prune_regexps => [qr/\.\./, qr/^\./, qr/\/\./, + wiki_file_prune_regexps => [qr/\.\./, qr/^\.(?!htaccess)/, qr/\/\.(?!htaccess)/, qr/\.x?html?$/, qr/\.ikiwiki-new$/, diff --git a/doc/todo/format_escape.mdwn b/doc/todo/format_escape.mdwn index 8dfe05581..574883d1b 100644 --- a/doc/todo/format_escape.mdwn +++ b/doc/todo/format_escape.mdwn @@ -141,13 +141,13 @@ Index: IkiWiki/Plugin/rst.pm print html[html.find('')+6:html.find('')].strip(); "; - sub import { #{{{ + sub import { hook(type => "htmlize", id => "rst", call => \&htmlize); + hook(type => "htmlescape", id => "rst", call => \&htmlescape); + hook(type => "htmlescapelink", id => "rst", call => \&htmlescapelink); - } # }}} + } -+sub htmlescapelink ($$;@) { #{{{ ++sub htmlescapelink ($$;@) { + my $url = shift; + my $text = shift; + my %params = @_; @@ -158,15 +158,15 @@ Index: IkiWiki/Plugin/rst.pm + else { + return "`$text <$url>`_"; + } -+} # }}} ++} + -+sub htmlescape ($) { #{{{ ++sub htmlescape ($) { + my $html=shift; + $html=~s/^/ /mg; + return ".. raw:: html\n\n".$html; -+} # }}} ++} + - sub htmlize (@) { #{{{ + sub htmlize (@) { my %params=@_; my $content=$params{content}; Index: doc/plugins/write.mdwn @@ -272,7 +272,7 @@ Index: IkiWiki.pm + return $hooks{htmlescapelink}{$type}{call}->($bestlink, $linktext); + } return "$linktext"; - } #}}} + } @@ -628,6 +640,14 @@ preview => $preprocess_preview, diff --git a/doc/todo/fortune:_select_options_via_environment.mdwn b/doc/todo/fortune:_select_options_via_environment.mdwn index f906312fe..ddacd91b5 100644 --- a/doc/todo/fortune:_select_options_via_environment.mdwn +++ b/doc/todo/fortune:_select_options_via_environment.mdwn @@ -14,9 +14,9 @@ package IkiWiki::Plugin::fortune; use warnings; - @@ -12,7 +18,13 @@ sub import { #{{{ + @@ -12,7 +18,13 @@ sub import { - sub preprocess (@) { #{{{ + sub preprocess (@) { $ENV{PATH}="$ENV{PATH}:/usr/games:/usr/local/games"; - my $f = `fortune 2>/dev/null`; + my $f; diff --git a/doc/todo/index.html_allowed.mdwn b/doc/todo/index.html_allowed.mdwn index f030f9eea..f5e6f8cd7 100644 --- a/doc/todo/index.html_allowed.mdwn +++ b/doc/todo/index.html_allowed.mdwn @@ -91,15 +91,15 @@ page "A/B/index.html" is treated as "A/B". +++ ikidev/IkiWiki.pm 2007-02-25 15:05:22.328852000 -0800 @@ -192,6 +192,12 @@ return $untainted; - } #}}} + } - +sub titlename($;@) { #{{{ + +sub titlename($;@) { + my $page = shift; + $page =~ s!/index$!!; + return pagetitle(basename($page), @_); - +} #}}} + +} + - sub basename ($) { #{{{ + sub basename ($) { my $file=shift; @@ -117,7 +117,7 @@ diff -ru ikiwiki-2.4/IkiWiki.pm ikiwiki/IkiWiki.pm $page=~s/\Q.$type\E*$// if defined $type; + $page=~s/\/index$// if $page =~ /\/index$/; return $page; - } #}}} + } diff --git a/doc/todo/inline:_numerical_ordering_by_title.mdwn b/doc/todo/inline:_numerical_ordering_by_title.mdwn index 95511d998..3f6c8b598 100644 --- a/doc/todo/inline:_numerical_ordering_by_title.mdwn +++ b/doc/todo/inline:_numerical_ordering_by_title.mdwn @@ -155,11 +155,11 @@ Joey, have you forgotten about that request? ;) --[[Paweł|ptecza]] %config %links %pagestate %renderedfiles %pagesources %destsources); our $VERSION = 2.00; # plugin interface version, next is ikiwiki version - @@ -835,6 +835,42 @@ sub titlepage ($) { #{{{ + @@ -835,6 +835,42 @@ sub titlepage ($) { return $title; - } #}}} + } - +sub titlecmp ($$) { #{{{ + +sub titlecmp ($$) { + my $titleA=shift; + my $titleB=shift; + @@ -193,29 +193,29 @@ Joey, have you forgotten about that request? ;) --[[Paweł|ptecza]] + return -1 if (@listB); + + return 0; - +} #}}} + +} + - sub linkpage ($) { #{{{ + sub linkpage ($) { my $link=shift; my $chars = defined $config{wiki_file_chars} ? $config{wiki_file_chars} : "-[:alnum:]+/.:_"; diff --git a/IkiWiki/Plugin/brokenlinks.pm b/IkiWiki/Plugin/brokenlinks.pm index 37752dd..ccaa399 100644 --- a/IkiWiki/Plugin/brokenlinks.pm +++ b/IkiWiki/Plugin/brokenlinks.pm - @@ -59,7 +59,7 @@ sub preprocess (@) { #{{{ + @@ -59,7 +59,7 @@ sub preprocess (@) { map { "
  • $_
  • " } - sort @broken) + sort titlecmp @broken) ."\n"; - } # }}} + } diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 8efef3f..263e7a6 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm - @@ -192,7 +192,7 @@ sub preprocess_inline (@) { #{{{ + @@ -192,7 +192,7 @@ sub preprocess_inline (@) { } if (exists $params{sort} && $params{sort} eq 'title') { @@ -228,20 +228,20 @@ Joey, have you forgotten about that request? ;) --[[Paweł|ptecza]] index b910758..10a1d87 100644 --- a/IkiWiki/Plugin/orphans.pm +++ b/IkiWiki/Plugin/orphans.pm - @@ -56,7 +56,7 @@ sub preprocess (@) { #{{{ + @@ -56,7 +56,7 @@ sub preprocess (@) { htmllink($params{page}, $params{destpage}, $_, noimageinline => 1). "" - } sort @orphans). + } sort titlecmp @orphans). "\n"; - } # }}} + } diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index ceb7c84..00798e1 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm - @@ -89,7 +89,7 @@ sub genpage ($$) { #{{{ + @@ -89,7 +89,7 @@ sub genpage ($$) { $template->param(have_actions => 1); } diff --git a/doc/todo/language_definition_for_the_meta_plugin.mdwn b/doc/todo/language_definition_for_the_meta_plugin.mdwn index 33098c601..4ac4e2e25 100644 --- a/doc/todo/language_definition_for_the_meta_plugin.mdwn +++ b/doc/todo/language_definition_for_the_meta_plugin.mdwn @@ -54,7 +54,7 @@ This may be useful for sites with a few pages in different languages, but no ful my %authorurl; +my %lang; - sub import { #{{{ + sub import { hook(type => "preprocess", id => "meta", call => \&preprocess, scan => 1); @@ -100,6 +101,11 @@ $meta{$page}.=' > Please resolve lang somewhere reusable rather than within meta plugin: It is certainly usable outside diff --git a/doc/todo/meta_rcsid.mdwn b/doc/todo/meta_rcsid.mdwn index 81a2c1328..158edea6e 100644 --- a/doc/todo/meta_rcsid.mdwn +++ b/doc/todo/meta_rcsid.mdwn @@ -26,7 +26,7 @@ of CVS/SVN-style keywords (like '$Id$', etc.) from the source file in the page t my %copyright; +my %rcsid; - sub import { #{{{ + sub import { hook(type => "preprocess", id => "meta", call => \&preprocess, scan => 1); @@ -110,6 +111,9 @@ $meta{$page}.="\n"; diff --git a/doc/todo/missingparents.pm.mdwn b/doc/todo/missingparents.pm.mdwn index 0cc7137ba..c5f2ab535 100644 --- a/doc/todo/missingparents.pm.mdwn +++ b/doc/todo/missingparents.pm.mdwn @@ -82,15 +82,15 @@ Index: IkiWiki/Plugin/missingparents.pm +my %ownfiles; +my @pagespecs; + -+sub import { #{{{ ++sub import { + hook(type => "checkconfig", id => "missingparents", call => \&checkconfig); + hook(type => "needsdelete", id => "missingparents", call => \&needsdelete); + hook(type => "needsbuild", id => "missingparents", call => \&needsbuild); + hook(type => "savestate", id => "missingparents", call => \&savestate); + hook(type => "preprocess", id => "missingparents", call => \&preprocess_missingparents); -+} # }}} ++} + -+sub checkconfig () { #{{{ ++sub checkconfig () { + IkiWiki::preprocess("missingparents", "missingparents", + readfile(srcfile("missingparents.mdwn"))); + loadstate(); @@ -99,9 +99,9 @@ Index: IkiWiki/Plugin/missingparents.pm + unlink $config{srcdir}.'/'.$file; + } + } -+} #}}} ++} + -+sub preprocess_missingparents (@) { #{{{ ++sub preprocess_missingparents (@) { + my %params=@_; + + if (! defined $params{pages} || ! defined $params{generate}) { @@ -115,10 +115,10 @@ Index: IkiWiki/Plugin/missingparents.pm + #translators: is text for pages that match that pagespec. + return sprintf(gettext("missingparents in %s will be %s"), + '`'.$params{pages}.'`', '`\\'.$params{generate}.'`'); -+} # }}} ++} + +my $state_loaded=0; -+sub loadstate() { #{{{ ++sub loadstate() { + my $filename = "$config{wikistatedir}/missingparents"; + if (-e $filename) { + open (IN, $filename) || @@ -132,9 +132,9 @@ Index: IkiWiki/Plugin/missingparents.pm + + $state_loaded=1; + } -+} #}}} ++} + -+sub savestate() { #{{{ ++sub savestate() { + my $filename = "$config{wikistatedir}/missingparents.new"; + my $cleanup = sub { unlink ($filename) }; + open (OUT, ">$filename") || error("open $filename: $!", $cleanup); @@ -143,9 +143,9 @@ Index: IkiWiki/Plugin/missingparents.pm + } + rename($filename, "$config{wikistatedir}/missingparents") || + error("rename $filename: $!", $cleanup); -+} #}}} ++} + -+sub needsdelete (@) { #{{{ ++sub needsdelete (@) { + my $files=shift; + + my @mydel; @@ -167,9 +167,9 @@ Index: IkiWiki/Plugin/missingparents.pm + foreach my $page (@mydel){ + push @{$files}, $page; + } -+} #}}} ++} + -+sub check_matches($) { #{{{ ++sub check_matches($) { + my $page = shift; + return if $IkiWiki::pagesources{$page}; + @@ -183,9 +183,9 @@ Index: IkiWiki/Plugin/missingparents.pm + return $output; + } + return ""; -+} #}}} ++} + -+sub needsbuild ($) { #{{{ ++sub needsbuild ($) { + my $files=shift; + my @new; + @@ -209,7 +209,7 @@ Index: IkiWiki/Plugin/missingparents.pm + $ownfiles{$file} = 1; + push @{$files}, $file; + } -+} #}}} ++} + +1 Index: IkiWiki.pm @@ -227,18 +227,18 @@ Index: IkiWiki.pm our $version='unknown'; # VERSION_AUTOREPLACE done by Makefile, DNE @@ -330,6 +336,30 @@ error("failed renaming $newfile to $destdir/$file: $!", $cleanup); - } #}}} + } -+sub newpage($$) { #{{{ ++sub newpage($$) { + my $file=shift; + my $page=shift; + + $pagemtime{$page} = $pagectime{$page} = time; + $pagesources{$page} = $file; + $pagecase{lc $page} = $page; -+} #}}} ++} + -+sub delpage($) { #{{{ ++sub delpage($) { + my $page=shift; + $links{$page}=[]; + $renderedfiles{$page}=[]; @@ -251,10 +251,10 @@ Index: IkiWiki.pm + delete $destsources{$_}; + } + } -+} #}}} ++} + my %cleared; - sub will_render ($$;$) { #{{{ + sub will_render ($$;$) { my $page=shift; diff --git a/doc/todo/modify_page_filename_in_plugin.mdwn b/doc/todo/modify_page_filename_in_plugin.mdwn index 7c0a909eb..4099487a1 100644 --- a/doc/todo/modify_page_filename_in_plugin.mdwn +++ b/doc/todo/modify_page_filename_in_plugin.mdwn @@ -10,7 +10,7 @@ My solution is to allow plugins to provide a hook that sets the pagename. --[[/u +++ /usr/share/perl5/IkiWiki.pm 2008-10-07 11:57:26.000000000 -0400 @@ -196,11 +196,32 @@ - sub pagename ($) { #{{{ + sub pagename ($) { my $file=shift; my $type=pagetype($file); @@ -27,7 +27,7 @@ My solution is to allow plugins to provide a hook that sets the pagename. --[[/u $page=~s/\Q.$type\E*$// if defined $type; return $page; + } - } #}}} + } - sub htmlpage ($) { #{{{ + sub htmlpage ($) { diff --git a/doc/todo/pagespec_relative_to_a_target.mdwn b/doc/todo/pagespec_relative_to_a_target.mdwn index f7b248670..4757988e0 100644 --- a/doc/todo/pagespec_relative_to_a_target.mdwn +++ b/doc/todo/pagespec_relative_to_a_target.mdwn @@ -57,7 +57,7 @@ diff -urNX ignorepats ikiwiki/IkiWiki/Plugin/relative.pm ikidev/IkiWiki/Plugin/r + +package IkiWiki::PageSpec; + -+sub match_relative($$;@) { #{{{ ++sub match_relative($$;@) { + my $parent = shift; + my $spec = shift; + my %params = @_; @@ -69,21 +69,21 @@ diff -urNX ignorepats ikiwiki/IkiWiki/Plugin/relative.pm ikidev/IkiWiki/Plugin/r + } + } + return IkiWiki::FailReason->new("$parent can't match $spec against anything"); -+} #}}} ++} + -+sub match_has_child($$;@) { #{{{ ++sub match_has_child($$;@) { + my $page = shift; + my $childname = shift; + my $spec; -+ if ($childname) { #{{{ ++ if ($childname) { + $spec = "$page/$childname or $page/*/$childname"; -+ } #}}} -+ else { #{{{ ++ } ++ else { + $spec = "$page/*"; -+ } #}}} ++ } + + return match_relative($page, $spec, @_); -+} #}}} ++} + +1 diff --git a/doc/todo/provide_sha1_for_git_diffurl.mdwn b/doc/todo/provide_sha1_for_git_diffurl.mdwn index 9c8b340de..01aa512f8 100644 --- a/doc/todo/provide_sha1_for_git_diffurl.mdwn +++ b/doc/todo/provide_sha1_for_git_diffurl.mdwn @@ -10,7 +10,7 @@ diffurls of the following form: index 5bef928..164210d 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm - @@ -518,6 +518,7 @@ sub rcs_recentchanges ($) { #{{{ + @@ -518,6 +518,7 @@ sub rcs_recentchanges ($) { my $diffurl = defined $config{'diffurl'} ? $config{'diffurl'} : ""; $diffurl =~ s/\[\[file\]\]/$file/go; diff --git a/doc/todo/require_CAPTCHA_to_edit.mdwn b/doc/todo/require_CAPTCHA_to_edit.mdwn index 110b4167f..83ba07eb0 100644 --- a/doc/todo/require_CAPTCHA_to_edit.mdwn +++ b/doc/todo/require_CAPTCHA_to_edit.mdwn @@ -91,15 +91,15 @@ ignored. --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm -@@ -18,6 +18,7 @@ sub getopt () { #{{{ +@@ -18,6 +18,7 @@ sub getopt () { error($@) if $@; Getopt::Long::Configure('pass_through'); GetOptions("openidsignup=s" => \$config{openidsignup}); + GetOptions("openidneedscaptcha=s" => \$config{openidneedscaptcha}); - } #}}} + } - sub formbuilder_setup (@) { #{{{ -@@ -61,6 +62,7 @@ sub formbuilder_setup (@) { #{{{ + sub formbuilder_setup (@) { +@@ -61,6 +62,7 @@ sub formbuilder_setup (@) { # Skip all other required fields in this case. foreach my $field ($form->field) { next if $field eq "openid_url"; @@ -107,7 +107,7 @@ ignored. $form->field(name => $field, required => 0, validate => '/.*/'); } -@@ -96,6 +98,18 @@ sub validate ($$$;$) { #{{{ +@@ -96,6 +98,18 @@ sub validate ($$$;$) { } } @@ -152,19 +152,19 @@ use warnings; use strict; use IkiWiki 2.00; -sub import { #{{{ +sub import { hook(type => "formbuilder_setup", id => "recaptcha", call => \&formbuilder_setup); -} # }}} +} -sub getopt () { #{{{ +sub getopt () { eval q{use Getopt::Long}; error($@) if $@; Getopt::Long::Configure('pass_through'); GetOptions("reCaptchaPubKey=s" => \$config{reCaptchaPubKey}); GetOptions("reCaptchaPrivKey=s" => \$config{reCaptchaPrivKey}); -} #}}} +} -sub formbuilder_setup (@) { #{{{ +sub formbuilder_setup (@) { my %params=@_; my $form=$params{form}; @@ -274,7 +274,7 @@ EOTAGS }); } } -} # }}} +} # The following function is borrowed from # Captcha::reCAPTCHA by Andy Armstrong and are under the PERL Artistic License diff --git a/doc/todo/source_link.mdwn b/doc/todo/source_link.mdwn index 5d6cb89e8..b051361a8 100644 --- a/doc/todo/source_link.mdwn +++ b/doc/todo/source_link.mdwn @@ -31,13 +31,13 @@ I just implemented this. There is one [[patch]] to the default page template, a use IkiWiki; use open qw{:utf8 :std}; - sub import { #{{{ + sub import { hook(type => "getsetup", id => "getsource", call => \&getsetup); hook(type => "pagetemplate", id => "getsource", call => \&pagetemplate); hook(type => "sessioncgi", id => "getsource", call => \&cgi_getsource); - } # }}} + } - sub getsetup () { #{{{ + sub getsetup () { return plugin => { safe => 1, @@ -50,9 +50,9 @@ I just implemented this. There is one [[patch]] to the default page template, a safe => 1, rebuild => 0, }, - } #}}} + } - sub pagetemplate (@) { #{{{ + sub pagetemplate (@) { my %params=@_; my $page=$params{page}; @@ -62,9 +62,9 @@ I just implemented this. There is one [[patch]] to the default page template, a $template->param(getsourceurl => IkiWiki::cgiurl(do => "getsource", page => $page)); $template->param(have_actions => 1); } - } # }}} + } - sub cgi_getsource ($$) { #{{{ + sub cgi_getsource ($$) { my $cgi=shift; my $session=shift; diff --git a/doc/todo/structured_page_data.mdwn b/doc/todo/structured_page_data.mdwn index 2a196ed23..22f67cc0a 100644 --- a/doc/todo/structured_page_data.mdwn +++ b/doc/todo/structured_page_data.mdwn @@ -257,21 +257,21 @@ in a large number of other cases. use CGI::FormBuilder; use IkiWiki 2.00; - sub import { #{{{ + sub import { hook(type => "getsetup", id => "form", call => \&getsetup); hook(type => "htmlize", id => "form", call => \&htmlize); hook(type => "sessioncgi", id => "form", call => \&cgi_submit); - } # }}} + } - sub getsetup () { #{{{ + sub getsetup () { return plugin => { safe => 1, rebuild => 1, # format plugin }, - } #}}} + } - sub makeFormFromYAML ($$$) { #{{{ + sub makeFormFromYAML ($$$) { my $page = shift; my $YAMLString = shift; my $q = shift; @@ -350,9 +350,9 @@ in a large number of other cases. # IkiWiki::decode_form_utf8($form); return $form; - } #}}} + } - sub htmlize (@) { #{{{ + sub htmlize (@) { my %params=@_; my $content = $params{content}; my $page = $params{page}; @@ -360,9 +360,9 @@ in a large number of other cases. my $form = makeFormFromYAML($page, $content, undef); return $form->render(submit => 'Update Form'); - } # }}} + } - sub cgi_submit ($$) { #{{{ + sub cgi_submit ($$) { my $q=shift; my $session=shift; @@ -425,11 +425,11 @@ in a large number of other cases. } exit; - } #}}} + } package IkiWiki::PageSpec; - sub match_form_eq ($$;@) { #{{{ + sub match_form_eq ($$;@) { my $page=shift; my $argSet=shift; my @args=split(/,/, $argSet); @@ -460,7 +460,7 @@ in a large number of other cases. } else { return IkiWiki::FailReason->new("field value does not match"); } - } #}}} + } 1 @@ -476,22 +476,22 @@ in a large number of other cases. my $inTable = 0; - sub import { #{{{ + sub import { hook(type => "getsetup", id => "data", call => \&getsetup); hook(type => "needsbuild", id => "data", call => \&needsbuild); hook(type => "preprocess", id => "data", call => \&preprocess, scan => 1); hook(type => "preprocess", id => "datatable", call => \&preprocess_table, scan => 1); # does this need scan? - } # }}} + } - sub getsetup () { #{{{ + sub getsetup () { return plugin => { safe => 1, rebuild => 1, # format plugin }, - } #}}} + } - sub needsbuild (@) { #{{{ + sub needsbuild (@) { my $needsbuild=shift; foreach my $page (keys %pagestate) { if (exists $pagestate{$page}{data}) { @@ -506,7 +506,7 @@ in a large number of other cases. } } - sub preprocess (@) { #{{{ + sub preprocess (@) { my @argslist = @_; my %params=@argslist; @@ -546,9 +546,9 @@ in a large number of other cases. } return $html; - } # }}} + } - sub preprocess_table (@) { #{{{ + sub preprocess_table (@) { my %params=@_; my @lines; @@ -568,11 +568,11 @@ in a large number of other cases. push @lines, ''; return join("\n", @lines); - } #}}} + } package IkiWiki::PageSpec; - sub match_data_eq ($$;@) { #{{{ + sub match_data_eq ($$;@) { my $page=shift; my $argSet=shift; my @args=split(/,/, $argSet); @@ -592,9 +592,9 @@ in a large number of other cases. } else { return IkiWiki::FailReason->new("value does not match"); } - } #}}} + } - sub match_data_link ($$;@) { #{{{ + sub match_data_link ($$;@) { my $page=shift; my $argSet=shift; my @params=@_; @@ -618,6 +618,6 @@ in a large number of other cases. } return IkiWiki::FailReason->new("No data link on page $page with key $key matches glob $value"); - } #}}} + } 1 diff --git a/doc/todo/supporting_comments_via_disussion_pages.mdwn b/doc/todo/supporting_comments_via_disussion_pages.mdwn index 892db18a9..aae0b3008 100644 --- a/doc/todo/supporting_comments_via_disussion_pages.mdwn +++ b/doc/todo/supporting_comments_via_disussion_pages.mdwn @@ -91,14 +91,14 @@ Each comment is processed to something like this: use strict; use IkiWiki '1.02'; - sub import { #{{{ + sub import { hook(type => "formbuilder_setup", id => "comments", call => \&formbuilder_setup); hook(type => "preprocess", id => "blogcomment", call => \&preprocess); - } # }}} + } - sub formbuilder_setup (@) { #{{{ + sub formbuilder_setup (@) { my %params=@_; my $cgi = $params{cgi}; my $form = $params{form}; @@ -138,9 +138,9 @@ Each comment is processed to something like this: $content.=qq{[[!blogcomment from="""$name""" timestamp="""$timestamp""" subject="""$subject""" text="""$comment"""]]\n\n}; $content=~s/\n/\r\n/g; $form->field(name => "editcontent", value => $content, force => 1); - } # }}} + } - sub preprocess (@) { #{{{ + sub preprocess (@) { my %params=@_; my ($text, $date, $from, $subject, $r); @@ -159,7 +159,7 @@ Each comment is processed to something like this: $r .= "\n" . $text . "
    \n"; return $r; - } # }}} + } 1; diff --git a/doc/todo/syntax_highlighting.mdwn b/doc/todo/syntax_highlighting.mdwn index 2bdeb62be..3de3032b3 100644 --- a/doc/todo/syntax_highlighting.mdwn +++ b/doc/todo/syntax_highlighting.mdwn @@ -90,7 +90,7 @@ like this: index 8d728c9..1bd46a9 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm - @@ -618,6 +618,8 @@ sub pagetype ($) { #{{{ + @@ -618,6 +618,8 @@ sub pagetype ($) { if ($page =~ /\.([^.]+)$/) { return $1 if exists $hooks{htmlize}{$1}; @@ -98,7 +98,7 @@ like this: + return $page; } return; - } #}}} + } ## format directive diff --git a/doc/todo/tidy_git__39__s_ctime_debug_output.mdwn b/doc/todo/tidy_git__39__s_ctime_debug_output.mdwn index aaa040ec7..bfc130d69 100644 --- a/doc/todo/tidy_git__39__s_ctime_debug_output.mdwn +++ b/doc/todo/tidy_git__39__s_ctime_debug_output.mdwn @@ -10,6 +10,6 @@ + debug("ctime for '$file': ". localtime($ctime)); return $ctime; - } #}}} + } [[!tag patch done]] diff --git a/doc/todo/tmplvars_plugin.mdwn b/doc/todo/tmplvars_plugin.mdwn index f7d06a579..644cf23aa 100644 --- a/doc/todo/tmplvars_plugin.mdwn +++ b/doc/todo/tmplvars_plugin.mdwn @@ -11,12 +11,12 @@ A simple plugin to allow per-page customization of a template by passing paramat my %tmplvars; - sub import { #{{{ + sub import { hook(type => "preprocess", id => "tmplvars", call => \&preprocess); hook(type => "pagetemplate", id => "tmplvars", call => \&pagetemplate); - } # }}} + } - sub preprocess (@) { #{{{ + sub preprocess (@) { my %params=@_; if ($params{page} eq $params{destpage}) { @@ -34,9 +34,9 @@ A simple plugin to allow per-page customization of a template by passing paramat } } - } # }}} + } - sub pagetemplate (@) { #{{{ + sub pagetemplate (@) { my %params=@_; my $template = $params{template}; @@ -47,6 +47,6 @@ A simple plugin to allow per-page customization of a template by passing paramat } return undef; - } # }}} + } 1 diff --git a/doc/todo/tracking_bugs_with_dependencies.mdwn b/doc/todo/tracking_bugs_with_dependencies.mdwn index 3af0458bd..2832e37aa 100644 --- a/doc/todo/tracking_bugs_with_dependencies.mdwn +++ b/doc/todo/tracking_bugs_with_dependencies.mdwn @@ -194,9 +194,9 @@ account all comments above (which doesn't mean it is above reproach :) ). --[[W index 4e4da11..8b3cdfe 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm - @@ -1550,7 +1550,16 @@ sub globlist_to_pagespec ($) { #{{{ + @@ -1550,7 +1550,16 @@ sub globlist_to_pagespec ($) { - sub is_globlist ($) { #{{{ + sub is_globlist ($) { my $s=shift; - return ( $s =~ /[^\s]+\s+([^\s]+)/ && $1 ne "and" && $1 ne "or" ); + return ! ($s =~ / @@ -209,19 +209,19 @@ account all comments above (which doesn't mean it is above reproach :) ). --[[W + ) | + (\s and \s) | (\s or \s) # or we find 'and' or 'or' somewhere + /xs); - } #}}} + } - sub safequote ($) { #{{{ - @@ -1631,7 +1640,7 @@ sub pagespec_merge ($$) { #{{{ + sub safequote ($) { + @@ -1631,7 +1640,7 @@ sub pagespec_merge ($$) { return "($a) or ($b)"; - } #}}} + } - -sub pagespec_translate ($) { #{{{ - +sub pagespec_makeperl ($) { #{{{ + -sub pagespec_translate ($) { + +sub pagespec_makeperl ($) { my $spec=shift; # Support for old-style GlobLists. - @@ -1650,12 +1659,14 @@ sub pagespec_translate ($) { #{{{ + @@ -1650,12 +1659,14 @@ sub pagespec_translate ($) { | \) # ) | @@ -238,7 +238,7 @@ account all comments above (which doesn't mean it is above reproach :) ). --[[W my $word=$1; if (lc $word eq 'and') { $code.=' &&'; - @@ -1666,16 +1677,23 @@ sub pagespec_translate ($) { #{{{ + @@ -1666,16 +1677,23 @@ sub pagespec_translate ($) { elsif ($word eq "(" || $word eq ")" || $word eq "!") { $code.=' '.$word; } @@ -265,14 +265,14 @@ account all comments above (which doesn't mean it is above reproach :) ). --[[W } } - @@ -1683,8 +1701,18 @@ sub pagespec_translate ($) { #{{{ + @@ -1683,8 +1701,18 @@ sub pagespec_translate ($) { $code=0; } + return 'sub { my $page=shift; my %params = @_; '.$code.' }'; - +} #}}} + +} + - +sub pagespec_translate ($) { #{{{ + +sub pagespec_translate ($) { + my $spec=shift; + + my $code = pagespec_makeperl($spec); @@ -282,19 +282,19 @@ account all comments above (which doesn't mean it is above reproach :) ). --[[W no warnings; - return eval 'sub { my $page=shift; '.$code.' }'; + return eval $code; - } #}}} + } - sub pagespec_match ($$;@) { #{{{ - @@ -1699,7 +1727,7 @@ sub pagespec_match ($$;@) { #{{{ + sub pagespec_match ($$;@) { + @@ -1699,7 +1727,7 @@ sub pagespec_match ($$;@) { my $sub=pagespec_translate($spec); return IkiWiki::FailReason->new("syntax error in pagespec \"$spec\"") if $@; - return $sub->($page, @params); + return $sub->($page, @params, specFuncs => {}); - } #}}} + } - sub pagespec_valid ($) { #{{{ - @@ -1748,11 +1776,78 @@ sub new { #{{{ + sub pagespec_valid ($) { + @@ -1748,11 +1776,78 @@ sub new { package IkiWiki::PageSpec; @@ -361,7 +361,7 @@ account all comments above (which doesn't mean it is above reproach :) ). --[[W + } +} + - sub match_glob ($$;@) { #{{{ + sub match_glob ($$;@) { my $page=shift; my $glob=shift; my %params=@_; @@ -373,9 +373,9 @@ account all comments above (which doesn't mean it is above reproach :) ). --[[W my $from=exists $params{location} ? $params{location} : ''; # relative matching - @@ -1782,11 +1877,12 @@ sub match_internal ($$;@) { #{{{ + @@ -1782,11 +1877,12 @@ sub match_internal ($$;@) { - sub match_link ($$;@) { #{{{ + sub match_link ($$;@) { my $page=shift; - my $link=lc(shift); + my $fulllink=shift; @@ -388,7 +388,7 @@ account all comments above (which doesn't mean it is above reproach :) ). --[[W # relative matching if ($link =~ m!^\.! && defined $from) { $from=~s#/?[^/]+$##; - @@ -1804,19 +1900,32 @@ sub match_link ($$;@) { #{{{ + @@ -1804,19 +1900,32 @@ sub match_link ($$;@) { } else { return IkiWiki::SuccessReason->new("$page links to page $p matching $link") @@ -397,9 +397,9 @@ account all comments above (which doesn't mean it is above reproach :) ). --[[W } } return IkiWiki::FailReason->new("$page does not link to $link"); - } #}}} + } - sub match_backlink ($$;@) { #{{{ + sub match_backlink ($$;@) { - return match_link($_[1], $_[0], @_); + my $page=shift; + my $backlink=shift; @@ -410,9 +410,9 @@ account all comments above (which doesn't mean it is above reproach :) ). --[[W + } + + return match_link($backlink, $page, @params); - } #}}} + } - sub match_created_before ($$;@) { #{{{ + sub match_created_before ($$;@) { my $page=shift; my $testpage=shift; + my @params=@_; @@ -423,8 +423,8 @@ account all comments above (which doesn't mean it is above reproach :) ). --[[W if (exists $IkiWiki::pagectime{$testpage}) { if ($IkiWiki::pagectime{$page} < $IkiWiki::pagectime{$testpage}) { - @@ -1834,6 +1943,11 @@ sub match_created_before ($$;@) { #{{{ - sub match_created_after ($$;@) { #{{{ + @@ -1834,6 +1943,11 @@ sub match_created_before ($$;@) { + sub match_created_after ($$;@) { my $page=shift; my $testpage=shift; + my @params=@_; diff --git a/doc/todo/turn_edittemplate_verbosity_off_by_default.mdwn b/doc/todo/turn_edittemplate_verbosity_off_by_default.mdwn index 87e55685c..14bb43782 100644 --- a/doc/todo/turn_edittemplate_verbosity_off_by_default.mdwn +++ b/doc/todo/turn_edittemplate_verbosity_off_by_default.mdwn @@ -8,7 +8,7 @@ I think this (untested) patch might just do the trick: --- a/IkiWiki/Plugin/edittemplate.pm +++ b/IkiWiki/Plugin/edittemplate.pm - @@ -46,8 +46,13 @@ sub preprocess (@) { #{{{ + @@ -46,8 +46,13 @@ sub preprocess (@) { $pagestate{$params{page}}{edittemplate}{$params{match}}=$params{template}; @@ -21,9 +21,9 @@ I think this (untested) patch might just do the trick: + else { + return ''; + } - } # }}} + } - sub formbuilder (@) { #{{{ + sub formbuilder (@) { --[[madduck]] diff --git a/doc/todo/using_meta_titles_for_parentlinks.html b/doc/todo/using_meta_titles_for_parentlinks.html index d04e5a300..6da40a415 100644 --- a/doc/todo/using_meta_titles_for_parentlinks.html +++ b/doc/todo/using_meta_titles_for_parentlinks.html @@ -82,9 +82,9 @@ diff -c /usr/share/perl5/IkiWiki/Plugin/meta.pm.distrib /usr/share/perl5/IkiWiki *** 289,294 **** --- 290,319 ---- } - } #}}} + } -+ sub IkiWiki::pagetitle ($;$) { #{{{ ++ sub IkiWiki::pagetitle ($;$) { + my $page=shift; + my $unescaped=shift; + @@ -106,11 +106,11 @@ diff -c /usr/share/perl5/IkiWiki/Plugin/meta.pm.distrib /usr/share/perl5/IkiWiki + } + + return $page; -+ } #}}} ++ } + package IkiWiki::PageSpec; - sub match_title ($$;@) { #{{{ + sub match_title ($$;@) { diff --git a/doc/todo/varioki_--_add_template_variables___40__with_closures_for_values__41___in_ikiwiki.setup.mdwn b/doc/todo/varioki_--_add_template_variables___40__with_closures_for_values__41___in_ikiwiki.setup.mdwn index 492a32b36..b28469993 100644 --- a/doc/todo/varioki_--_add_template_variables___40__with_closures_for_values__41___in_ikiwiki.setup.mdwn +++ b/doc/todo/varioki_--_add_template_variables___40__with_closures_for_values__41___in_ikiwiki.setup.mdwn @@ -157,9 +157,9 @@ ManojSrivastava +=cut + + -+sub import { #{{{ ++sub import { + hook(type => "pagetemplate", id => "varioki", call => \&pagetemplate); -+} # }}} ++} + + +=pod @@ -175,7 +175,7 @@ ManojSrivastava + +=cut + -+sub pagetemplate (@) { #{{{ ++sub pagetemplate (@) { + my %params=@_; + my $page=$params{page}; + my $template=$params{template}; @@ -207,7 +207,7 @@ ManojSrivastava + $template->param("$var" =>"$value"); + } + } -+} # }}} ++} + +1; + diff --git a/ikiwiki.in b/ikiwiki.in index 473cbdbfd..32a24af84 100755 --- a/ikiwiki.in +++ b/ikiwiki.in @@ -9,12 +9,12 @@ use strict; use lib '.'; # For use in nonstandard directory, munged by Makefile. use IkiWiki; -sub usage () { #{{{ +sub usage () { die gettext("usage: ikiwiki [options] source dest"), "\n", gettext(" ikiwiki --setup configfile"), "\n"; -} #}}} +} -sub getconfig () { #{{{ +sub getconfig () { if (! exists $ENV{WRAPPED_OPTIONS}) { %config=defaultconfig(); eval q{use Getopt::Long}; @@ -123,9 +123,9 @@ sub getconfig () { #{{{ loadplugins(); checkconfig(); } -} #}}} +} -sub main () { #{{{ +sub main () { getconfig(); if ($config{setup}) { @@ -207,6 +207,6 @@ sub main () { #{{{ saveindex(); debug(gettext("done")); } -} #}}} +} main; -- cgit v1.2.3 From 60142db48ebbd540e5310c5bcaa4762676c8ddce Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 17 Dec 2008 15:29:22 -0500 Subject: clarification --- doc/plugins/comments.mdwn | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/comments.mdwn b/doc/plugins/comments.mdwn index aab75e9b7..a81cab127 100644 --- a/doc/plugins/comments.mdwn +++ b/doc/plugins/comments.mdwn @@ -23,10 +23,12 @@ Individual comments are stored as internal-use pages named something like There are some global options for the setup file: +* `comments_open_pagespec`: pages where new comments can be posted, e.g. + `blog/* and created_after(close_old_comments)` or `!*/discussion`. + You need to set this, since the default is to not add comments to any + pages. * `comments_shown_pagespec`: pages where comments will be displayed inline, e.g. `blog/*` or `!*/discussion`. -* `comments_open_pagespec`: pages where new comments can be posted, e.g. - `blog/* and created_after(close_old_comments)` or `!*/discussion` * `comments_pagename`: if this is e.g. `comment_` (the default), then comment pages will be named something like `page/comment_12` * `comments_allowdirectives`: if true (default false), comments may -- cgit v1.2.3 From 140c0bacbadc35de93cc685313123e9e51b45704 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 17 Dec 2008 18:50:04 -0500 Subject: change around comments pagespecs I think it is clearer to have one pagespec that controls all pages with comments, and a separate pagespec that can be used to close new comments on a subset of those pages. --- IkiWiki/Plugin/comments.pm | 43 ++++++++++++++++++++----------------------- doc/plugins/comments.mdwn | 13 +++++++------ 2 files changed, 27 insertions(+), 29 deletions(-) (limited to 'doc/plugins') diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index 83f67869c..6e257d1d9 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -34,20 +34,18 @@ sub getsetup () { safe => 1, rebuild => 1, }, - # Pages where comments are shown, but new comments are not - # allowed, will show "Comments are closed". - comments_shown_pagespec => { + comments_pagespec => { type => 'pagespec', - example => 'blog/*', - description => 'PageSpec for pages where comments will be shown inline', + example => 'blog/* and *!/Discussion', + description => 'PageSpec of pages where comments are allowed', link => 'ikiwiki/PageSpec', safe => 1, rebuild => 1, }, - comments_open_pagespec => { + comments_closed_pagespec => { type => 'pagespec', - example => 'blog/* and created_after(close_old_comments)', - description => 'PageSpec for pages where new comments can be posted', + example => 'blog/controversial or blog/flamewar', + description => 'PageSpec of pages where posting new comments is not allowed', link => 'ikiwiki/PageSpec', safe => 1, rebuild => 1, @@ -87,10 +85,10 @@ sub getsetup () { sub checkconfig () { $config{comments_commit} = 1 unless defined $config{comments_commit}; - $config{comments_shown_pagespec} = '' - unless defined $config{comments_shown_pagespec}; - $config{comments_open_pagespec} = '' - unless defined $config{comments_open_pagespec}; + $config{comments_pagespec} = '' + unless defined $config{comments_pagespec}; + $config{comments_closed_pagespec} = '' + unless defined $config{comments_closed_pagespec}; $config{comments_pagename} = 'comment_' unless defined $config{comments_pagename}; } @@ -371,7 +369,7 @@ sub sessioncgi ($$) { $page)); } - if (not pagespec_match($page, $config{comments_open_pagespec}, + if (pagespec_match($page, $config{comments_closed_pagespec}, location => $page)) { error(sprintf(gettext( "comments on page '%s' are closed"), @@ -523,22 +521,21 @@ sub pagetemplate (@) { my $comments = undef; my $open = 0; - my $shown = pagespec_match($page, - $config{comments_shown_pagespec}, - location => $page); + my $shown = 0; + if (pagespec_match($page, + $config{comments_pagespec}, + location => $page)) { + $shown = 1; + $open = length $config{cgiurl} > 0; + } - if (pagespec_match($page, "*/$config{comments_pagename}*", + if (pagespec_match($page, + "$config{comments_closed_pagespec} or */$config{comments_pagename}*", location => $page)) { $shown = 0; $open = 0; } - if (length $config{cgiurl}) { - $open = pagespec_match($page, - $config{comments_open_pagespec}, - location => $page); - } - if ($shown) { $comments = IkiWiki::preprocess_inline( pages => "internal($page/$config{comments_pagename}*)", diff --git a/doc/plugins/comments.mdwn b/doc/plugins/comments.mdwn index a81cab127..afaf2c7ae 100644 --- a/doc/plugins/comments.mdwn +++ b/doc/plugins/comments.mdwn @@ -23,12 +23,13 @@ Individual comments are stored as internal-use pages named something like There are some global options for the setup file: -* `comments_open_pagespec`: pages where new comments can be posted, e.g. - `blog/* and created_after(close_old_comments)` or `!*/discussion`. - You need to set this, since the default is to not add comments to any - pages. -* `comments_shown_pagespec`: pages where comments will be displayed inline, - e.g. `blog/*` or `!*/discussion`. +* `comments_pagespec`: [[ikiwiki/PageSpec]] of pages where comments are + allowed. The default is not to allow comments on any pages. To allow + comments to all posts to a blog, you could use `blog/* and !*/Discussion`. +* `comments_closed_pagespec`: [[ikiwiki/PageSpec]] of pages where + posting of new comments is closed, but any existing comments will still + be displayed. Often you will list a set of individual pages here. + For example: `blog/controversial or blog/flamewar` * `comments_pagename`: if this is e.g. `comment_` (the default), then comment pages will be named something like `page/comment_12` * `comments_allowdirectives`: if true (default false), comments may -- cgit v1.2.3 From d647ca286ad2f974343c73fbc631ed092c13c09a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 17 Dec 2008 20:10:22 -0500 Subject: simplify pagespec --- doc/plugins/pagecount.mdwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/pagecount.mdwn b/doc/plugins/pagecount.mdwn index 6235963d3..c1c15eafb 100644 --- a/doc/plugins/pagecount.mdwn +++ b/doc/plugins/pagecount.mdwn @@ -6,5 +6,5 @@ This plugin provides the [[ikiwiki/directive/pagecount]] currently in the wiki. If it is turned on it can tell us that this wiki includes -[[!pagecount pages="* and !recentchanges"]] -pages, of which [[!pagecount pages="*/Discussion"]] are discussion pages. +[[!pagecount]] pages, of which +[[!pagecount pages="*/Discussion"]] are discussion pages. -- cgit v1.2.3 From 3e2f75af6b86ebc636abf409ac9ce98bed78f04a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 17 Dec 2008 20:19:12 -0500 Subject: fix --- doc/plugins/pagecount.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/pagecount.mdwn b/doc/plugins/pagecount.mdwn index c1c15eafb..a56027e60 100644 --- a/doc/plugins/pagecount.mdwn +++ b/doc/plugins/pagecount.mdwn @@ -6,5 +6,5 @@ This plugin provides the [[ikiwiki/directive/pagecount]] currently in the wiki. If it is turned on it can tell us that this wiki includes -[[!pagecount]] pages, of which +[[!pagecount ]] pages, of which [[!pagecount pages="*/Discussion"]] are discussion pages. -- cgit v1.2.3 From d70f3d6271a28635942ed23f91ed7e144877e62e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 21 Dec 2008 16:50:50 -0500 Subject: unify pagespecs --- doc/examples/blog.mdwn | 2 +- doc/plugins/comments.mdwn | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'doc/plugins') diff --git a/doc/examples/blog.mdwn b/doc/examples/blog.mdwn index 687f4afce..091e37431 100644 --- a/doc/examples/blog.mdwn +++ b/doc/examples/blog.mdwn @@ -21,4 +21,4 @@ Some additional configuration you might want to do: * Enable the [[comments|plugins/comments]] plugin and configure it to enable comments to posts to the blog: - comments_pagespec => 'blog/posts/*', + comments_pagespec => 'blog/posts/* and !*/Discussion', diff --git a/doc/plugins/comments.mdwn b/doc/plugins/comments.mdwn index afaf2c7ae..72b11af64 100644 --- a/doc/plugins/comments.mdwn +++ b/doc/plugins/comments.mdwn @@ -25,7 +25,8 @@ There are some global options for the setup file: * `comments_pagespec`: [[ikiwiki/PageSpec]] of pages where comments are allowed. The default is not to allow comments on any pages. To allow - comments to all posts to a blog, you could use `blog/* and !*/Discussion`. + comments to all posts to a blog, you could use + `blog/posts/* and !*/Discussion`. * `comments_closed_pagespec`: [[ikiwiki/PageSpec]] of pages where posting of new comments is closed, but any existing comments will still be displayed. Often you will list a set of individual pages here. -- cgit v1.2.3 From 298c16eda952e77627723ea5adb57a5c03d7ce71 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 23 Dec 2008 00:24:48 +0100 Subject: po: make the dev timing clearer --- doc/plugins/contrib/po.mdwn | 3 +++ 1 file changed, 3 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index 0fd06cb81..f90ffeed2 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -160,3 +160,6 @@ Any thoughts on this? >>>>> I am able to do myself in this area. --[[intrigeri]] >>>>>> >>>>>> I came up with a patch for the WrapI18N issue --[[Joey]] + +I've set this plugin development aside for a while. I will be back and +finish it at some point in the first quarter of 2009. --[[intrigeri]] -- cgit v1.2.3 From 14a9e704c1f11510fe8b16e161de69646e869bd0 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 23 Dec 2008 16:08:21 -0500 Subject: enable aggregate_internal by default --- IkiWiki/Plugin/aggregate.pm | 6 +++++- doc/plugins/aggregate.mdwn | 36 +++++++----------------------------- ikiwiki-transition | 2 -- 3 files changed, 12 insertions(+), 32 deletions(-) (limited to 'doc/plugins') diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index 97dd036f6..d06a648f6 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -46,7 +46,7 @@ sub getsetup () { }, aggregateinternal => { type => "boolean", - example => 0, + example => 1, description => "enable aggregation to internal pages?", safe => 0, # enabling needs manual transition rebuild => 0, @@ -61,6 +61,10 @@ sub getsetup () { } sub checkconfig () { + if (! defined $config{aggregateinternal}) { + $config{aggregateinternal}=1; + } + if ($config{aggregate} && ! ($config{post_commit} && IkiWiki::commit_hook_enabled())) { launchaggregation(); diff --git a/doc/plugins/aggregate.mdwn b/doc/plugins/aggregate.mdwn index 6fc87853b..e2efcd83f 100644 --- a/doc/plugins/aggregate.mdwn +++ b/doc/plugins/aggregate.mdwn @@ -5,10 +5,6 @@ This plugin allows content from other feeds to be aggregated into the wiki. To specify feeds to aggregate, use the [[ikiwiki/directive/aggregate]] [[ikiwiki/directive]]. -New users of aggregate should enable the `aggregateinternal => 1` option in the -.setup file. If you don't do so, you will need to enable the [[html]] plugin -as well as aggregate itself, since feed entries will be stored as HTML. - The [[meta]] and [[tag]] plugins are also recommended. Either the [[htmltidy]] or [[htmlbalance]] plugin is suggested, since feeds can easily contain html problems, some of which these plugins can fix. @@ -27,37 +23,19 @@ visit is `http://whatever/ikiwiki.cgi?do=aggregate_webtrigger`. Anyone can visit the url to trigger an aggregation run, but it will only check each feed if its `updateinterval` has passed. -## internal pages and `aggregateinternal` +## aggregated pages This plugin creates a page for each aggregated item. If the `aggregateinternal` option is enabled in the setup file (which is -recommended), aggregated pages are stored in the source directory with a +the default), aggregated pages are stored in the source directory with a "._aggregated" extension. These pages cannot be edited by web users, and do not generate first-class wiki pages. They can still be inlined into a blog, but you have to use `internal` in [[PageSpecs|IkiWiki/PageSpec]], like `internal(blog/*)`. -For backward compatibility, the default is that these pages have the -".html" extension, and are first-class wiki pages -- each one generates -a separate HTML page in the output, and they can even be edited. - -That turns out to not be ideal for aggregated content, because publishing -files for each of those pages is a waste of disk space and CPU, and you -probably don't want to allow them to be edited. So, there is an alternative -method that can be used (and is recommended), turned on by the -`aggregateinternal` option in the setup file. - -If you are already using aggregate and want to enable `aggregateinternal`, -you should follow this process: - -1. Update all [[PageSpecs|ikiwiki/PageSpec]] that refer to the aggregated - pages -- such as those in inlines. Put "internal()" around globs - in those PageSpecs. For example, if the PageSpec was `foo/*`, it should - be changed to `internal(foo/*)`. This has to be done because internal - pages are not matched by regular globs. -2. Turn on `aggregateinternal` in the setup file. -3. Use [[ikiwiki-transition]] to rename all existing aggregated `.html` - files in the srcdir. The command to run is - `ikiwiki-transition aggregateinternal $setupfile`, -4. Refresh the wiki. (`ikiwiki -setup your.setup -refresh`) +If `aggregateinternal` is disabled, you will need to enable the [[html]] +plugin as well as aggregate itself, since feed entries will be stored as +HTML, and as first-class wiki pages -- each one generates +a separate HTML page in the output, and they can even be edited. This +option is provided only for backwards compatability. diff --git a/ikiwiki-transition b/ikiwiki-transition index e42a5137c..802cd643d 100755 --- a/ikiwiki-transition +++ b/ikiwiki-transition @@ -113,8 +113,6 @@ sub aggregateinternal { IkiWiki::checkconfig(); IkiWiki::Plugin::aggregate::migrate_to_internal(); - - print "... now add aggregateinternal => 1 to your .setup file\n"; } sub setupformat { -- cgit v1.2.3 From ecf2408bf64de1aee3bb8b79f6e28c14b52cf1c4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 23 Dec 2008 16:25:52 -0500 Subject: fix a few directives using the old syntax I'm turning on prefix_directives for the live wiki now. --- doc/plugins/aggregate/discussion.mdwn | 2 +- doc/tips/inside_dot_ikiwiki.mdwn | 2 +- doc/todo/support_creole_markup.mdwn | 2 +- doc/todo/syntax_highlighting.mdwn | 8 ++++---- doc/users/xma.mdwn | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/aggregate/discussion.mdwn b/doc/plugins/aggregate/discussion.mdwn index 1db6240d5..1a9844577 100644 --- a/doc/plugins/aggregate/discussion.mdwn +++ b/doc/plugins/aggregate/discussion.mdwn @@ -35,7 +35,7 @@ Two things aren't working as I'd expect: > problem. You can see the feed validator complain about it here: > > -> It's sorta unfortunate that [[cpan XML::Feed]] doesn't just assume the +> It's sorta unfortunate that [[!cpan XML::Feed]] doesn't just assume the > un-esxaped html is part of the description field. Probably other feed > parsers are more lenient. --[[Joey]] diff --git a/doc/tips/inside_dot_ikiwiki.mdwn b/doc/tips/inside_dot_ikiwiki.mdwn index 1f76ce4bd..b81ffae8d 100644 --- a/doc/tips/inside_dot_ikiwiki.mdwn +++ b/doc/tips/inside_dot_ikiwiki.mdwn @@ -66,7 +66,7 @@ to do it rarely, and the data I've wanted has been different each time. ## the session database -`.ikiwiki/sessions.db` is the session database. See the [[cpan CGI::Session]] +`.ikiwiki/sessions.db` is the session database. See the [[!cpan CGI::Session]] documentation for more details. ## lockfiles diff --git a/doc/todo/support_creole_markup.mdwn b/doc/todo/support_creole_markup.mdwn index b0ebf5b9e..5a1e1286d 100644 --- a/doc/todo/support_creole_markup.mdwn +++ b/doc/todo/support_creole_markup.mdwn @@ -12,7 +12,7 @@ And there is a perl module: Text::WikiCreole Syntax file for vim: http://www.peter-hoffmann.com/code/vim/ (Since a typical ikiwiki user usually use external editors. :)) -> Should be pretty easy to add a plugin to do it using [[cpan +> Should be pretty easy to add a plugin to do it using [[!cpan > Text::WikiCreole]]. --[[Joey]] [[done]] diff --git a/doc/todo/syntax_highlighting.mdwn b/doc/todo/syntax_highlighting.mdwn index 3de3032b3..d9a791c6f 100644 --- a/doc/todo/syntax_highlighting.mdwn +++ b/doc/todo/syntax_highlighting.mdwn @@ -7,16 +7,16 @@ pages, as well as doing syntax highlighting as a preprocessor directive ## The big list of possibilities -* [[plugins/contrib/highlightcode]] uses [[cpan Syntax::Highlight::Engine::Kate]], +* [[plugins/contrib/highlightcode]] uses [[!cpan Syntax::Highlight::Engine::Kate]], operates on whole source files only, has a few bugs (see [here](http://u32.net/Highlight_Code_Plugin/), and needs to be updated to support [[bugs/multiple_pages_with_same_name]]. -* [[cpan IkiWiki-Plugin-syntax]] only operates as a directive. +* [[!cpan IkiWiki-Plugin-syntax]] only operates as a directive. Interestingly, it supports multiple highlighting backends, including Kate and Vim. * [[plugins/contrib/syntax]] only operates as a directive ([[not_on_source_code_files|automatic_use_of_syntax_plugin_on_source_code_files]]), - and uses [[cpan Text::VimColor]]. + and uses [[!cpan Text::VimColor]]. * [[plugins/contrib/sourcehighlight]] uses src-highlight, and operates on whole source files only. Needs to be updated to support [[bugs/multiple_pages_with_same_name]]. @@ -43,7 +43,7 @@ pages, as well as doing syntax highlighting as a preprocessor directive inside source files. Doing this probably means post-processing the results of the highlighting engine, to find places where it's highlighted comments, and then running them through the ikiwiki rendering pipeline. - This seems fairly doable with [[cpan Syntax::Highlight::Engine::Kate]], + This seems fairly doable with [[!cpan Syntax::Highlight::Engine::Kate]], at least. * The whole-file plugins tend to have a problem that things that look like wikilinks in the source code get munged into links by ikiwiki, which can diff --git a/doc/users/xma.mdwn b/doc/users/xma.mdwn index 97a8ef869..89f2ff74c 100644 --- a/doc/users/xma.mdwn +++ b/doc/users/xma.mdwn @@ -9,7 +9,7 @@ Anyway, [[ikiwiki]] is really *awesome* ! ## More about me -I am CLI user living in the linux console. More precisely, I live in an [[GNU Emacs]] frame all day long. My main computer is an EeePC 901 running Slackware GNU/Linux 12.1. I do not have X installed (too lazy) but when in X, I am running an instance of [[CLFSWM]]. +I am CLI user living in the linux console. More precisely, I live in an [[GNU_Emacs]] frame all day long. My main computer is an EeePC 901 running Slackware GNU/Linux 12.1. I do not have X installed (too lazy) but when in X, I am running an instance of [[CLFSWM]]. ## Contacting me -- cgit v1.2.3 From 678d467a4080dd549f2b6f276f963eac384e1b4f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 23 Dec 2008 16:34:19 -0500 Subject: finalise version 3.00 of the plugin api --- IkiWiki.pm | 2 +- IkiWiki/Plugin/aggregate.pm | 2 +- IkiWiki/Plugin/amazon_s3.pm | 2 +- IkiWiki/Plugin/anonok.pm | 2 +- IkiWiki/Plugin/attachment.pm | 2 +- IkiWiki/Plugin/autoindex.pm | 2 +- IkiWiki/Plugin/brokenlinks.pm | 2 +- IkiWiki/Plugin/calendar.pm | 2 +- IkiWiki/Plugin/camelcase.pm | 2 +- IkiWiki/Plugin/color.pm | 2 +- IkiWiki/Plugin/comments.pm | 2 +- IkiWiki/Plugin/conditional.pm | 2 +- IkiWiki/Plugin/creole.pm | 2 +- IkiWiki/Plugin/cutpaste.pm | 2 +- IkiWiki/Plugin/ddate.pm | 2 +- IkiWiki/Plugin/editdiff.pm | 2 +- IkiWiki/Plugin/edittemplate.pm | 2 +- IkiWiki/Plugin/embed.pm | 2 +- IkiWiki/Plugin/external.pm | 2 +- IkiWiki/Plugin/favicon.pm | 2 +- IkiWiki/Plugin/filecheck.pm | 2 +- IkiWiki/Plugin/format.pm | 2 +- IkiWiki/Plugin/fortune.pm | 2 +- IkiWiki/Plugin/goodstuff.pm | 2 +- IkiWiki/Plugin/google.pm | 2 +- IkiWiki/Plugin/googlecalendar.pm | 2 +- IkiWiki/Plugin/graphviz.pm | 2 +- IkiWiki/Plugin/haiku.pm | 2 +- IkiWiki/Plugin/hnb.pm | 2 +- IkiWiki/Plugin/html.pm | 2 +- IkiWiki/Plugin/htmlbalance.pm | 2 +- IkiWiki/Plugin/htmlscrubber.pm | 2 +- IkiWiki/Plugin/htmltidy.pm | 2 +- IkiWiki/Plugin/httpauth.pm | 2 +- IkiWiki/Plugin/img.pm | 2 +- IkiWiki/Plugin/inline.pm | 2 +- IkiWiki/Plugin/link.pm | 2 +- IkiWiki/Plugin/linkmap.pm | 2 +- IkiWiki/Plugin/listdirectives.pm | 2 +- IkiWiki/Plugin/lockedit.pm | 2 +- IkiWiki/Plugin/map.pm | 2 +- IkiWiki/Plugin/mdwn.pm | 2 +- IkiWiki/Plugin/meta.pm | 2 +- IkiWiki/Plugin/mirrorlist.pm | 2 +- IkiWiki/Plugin/more.pm | 2 +- IkiWiki/Plugin/opendiscussion.pm | 2 +- IkiWiki/Plugin/openid.pm | 2 +- IkiWiki/Plugin/orphans.pm | 2 +- IkiWiki/Plugin/otl.pm | 2 +- IkiWiki/Plugin/pagecount.pm | 2 +- IkiWiki/Plugin/pagestats.pm | 2 +- IkiWiki/Plugin/pagetemplate.pm | 2 +- IkiWiki/Plugin/parentlinks.pm | 2 +- IkiWiki/Plugin/passwordauth.pm | 2 +- IkiWiki/Plugin/pingee.pm | 2 +- IkiWiki/Plugin/pinger.pm | 2 +- IkiWiki/Plugin/poll.pm | 2 +- IkiWiki/Plugin/polygen.pm | 2 +- IkiWiki/Plugin/postsparkline.pm | 2 +- IkiWiki/Plugin/prettydate.pm | 2 +- IkiWiki/Plugin/progress.pm | 2 +- IkiWiki/Plugin/rawhtml.pm | 2 +- IkiWiki/Plugin/recentchanges.pm | 2 +- IkiWiki/Plugin/recentchangesdiff.pm | 2 +- IkiWiki/Plugin/relativedate.pm | 2 +- IkiWiki/Plugin/remove.pm | 2 +- IkiWiki/Plugin/rename.pm | 2 +- IkiWiki/Plugin/search.pm | 2 +- IkiWiki/Plugin/shortcut.pm | 2 +- IkiWiki/Plugin/sidebar.pm | 2 +- IkiWiki/Plugin/signinedit.pm | 2 +- IkiWiki/Plugin/smiley.pm | 2 +- IkiWiki/Plugin/sparkline.pm | 2 +- IkiWiki/Plugin/table.pm | 2 +- IkiWiki/Plugin/tag.pm | 2 +- IkiWiki/Plugin/template.pm | 2 +- IkiWiki/Plugin/testpagespec.pm | 2 +- IkiWiki/Plugin/teximg.pm | 2 +- IkiWiki/Plugin/textile.pm | 2 +- IkiWiki/Plugin/toc.pm | 2 +- IkiWiki/Plugin/toggle.pm | 2 +- IkiWiki/Plugin/txt.pm | 2 +- IkiWiki/Plugin/typography.pm | 2 +- IkiWiki/Plugin/version.pm | 2 +- IkiWiki/Plugin/websetup.pm | 2 +- IkiWiki/Plugin/wikitext.pm | 2 +- doc/plugins/write.mdwn | 4 ++-- doc/plugins/write/tutorial.mdwn | 2 +- doc/roadmap.mdwn | 12 +++++++----- doc/todo/firm_up_plugin_interface.mdwn | 2 ++ 90 files changed, 98 insertions(+), 94 deletions(-) (limited to 'doc/plugins') diff --git a/IkiWiki.pm b/IkiWiki.pm index 127c9e5d7..759bfbc65 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -24,7 +24,7 @@ our @EXPORT = qw(hook debug error template htmlpage add_depends pagespec_match inject %config %links %pagestate %wikistate %renderedfiles %pagesources %destsources); -our $VERSION = 2.00; # plugin interface version, next is ikiwiki version +our $VERSION = 3.00; # plugin interface version, next is ikiwiki version our $version='unknown'; # VERSION_AUTOREPLACE done by Makefile, DNE my $installdir=''; # INSTALLDIR_AUTOREPLACE done by Makefile, DNE diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index d06a648f6..c667ee2a9 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::aggregate; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; use HTML::Parser; use HTML::Tagset; use HTML::Entities; diff --git a/IkiWiki/Plugin/amazon_s3.pm b/IkiWiki/Plugin/amazon_s3.pm index 93c10b629..10bf358e4 100644 --- a/IkiWiki/Plugin/amazon_s3.pm +++ b/IkiWiki/Plugin/amazon_s3.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::amazon_s3; use warnings; no warnings 'redefine'; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; use IkiWiki::Render; use Net::Amazon::S3; diff --git a/IkiWiki/Plugin/anonok.pm b/IkiWiki/Plugin/anonok.pm index 1cbdfe4e5..243b98920 100644 --- a/IkiWiki/Plugin/anonok.pm +++ b/IkiWiki/Plugin/anonok.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::anonok; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "anonok", call => \&getsetup); diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm index 87da6cd4e..e1b4d4363 100644 --- a/IkiWiki/Plugin/attachment.pm +++ b/IkiWiki/Plugin/attachment.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::attachment; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { add_underlay("javascript"); diff --git a/IkiWiki/Plugin/autoindex.pm b/IkiWiki/Plugin/autoindex.pm index bb08091ae..555856b11 100644 --- a/IkiWiki/Plugin/autoindex.pm +++ b/IkiWiki/Plugin/autoindex.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::autoindex; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; use Encode; sub import { diff --git a/IkiWiki/Plugin/brokenlinks.pm b/IkiWiki/Plugin/brokenlinks.pm index 1c52099bf..bf0d7560d 100644 --- a/IkiWiki/Plugin/brokenlinks.pm +++ b/IkiWiki/Plugin/brokenlinks.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::brokenlinks; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "brokenlinks", call => \&getsetup); diff --git a/IkiWiki/Plugin/calendar.pm b/IkiWiki/Plugin/calendar.pm index 88303fc44..d473c8348 100644 --- a/IkiWiki/Plugin/calendar.pm +++ b/IkiWiki/Plugin/calendar.pm @@ -20,7 +20,7 @@ package IkiWiki::Plugin::calendar; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; use Time::Local; use POSIX; diff --git a/IkiWiki/Plugin/camelcase.pm b/IkiWiki/Plugin/camelcase.pm index 6c1fafb7b..bda980d28 100644 --- a/IkiWiki/Plugin/camelcase.pm +++ b/IkiWiki/Plugin/camelcase.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::camelcase; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; # This regexp is based on the one in Text::WikiFormat. my $link_regexp=qr{ diff --git a/IkiWiki/Plugin/color.pm b/IkiWiki/Plugin/color.pm index 53d8389d2..20505893b 100644 --- a/IkiWiki/Plugin/color.pm +++ b/IkiWiki/Plugin/color.pm @@ -5,7 +5,7 @@ package IkiWiki::Plugin::color; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "preprocess", id => "color", call => \&preprocess); diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index 0ae9eefe3..c9c7b2ed4 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -7,7 +7,7 @@ package IkiWiki::Plugin::comments; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; use Encode; use POSIX qw(strftime); diff --git a/IkiWiki/Plugin/conditional.pm b/IkiWiki/Plugin/conditional.pm index 66253e07d..4f3577b34 100644 --- a/IkiWiki/Plugin/conditional.pm +++ b/IkiWiki/Plugin/conditional.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::conditional; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; use UNIVERSAL; sub import { diff --git a/IkiWiki/Plugin/creole.pm b/IkiWiki/Plugin/creole.pm index 3c46a48df..425e71043 100644 --- a/IkiWiki/Plugin/creole.pm +++ b/IkiWiki/Plugin/creole.pm @@ -5,7 +5,7 @@ package IkiWiki::Plugin::creole; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "creole", call => \&getsetup); diff --git a/IkiWiki/Plugin/cutpaste.pm b/IkiWiki/Plugin/cutpaste.pm index e579c1ea2..417442f34 100644 --- a/IkiWiki/Plugin/cutpaste.pm +++ b/IkiWiki/Plugin/cutpaste.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::cutpaste; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; my %savedtext; diff --git a/IkiWiki/Plugin/ddate.pm b/IkiWiki/Plugin/ddate.pm index 3470640dc..bb77ce59f 100644 --- a/IkiWiki/Plugin/ddate.pm +++ b/IkiWiki/Plugin/ddate.pm @@ -2,7 +2,7 @@ # Discordian date support fnord ikiwiki. package IkiWiki::Plugin::ddate; -use IkiWiki 2.00; +use IkiWiki 3.00; no warnings; sub import { diff --git a/IkiWiki/Plugin/editdiff.pm b/IkiWiki/Plugin/editdiff.pm index 068b83b3c..7df6a9ffb 100644 --- a/IkiWiki/Plugin/editdiff.pm +++ b/IkiWiki/Plugin/editdiff.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::editdiff; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; use HTML::Entities; use IPC::Open2; diff --git a/IkiWiki/Plugin/edittemplate.pm b/IkiWiki/Plugin/edittemplate.pm index 7c0e7c2f8..0bafc95d0 100644 --- a/IkiWiki/Plugin/edittemplate.pm +++ b/IkiWiki/Plugin/edittemplate.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::edittemplate; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; use HTML::Template; use Encode; diff --git a/IkiWiki/Plugin/embed.pm b/IkiWiki/Plugin/embed.pm index 664c95763..a7d38358f 100644 --- a/IkiWiki/Plugin/embed.pm +++ b/IkiWiki/Plugin/embed.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::embed; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; my $attribr=qr/[^<>"]+/; diff --git a/IkiWiki/Plugin/external.pm b/IkiWiki/Plugin/external.pm index 2d540143f..066f15cf1 100644 --- a/IkiWiki/Plugin/external.pm +++ b/IkiWiki/Plugin/external.pm @@ -6,7 +6,7 @@ package IkiWiki::Plugin::external; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; use RPC::XML; use RPC::XML::Parser; use IPC::Open2; diff --git a/IkiWiki/Plugin/favicon.pm b/IkiWiki/Plugin/favicon.pm index 68359a4aa..6060914c5 100644 --- a/IkiWiki/Plugin/favicon.pm +++ b/IkiWiki/Plugin/favicon.pm @@ -5,7 +5,7 @@ package IkiWiki::Plugin::favicon; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "favicon", call => \&getsetup); diff --git a/IkiWiki/Plugin/filecheck.pm b/IkiWiki/Plugin/filecheck.pm index 5040a185c..8575ee108 100644 --- a/IkiWiki/Plugin/filecheck.pm +++ b/IkiWiki/Plugin/filecheck.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::filecheck; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; my %units=( #{{{ # size in bytes B => 1, diff --git a/IkiWiki/Plugin/format.pm b/IkiWiki/Plugin/format.pm index b4d3a3c5f..bbe3aa9fe 100644 --- a/IkiWiki/Plugin/format.pm +++ b/IkiWiki/Plugin/format.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::format; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "preprocess", id => "format", call => \&preprocess); diff --git a/IkiWiki/Plugin/fortune.pm b/IkiWiki/Plugin/fortune.pm index 6a12f28fd..17e57dea1 100644 --- a/IkiWiki/Plugin/fortune.pm +++ b/IkiWiki/Plugin/fortune.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::fortune; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "fortune", call => \&getsetup); diff --git a/IkiWiki/Plugin/goodstuff.pm b/IkiWiki/Plugin/goodstuff.pm index 92bc8200a..46f2380cf 100644 --- a/IkiWiki/Plugin/goodstuff.pm +++ b/IkiWiki/Plugin/goodstuff.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::goodstuff; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; my @bundle=qw{ brokenlinks diff --git a/IkiWiki/Plugin/google.pm b/IkiWiki/Plugin/google.pm index 5394c5a6f..4bba5775c 100644 --- a/IkiWiki/Plugin/google.pm +++ b/IkiWiki/Plugin/google.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::google; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; use URI; my $host; diff --git a/IkiWiki/Plugin/googlecalendar.pm b/IkiWiki/Plugin/googlecalendar.pm index 9e09d7dbb..fad2ad78f 100644 --- a/IkiWiki/Plugin/googlecalendar.pm +++ b/IkiWiki/Plugin/googlecalendar.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::googlecalendar; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "googlecalendar", diff --git a/IkiWiki/Plugin/graphviz.pm b/IkiWiki/Plugin/graphviz.pm index 23631da30..b43e96a73 100644 --- a/IkiWiki/Plugin/graphviz.pm +++ b/IkiWiki/Plugin/graphviz.pm @@ -5,7 +5,7 @@ package IkiWiki::Plugin::graphviz; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; use IPC::Open2; sub import { diff --git a/IkiWiki/Plugin/haiku.pm b/IkiWiki/Plugin/haiku.pm index fe68c6eec..5a062a276 100644 --- a/IkiWiki/Plugin/haiku.pm +++ b/IkiWiki/Plugin/haiku.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::haiku; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "haiku", call => \&getsetup); diff --git a/IkiWiki/Plugin/hnb.pm b/IkiWiki/Plugin/hnb.pm index d5b5ce3b4..bd2177a06 100644 --- a/IkiWiki/Plugin/hnb.pm +++ b/IkiWiki/Plugin/hnb.pm @@ -10,7 +10,7 @@ package IkiWiki::Plugin::hnb; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; use File::Temp qw(:mktemp); sub import { diff --git a/IkiWiki/Plugin/html.pm b/IkiWiki/Plugin/html.pm index 9b9547cca..a7d5e8ce9 100644 --- a/IkiWiki/Plugin/html.pm +++ b/IkiWiki/Plugin/html.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::html; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "html", call => \&getsetup); diff --git a/IkiWiki/Plugin/htmlbalance.pm b/IkiWiki/Plugin/htmlbalance.pm index acbe40a5d..261e273aa 100644 --- a/IkiWiki/Plugin/htmlbalance.pm +++ b/IkiWiki/Plugin/htmlbalance.pm @@ -9,7 +9,7 @@ package IkiWiki::Plugin::htmlbalance; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; use HTML::TreeBuilder; use HTML::Entities; diff --git a/IkiWiki/Plugin/htmlscrubber.pm b/IkiWiki/Plugin/htmlscrubber.pm index 823b3d806..a249cdf7a 100644 --- a/IkiWiki/Plugin/htmlscrubber.pm +++ b/IkiWiki/Plugin/htmlscrubber.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::htmlscrubber; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; # This regexp matches urls that are in a known safe scheme. # Feel free to use it from other plugins. diff --git a/IkiWiki/Plugin/htmltidy.pm b/IkiWiki/Plugin/htmltidy.pm index 02438ebef..6f3379ef4 100644 --- a/IkiWiki/Plugin/htmltidy.pm +++ b/IkiWiki/Plugin/htmltidy.pm @@ -9,7 +9,7 @@ package IkiWiki::Plugin::htmltidy; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; use IPC::Open2; sub import { diff --git a/IkiWiki/Plugin/httpauth.pm b/IkiWiki/Plugin/httpauth.pm index 39edff615..1816c9d74 100644 --- a/IkiWiki/Plugin/httpauth.pm +++ b/IkiWiki/Plugin/httpauth.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::httpauth; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "httpauth", call => \&getsetup); diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm index 395890c0e..5c580c03c 100644 --- a/IkiWiki/Plugin/img.pm +++ b/IkiWiki/Plugin/img.pm @@ -5,7 +5,7 @@ package IkiWiki::Plugin::img; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; my %imgdefaults; diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 8490b455f..b88efc0ba 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -5,7 +5,7 @@ package IkiWiki::Plugin::inline; use warnings; use strict; use Encode; -use IkiWiki 2.00; +use IkiWiki 3.00; use URI; my %knownfeeds; diff --git a/IkiWiki/Plugin/link.pm b/IkiWiki/Plugin/link.pm index 3799209d0..b79273f96 100644 --- a/IkiWiki/Plugin/link.pm +++ b/IkiWiki/Plugin/link.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::link; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; my $link_regexp; diff --git a/IkiWiki/Plugin/linkmap.pm b/IkiWiki/Plugin/linkmap.pm index cb9f3ef41..941ed5f36 100644 --- a/IkiWiki/Plugin/linkmap.pm +++ b/IkiWiki/Plugin/linkmap.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::linkmap; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; use IPC::Open2; sub import { diff --git a/IkiWiki/Plugin/listdirectives.pm b/IkiWiki/Plugin/listdirectives.pm index be82b0495..d2cebca34 100644 --- a/IkiWiki/Plugin/listdirectives.pm +++ b/IkiWiki/Plugin/listdirectives.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::listdirectives; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { add_underlay("directives"); diff --git a/IkiWiki/Plugin/lockedit.pm b/IkiWiki/Plugin/lockedit.pm index 31a9e70cd..c2c7414c3 100644 --- a/IkiWiki/Plugin/lockedit.pm +++ b/IkiWiki/Plugin/lockedit.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::lockedit; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "lockedit", call => \&getsetup); diff --git a/IkiWiki/Plugin/map.pm b/IkiWiki/Plugin/map.pm index af14ef5de..328493116 100644 --- a/IkiWiki/Plugin/map.pm +++ b/IkiWiki/Plugin/map.pm @@ -9,7 +9,7 @@ package IkiWiki::Plugin::map; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "map", call => \&getsetup); diff --git a/IkiWiki/Plugin/mdwn.pm b/IkiWiki/Plugin/mdwn.pm index 0d5f398a0..0e134c822 100644 --- a/IkiWiki/Plugin/mdwn.pm +++ b/IkiWiki/Plugin/mdwn.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::mdwn; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "mdwn", call => \&getsetup); diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm index 8c214139f..15bb29b3f 100644 --- a/IkiWiki/Plugin/meta.pm +++ b/IkiWiki/Plugin/meta.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::meta; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; my %metaheaders; diff --git a/IkiWiki/Plugin/mirrorlist.pm b/IkiWiki/Plugin/mirrorlist.pm index b726386f6..737dcf767 100644 --- a/IkiWiki/Plugin/mirrorlist.pm +++ b/IkiWiki/Plugin/mirrorlist.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::mirrorlist; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "mirrorlist", call => \&getsetup); diff --git a/IkiWiki/Plugin/more.pm b/IkiWiki/Plugin/more.pm index f1216ad3d..77d5fb077 100644 --- a/IkiWiki/Plugin/more.pm +++ b/IkiWiki/Plugin/more.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::more; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; my $linktext = gettext("more"); diff --git a/IkiWiki/Plugin/opendiscussion.pm b/IkiWiki/Plugin/opendiscussion.pm index 95220d7b3..3da01efee 100644 --- a/IkiWiki/Plugin/opendiscussion.pm +++ b/IkiWiki/Plugin/opendiscussion.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::opendiscussion; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "opendiscussion", call => \&getsetup); diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index 574c42f0e..5424c57e2 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::openid; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getopt", id => "openid", call => \&getopt); diff --git a/IkiWiki/Plugin/orphans.pm b/IkiWiki/Plugin/orphans.pm index 8e9ab0ff4..605e6e43a 100644 --- a/IkiWiki/Plugin/orphans.pm +++ b/IkiWiki/Plugin/orphans.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::orphans; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "orphans", call => \&getsetup); diff --git a/IkiWiki/Plugin/otl.pm b/IkiWiki/Plugin/otl.pm index 280b19db0..c68fcbbe3 100644 --- a/IkiWiki/Plugin/otl.pm +++ b/IkiWiki/Plugin/otl.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::otl; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; use open qw{:utf8 :std}; sub import { diff --git a/IkiWiki/Plugin/pagecount.pm b/IkiWiki/Plugin/pagecount.pm index c08ab3931..a143f24d0 100644 --- a/IkiWiki/Plugin/pagecount.pm +++ b/IkiWiki/Plugin/pagecount.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::pagecount; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "pagecount", call => \&getsetup); diff --git a/IkiWiki/Plugin/pagestats.pm b/IkiWiki/Plugin/pagestats.pm index e20d0dac6..dbe69539d 100644 --- a/IkiWiki/Plugin/pagestats.pm +++ b/IkiWiki/Plugin/pagestats.pm @@ -12,7 +12,7 @@ package IkiWiki::Plugin::pagestats; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; # Names of the HTML classes to use for the tag cloud our @classes = ('smallestPC', 'smallPC', 'normalPC', 'bigPC', 'biggestPC' ); diff --git a/IkiWiki/Plugin/pagetemplate.pm b/IkiWiki/Plugin/pagetemplate.pm index 60db8b327..1d8a84ca7 100644 --- a/IkiWiki/Plugin/pagetemplate.pm +++ b/IkiWiki/Plugin/pagetemplate.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::pagetemplate; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; my %templates; diff --git a/IkiWiki/Plugin/parentlinks.pm b/IkiWiki/Plugin/parentlinks.pm index fb41e1c83..ebf1d449a 100644 --- a/IkiWiki/Plugin/parentlinks.pm +++ b/IkiWiki/Plugin/parentlinks.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::parentlinks; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "parentlinks", id => "parentlinks", call => \&parentlinks); diff --git a/IkiWiki/Plugin/passwordauth.pm b/IkiWiki/Plugin/passwordauth.pm index 7176f0c33..90e2ca564 100644 --- a/IkiWiki/Plugin/passwordauth.pm +++ b/IkiWiki/Plugin/passwordauth.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::passwordauth; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "passwordauth", "call" => \&getsetup); diff --git a/IkiWiki/Plugin/pingee.pm b/IkiWiki/Plugin/pingee.pm index fcbe6b57b..f5386d0ca 100644 --- a/IkiWiki/Plugin/pingee.pm +++ b/IkiWiki/Plugin/pingee.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::pingee; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "pingee", call => \&getsetup); diff --git a/IkiWiki/Plugin/pinger.pm b/IkiWiki/Plugin/pinger.pm index 7b4dce586..4a8088661 100644 --- a/IkiWiki/Plugin/pinger.pm +++ b/IkiWiki/Plugin/pinger.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::pinger; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; my %pages; my $pinged=0; diff --git a/IkiWiki/Plugin/poll.pm b/IkiWiki/Plugin/poll.pm index 5ac5b818d..bc1e3501e 100644 --- a/IkiWiki/Plugin/poll.pm +++ b/IkiWiki/Plugin/poll.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::poll; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; use Encode; sub import { diff --git a/IkiWiki/Plugin/polygen.pm b/IkiWiki/Plugin/polygen.pm index a32003778..bc21d71c7 100644 --- a/IkiWiki/Plugin/polygen.pm +++ b/IkiWiki/Plugin/polygen.pm @@ -7,7 +7,7 @@ package IkiWiki::Plugin::polygen; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; use File::Find; sub import { diff --git a/IkiWiki/Plugin/postsparkline.pm b/IkiWiki/Plugin/postsparkline.pm index 1753e4cf9..ba43561fb 100644 --- a/IkiWiki/Plugin/postsparkline.pm +++ b/IkiWiki/Plugin/postsparkline.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::postsparkline; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { IkiWiki::loadplugin('sparkline'); diff --git a/IkiWiki/Plugin/prettydate.pm b/IkiWiki/Plugin/prettydate.pm index 501f17f5d..e155dd39b 100644 --- a/IkiWiki/Plugin/prettydate.pm +++ b/IkiWiki/Plugin/prettydate.pm @@ -1,6 +1,6 @@ #!/usr/bin/perl package IkiWiki::Plugin::prettydate; -use IkiWiki 2.00; +use IkiWiki 3.00; use warnings; no warnings 'redefine'; use strict; diff --git a/IkiWiki/Plugin/progress.pm b/IkiWiki/Plugin/progress.pm index 75da16d16..76d994acc 100644 --- a/IkiWiki/Plugin/progress.pm +++ b/IkiWiki/Plugin/progress.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::progress; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; my $percentage_pattern = qr/[0-9]+\%?/; # pattern to validate percentages diff --git a/IkiWiki/Plugin/rawhtml.pm b/IkiWiki/Plugin/rawhtml.pm index 73093439d..ad8a610c1 100644 --- a/IkiWiki/Plugin/rawhtml.pm +++ b/IkiWiki/Plugin/rawhtml.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::rawhtml; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "rawhtml", call => \&getsetup); diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm index 7071596e6..ef108b3f0 100644 --- a/IkiWiki/Plugin/recentchanges.pm +++ b/IkiWiki/Plugin/recentchanges.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::recentchanges; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; use Encode; use HTML::Entities; diff --git a/IkiWiki/Plugin/recentchangesdiff.pm b/IkiWiki/Plugin/recentchangesdiff.pm index 4dea9c26b..e3ba9b8d8 100644 --- a/IkiWiki/Plugin/recentchangesdiff.pm +++ b/IkiWiki/Plugin/recentchangesdiff.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::recentchangesdiff; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; use HTML::Entities; my $maxlines=200; diff --git a/IkiWiki/Plugin/relativedate.pm b/IkiWiki/Plugin/relativedate.pm index e5fa8e1a5..3e33cd5c3 100644 --- a/IkiWiki/Plugin/relativedate.pm +++ b/IkiWiki/Plugin/relativedate.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::relativedate; use warnings; no warnings 'redefine'; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; use POSIX; use Encode; diff --git a/IkiWiki/Plugin/remove.pm b/IkiWiki/Plugin/remove.pm index 781501662..21989aff3 100644 --- a/IkiWiki/Plugin/remove.pm +++ b/IkiWiki/Plugin/remove.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::remove; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "remove", call => \&getsetup); diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm index b1bb15767..54c7faf13 100644 --- a/IkiWiki/Plugin/rename.pm +++ b/IkiWiki/Plugin/rename.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::rename; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "rename", call => \&getsetup); diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm index cc2130ad5..d79e3170e 100644 --- a/IkiWiki/Plugin/search.pm +++ b/IkiWiki/Plugin/search.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::search; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "search", call => \&getsetup); diff --git a/IkiWiki/Plugin/shortcut.pm b/IkiWiki/Plugin/shortcut.pm index 33d158d3e..0e7cbd4d1 100644 --- a/IkiWiki/Plugin/shortcut.pm +++ b/IkiWiki/Plugin/shortcut.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::shortcut; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "shortcut", call => \&getsetup); diff --git a/IkiWiki/Plugin/sidebar.pm b/IkiWiki/Plugin/sidebar.pm index 746fa93bb..41812e1c1 100644 --- a/IkiWiki/Plugin/sidebar.pm +++ b/IkiWiki/Plugin/sidebar.pm @@ -6,7 +6,7 @@ package IkiWiki::Plugin::sidebar; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "sidebar", call => \&getsetup); diff --git a/IkiWiki/Plugin/signinedit.pm b/IkiWiki/Plugin/signinedit.pm index 321c93ed5..032a0034c 100644 --- a/IkiWiki/Plugin/signinedit.pm +++ b/IkiWiki/Plugin/signinedit.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::signinedit; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "signinedit", call => \&getsetup); diff --git a/IkiWiki/Plugin/smiley.pm b/IkiWiki/Plugin/smiley.pm index 70b8cef74..1697a37c1 100644 --- a/IkiWiki/Plugin/smiley.pm +++ b/IkiWiki/Plugin/smiley.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::smiley; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; my %smileys; my $smiley_regexp; diff --git a/IkiWiki/Plugin/sparkline.pm b/IkiWiki/Plugin/sparkline.pm index dca755c63..1ed65e5b7 100644 --- a/IkiWiki/Plugin/sparkline.pm +++ b/IkiWiki/Plugin/sparkline.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::sparkline; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; use IPC::Open2; my $match_num=qr/[-+]?[0-9]+(?:\.[0-9]+)?/; diff --git a/IkiWiki/Plugin/table.pm b/IkiWiki/Plugin/table.pm index b6f53f607..479f3d745 100644 --- a/IkiWiki/Plugin/table.pm +++ b/IkiWiki/Plugin/table.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::table; use warnings; use strict; use Encode; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "table", call => \&getsetup); diff --git a/IkiWiki/Plugin/tag.pm b/IkiWiki/Plugin/tag.pm index ecc77cbb1..d43910910 100644 --- a/IkiWiki/Plugin/tag.pm +++ b/IkiWiki/Plugin/tag.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::tag; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; my %tags; diff --git a/IkiWiki/Plugin/template.pm b/IkiWiki/Plugin/template.pm index 1b7eb91bf..57bff20ff 100644 --- a/IkiWiki/Plugin/template.pm +++ b/IkiWiki/Plugin/template.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::template; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; use HTML::Template; use Encode; diff --git a/IkiWiki/Plugin/testpagespec.pm b/IkiWiki/Plugin/testpagespec.pm index a6e94dbbb..440fca33b 100644 --- a/IkiWiki/Plugin/testpagespec.pm +++ b/IkiWiki/Plugin/testpagespec.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::testpagespec; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "testpagespec", call => \&getsetup); diff --git a/IkiWiki/Plugin/teximg.pm b/IkiWiki/Plugin/teximg.pm index 57b23147e..dba5372b5 100644 --- a/IkiWiki/Plugin/teximg.pm +++ b/IkiWiki/Plugin/teximg.pm @@ -8,7 +8,7 @@ use strict; use Digest::MD5 qw(md5_hex); use File::Temp qw(tempdir); use HTML::Entities; -use IkiWiki 2.00; +use IkiWiki 3.00; my $default_prefix = < "getopt", id => "typography", call => \&getopt); diff --git a/IkiWiki/Plugin/version.pm b/IkiWiki/Plugin/version.pm index 3526dafde..587cd55fa 100644 --- a/IkiWiki/Plugin/version.pm +++ b/IkiWiki/Plugin/version.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::version; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "version", call => \&getsetup); diff --git a/IkiWiki/Plugin/websetup.pm b/IkiWiki/Plugin/websetup.pm index 66dacfde3..a47c29976 100644 --- a/IkiWiki/Plugin/websetup.pm +++ b/IkiWiki/Plugin/websetup.pm @@ -3,7 +3,7 @@ package IkiWiki::Plugin::websetup; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "websetup", call => \&getsetup); diff --git a/IkiWiki/Plugin/wikitext.pm b/IkiWiki/Plugin/wikitext.pm index 50571e524..accb03bbe 100644 --- a/IkiWiki/Plugin/wikitext.pm +++ b/IkiWiki/Plugin/wikitext.pm @@ -4,7 +4,7 @@ package IkiWiki::Plugin::wikitext; use warnings; use strict; -use IkiWiki 2.00; +use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "wiki", call => \&getsetup); diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index b6fa96f91..cb7571289 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -19,7 +19,7 @@ that can be fleshed out to make a useful plugin. `IkiWiki::Plugin::pagecount` is another simple example. All perl plugins should `use IkiWiki` to import the ikiwiki plugin interface. It's a good idea to include the version number of the plugin interface that your plugin -expects: `use IkiWiki 2.00`. +expects: `use IkiWiki 3.00`. An external plugin is an executable program. It can be written in any language. Its interface to ikiwiki is via XML RPC, which it reads from @@ -431,7 +431,7 @@ describes the plugin as a whole. For example: To import the ikiwiki plugin interface: - use IkiWiki '2.00'; + use IkiWiki '3.00'; This will import several variables and functions into your plugin's namespace. These variables and functions are the ones most plugins need, diff --git a/doc/plugins/write/tutorial.mdwn b/doc/plugins/write/tutorial.mdwn index e1b34b800..5345f71f2 100644 --- a/doc/plugins/write/tutorial.mdwn +++ b/doc/plugins/write/tutorial.mdwn @@ -27,7 +27,7 @@ important one is the IkiWiki module. use warnings; use strict; - use IkiWiki 2.00; + use IkiWiki 3.00; Ok, boilerplate is out of the way. Now to add the one function that ikiwiki expects to find in any module: `import`. The import function is called when diff --git a/doc/roadmap.mdwn b/doc/roadmap.mdwn index c85c6de5b..b2ff626ed 100644 --- a/doc/roadmap.mdwn +++ b/doc/roadmap.mdwn @@ -36,12 +36,14 @@ really bad bugs will be applied going forward. # 3.0 -Version 3.0 is an opportunity to make significant transitions, and also adds -many new features. +Version 3.0 is an opportunity to make significant transitions. +Read [[tips/upgrade_to_3.0]] for the steps you will need to +follow when upgrading your wiki to this version. -* See [[tips/upgrade_to_3.0]] for the steps you will need to follow - when upgrading to this version. -* Finalise a new version of the plugin API, exporting additional commonly +The highlights of the changes in version 3.0 include: + + +* A new version of the plugin API, exporting additional commonly used functions from IkiWiki.pm. See [[todo/firm_up_plugin_interface]] It will include a vast number of new features, bugfixes, and other diff --git a/doc/todo/firm_up_plugin_interface.mdwn b/doc/todo/firm_up_plugin_interface.mdwn index c2e190884..c7553f7dd 100644 --- a/doc/todo/firm_up_plugin_interface.mdwn +++ b/doc/todo/firm_up_plugin_interface.mdwn @@ -92,3 +92,5 @@ Probably needs to evolve more and be more widely used before being exported. * %IkiWiki::pagecase (aggregate) * %IkiWiki::backlinks (pagestats) + +[[done]] (until 4.0).. -- cgit v1.2.3 From c07a95ed8ecb84a2e7018c93c3d031f03bd25926 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 23 Dec 2008 17:11:04 -0500 Subject: remove globlist support No transition code implemented, but I will probably make a 2.x release that warns about found globlists. --- IkiWiki.pm | 45 -------------------------------------------- doc/ikiwiki/pagespec.mdwn | 19 ------------------- doc/plugins/contrib.mdwn | 2 +- doc/tips/upgrade_to_3.0.mdwn | 17 +++++++++++++++++ t/pagespec_match.t | 11 +---------- t/pagespec_merge.t | 12 ++++++------ 6 files changed, 25 insertions(+), 81 deletions(-) (limited to 'doc/plugins') diff --git a/IkiWiki.pm b/IkiWiki.pm index 759bfbc65..f6adb360a 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -1596,37 +1596,6 @@ sub rcs_receive () { $hooks{rcs}{rcs_receive}{call}->(); } -sub globlist_to_pagespec ($) { - my @globlist=split(' ', shift); - - my (@spec, @skip); - foreach my $glob (@globlist) { - if ($glob=~/^!(.*)/) { - push @skip, $glob; - } - else { - push @spec, $glob; - } - } - - my $spec=join(' or ', @spec); - if (@skip) { - my $skip=join(' and ', @skip); - if (length $spec) { - $spec="$skip and ($spec)"; - } - else { - $spec=$skip; - } - } - return $spec; -} - -sub is_globlist ($) { - my $s=shift; - return ( $s =~ /[^\s]+\s+([^\s]+)/ && $1 ne "and" && $1 ne "or" ); -} - sub safequote ($) { my $s=shift; $s=~s/[{}]//g; @@ -1718,26 +1687,12 @@ sub pagespec_merge ($$) { my $b=shift; return $a if $a eq $b; - - # Support for old-style GlobLists. - if (is_globlist($a)) { - $a=globlist_to_pagespec($a); - } - if (is_globlist($b)) { - $b=globlist_to_pagespec($b); - } - return "($a) or ($b)"; } sub pagespec_translate ($) { my $spec=shift; - # Support for old-style GlobLists. - if (is_globlist($spec)) { - $spec=globlist_to_pagespec($spec); - } - # Convert spec to perl code. my $code=""; while ($spec=~m{ diff --git a/doc/ikiwiki/pagespec.mdwn b/doc/ikiwiki/pagespec.mdwn index d4dd265cc..86abe5745 100644 --- a/doc/ikiwiki/pagespec.mdwn +++ b/doc/ikiwiki/pagespec.mdwn @@ -72,22 +72,3 @@ filenames of the pages in the wiki, so a pagespec "foo" used on page "a/b" will not match a page named "a/foo" or "a/b/foo". To match relative to the directory of the page containing the pagespec, you can use "./". For example, "./foo" on page "a/b" matches page "a/foo". - -## Old syntax - -The old PageSpec syntax was called a "GlobList", and worked differently in -two ways: - -1. "and" and "or" were not used; any page matching any item from the list - matched. -2. If an item was prefixed with "`!`", then no page matching that item - matched, even if it matched an earlier list item. - -For example, here is the old way to match all pages except for the SandBox -and Discussion pages: - - * !SandBox !*/Discussion - -Using this old syntax is still supported. However, the old syntax is -deprecated and will be removed at some point, and using the new syntax is -recommended. diff --git a/doc/plugins/contrib.mdwn b/doc/plugins/contrib.mdwn index 7a28edaba..e22b13f71 100644 --- a/doc/plugins/contrib.mdwn +++ b/doc/plugins/contrib.mdwn @@ -2,6 +2,6 @@ Contributed [[plugins]]: (See [[install]] for installation help.) -[[!inline pages="plugins/contrib/* !*/Discussion" +[[!inline pages="plugins/contrib/* and !*/Discussion" feedpages="created_after(plugins/contrib/navbar)" archive="yes" rootpage="plugins/contrib" postformtext="Add a new plugin named:" show=0]] diff --git a/doc/tips/upgrade_to_3.0.mdwn b/doc/tips/upgrade_to_3.0.mdwn index 6c74d4fc9..bd47e96e5 100644 --- a/doc/tips/upgrade_to_3.0.mdwn +++ b/doc/tips/upgrade_to_3.0.mdwn @@ -49,6 +49,23 @@ Be sure to modify the find to list all pages in the wiki if you're using other markup than markdown. You will probably want to commit the changes when you're done too. +## GlobLists + +In 3.0, the old "GlobList" syntax for [[PageSpecs|ikiwiki/PageSpec]] is no +longer supported. A GlobList contains multiple term, but does not separate +them with "and" or "or": + + sandbox !*/Discussion + +To convert this to a modern PageSpec, simply add "and" or "or" as +appropriate between terms: + + sandbox and !*/Discussion + +GlobLists have been deprecated for more than two years. If your wiki dates +to the ikiwiki 1.0 era, you should check it for any that might have lurked +unnoticed in it since back then. + ## aggregateinternal If your wiki uses the [[aggregate|plugins/aggregate]] plugin, it will start diff --git a/t/pagespec_match.t b/t/pagespec_match.t index 7c0ac235b..69cf361de 100755 --- a/t/pagespec_match.t +++ b/t/pagespec_match.t @@ -1,7 +1,7 @@ #!/usr/bin/perl use warnings; use strict; -use Test::More tests => 58; +use Test::More tests => 51; BEGIN { use_ok("IkiWiki"); } @@ -77,12 +77,3 @@ ok(! pagespec_match("foo", "no_such_function(foo)"), "foo"); my $ret=pagespec_match("foo", "(invalid"); ok(! $ret, "syntax error"); ok($ret =~ /syntax error/, "error message"); - -# old style globlists -ok(pagespec_match("foo", "foo bar"), "simple list"); -ok(pagespec_match("bar", "foo bar"), "simple list 2"); -ok(pagespec_match("foo", "f?? !foz")); -ok(! pagespec_match("foo", "f?? !foo")); -ok(! pagespec_match("foo", "* !foo")); -ok(! pagespec_match("foo", "foo !foo")); -ok(! pagespec_match("foo.png", "* !*.*")); diff --git a/t/pagespec_merge.t b/t/pagespec_merge.t index cbb06219c..9e38d5761 100755 --- a/t/pagespec_merge.t +++ b/t/pagespec_merge.t @@ -28,17 +28,17 @@ ok(same("!foo", "!bar", "foo"), "double inversion failed match"); ok(same("!foo", "!bar", "bar"), "double inversion failed match 2"); ok(same("*", "!bar", "foo"), "glob+inversion match"); ok(same("*", "!bar", "bar"), "matching glob and matching inversion"); -ok(same("* !foo", "!bar", "bar"), "matching glob and matching inversion"); -ok(same("* !foo", "!bar", "foo"), "matching glob with matching inversion and non-matching inversion"); -ok(same("* !foo", "!foo", "foo"), "matching glob with matching inversion and matching inversion"); +ok(same("* and !foo", "!bar", "bar"), "matching glob and matching inversion"); +ok(same("* and !foo", "!bar", "foo"), "matching glob with matching inversion and non-matching inversion"); +ok(same("* and !foo", "!foo", "foo"), "matching glob with matching inversion and matching inversion"); ok(same("b??", "!b??", "bar"), "matching glob and matching inverted glob"); ok(same("f?? !f??", "!bar", "bar"), "matching glob and matching inverted glob"); ok(same("b??", "!b?z", "bar"), "matching glob and non-matching inverted glob"); ok(same("f?? !f?z", "!bar", "bar"), "matching glob and non-matching inverted glob"); ok(same("!foo bar baz", "!bar", "bar"), "matching list and matching inversion"); ok(pagespec_match("foo/Discussion", - IkiWiki::pagespec_merge("* !*/Discussion", "*/Discussion")), "should match"); -ok(same("* !*/Discussion", "*/Discussion", "foo/Discussion"), "Discussion merge 1"); -ok(same("*/Discussion", "* !*/Discussion", "foo/Discussion"), "Discussion merge 2"); + IkiWiki::pagespec_merge("* and !*/Discussion", "*/Discussion")), "should match"); +ok(same("* and !*/Discussion", "*/Discussion", "foo/Discussion"), "Discussion merge 1"); +ok(same("*/Discussion", "* and !*/Discussion", "foo/Discussion"), "Discussion merge 2"); ok(same("*/Discussion !*/bar", "*/bar !*/Discussion", "foo/Discussion"), "bidirectional merge 1"); ok(same("*/Discussion !*/bar", "*/bar !*/Discussion", "foo/bar"), "bidirectional merge 2"); -- cgit v1.2.3 From 3fbe2569ff39c8e280a48c7623e325ef42ebedce Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 24 Dec 2008 16:22:35 -0500 Subject: remove deprecated googlecalendar plugin --- IkiWiki/Plugin/googlecalendar.pm | 55 ---------------------------------------- doc/plugins/discussion.mdwn | 9 ------- doc/plugins/googlecalendar.mdwn | 20 --------------- doc/tips/upgrade_to_3.0.mdwn | 5 ++++ 4 files changed, 5 insertions(+), 84 deletions(-) delete mode 100644 IkiWiki/Plugin/googlecalendar.pm delete mode 100644 doc/plugins/googlecalendar.mdwn (limited to 'doc/plugins') diff --git a/IkiWiki/Plugin/googlecalendar.pm b/IkiWiki/Plugin/googlecalendar.pm deleted file mode 100644 index fad2ad78f..000000000 --- a/IkiWiki/Plugin/googlecalendar.pm +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/perl -package IkiWiki::Plugin::googlecalendar; - -use warnings; -use strict; -use IkiWiki 3.00; - -sub import { - hook(type => "getsetup", id => "googlecalendar", - call => \&getsetup); - hook(type => "preprocess", id => "googlecalendar", - call => \&preprocess); - hook(type => "format", id => "googlecalendar", - call => \&format); -} - -sub getsetup () { - return - plugin => { - safe => 1, - rebuild => undef, - }, -} - -sub preprocess (@) { - my %params=@_; - - # Parse the html, looking for the url to embed for the calendar. - # Avoid XSS attacks.. - my ($url)=$params{html}=~m#iframe\s+src="http://www\.google\.com/calendar/embed\?([^"<>]+)"#; - if (! defined $url || ! length $url) { - error gettext("failed to find url in html") - } - my ($height)=$params{html}=~m#height="(\d+)"#; - my ($width)=$params{html}=~m#width="(\d+)"#; - - return "
    "; -} - -sub format (@) { - my %params=@_; - - $params{content}=~s/
    <\/div>/gencal($1,$2,$3)/eg; - - return $params{content}; -} - -sub gencal ($$$) { - my $url=shift; - my $height=shift; - my $width=shift; - return qq{}; -} - -1 diff --git a/doc/plugins/discussion.mdwn b/doc/plugins/discussion.mdwn index 70157f1e2..854307a98 100644 --- a/doc/plugins/discussion.mdwn +++ b/doc/plugins/discussion.mdwn @@ -34,12 +34,3 @@ Any objections to listing plugins alphabetically rather than by creation date? >> "recently changed" list with the 10 most recently changed plugins >> at the top. That would allow what you suggested, but still allow >> the main list to be alphabetical. -- [[Will]] - -How about adding a deprecated tag in order to clean up the plugin list? - -> AFAIK it's currently the only one. --[[Joey]] - -For instance [[googlecalendar]] is listed as plugin but should probably be removed from Ikiwiki in a future major version (v3?). - --- [[AlexandreDupas]] - diff --git a/doc/plugins/googlecalendar.mdwn b/doc/plugins/googlecalendar.mdwn deleted file mode 100644 index bca2ae74f..000000000 --- a/doc/plugins/googlecalendar.mdwn +++ /dev/null @@ -1,20 +0,0 @@ -[[!template id=plugin name=googlecalendar author="[[Joey]]"]] -[[!tag type/special-purpose]] - -*Note*: This plugin is deprecated. Please switch to the [[embed]] plugin. - -This plugin allows embedding a google calendar iframe in the wiki. -Normally, if the [[htmlscrubber]] is enabled, such iframes are scrubbed out -of the wiki content since they're not very safe if created by malicious -users. But some iframes are legitimate, and safe, if you trust the embedded -content. This plugin is an example of how to deal with this in ikiwiki. - -Example use: - - \[[!googlecalendar html=""" - - """]] - -The iframe should be the one provided by google. Note that it's used in a -way that avoids cross-site scripting attacks, assuming you trust google's -content. diff --git a/doc/tips/upgrade_to_3.0.mdwn b/doc/tips/upgrade_to_3.0.mdwn index ef9933583..50c420103 100644 --- a/doc/tips/upgrade_to_3.0.mdwn +++ b/doc/tips/upgrade_to_3.0.mdwn @@ -86,3 +86,8 @@ Otherwise, follow this procedure to upgrade a wiki using the aggregate plugin: files in the srcdir. The command to run is `ikiwiki-transition aggregateinternal your.setup`, 3. Refresh the wiki. (`ikiwiki -setup your.setup -refresh`) + +## googlecalendar + +This plugin has been deprecated for a long time, and is removed in 3.0. If +your wiki used it, you should enable the [[plugins/embed]] plugin, instead. -- cgit v1.2.3 From 04f064e78aedecc234e08bd9b49ae3674cb8f7bd Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 24 Dec 2008 19:43:07 -0500 Subject: make ikiwiki-transition prefix_directives take a setup file This is easier to remeber, and less error-prone than passing it all the pages in the wiki. --- debian/NEWS | 5 +---- doc/ikiwiki-transition.mdwn | 9 ++++----- doc/plugins/write.mdwn | 2 +- doc/tips/upgrade_to_3.0.mdwn | 13 ++++--------- ikiwiki-transition | 42 ++++++++++++++++++++++++++++++++---------- 5 files changed, 42 insertions(+), 29 deletions(-) (limited to 'doc/plugins') diff --git a/debian/NEWS b/debian/NEWS index 1c9763d1a..f9dfc3770 100644 --- a/debian/NEWS +++ b/debian/NEWS @@ -110,10 +110,7 @@ ikiwiki (2.40) unstable; urgency=low in their setup files. To convert your wiki to the new syntax, ikiwiki provides a new script - ikiwiki-transition. It will convert preprocessor directives in - all files given on the command line. To convert an entire wiki: - - find wikidir/ -type f -name '*.mdwn' -print0 | xargs -0 ikiwiki-transition prefix_directives + ikiwiki-transition. Even with prefix_directives disabled, ikiwiki now allows an optional '!' prefix on preprocessor directives (but still requires a space). Thus, a diff --git a/doc/ikiwiki-transition.mdwn b/doc/ikiwiki-transition.mdwn index 3a3529454..18836d5f5 100644 --- a/doc/ikiwiki-transition.mdwn +++ b/doc/ikiwiki-transition.mdwn @@ -12,16 +12,15 @@ ikiwiki-transition type ... change in ikiwiki syntax. It also handles other transitions not involving wiki pages. -# prefix_directives file ... +# prefix_directives your.setup -The `prefix_directives` mode converts the specified ikiwiki page from -the old preprocessor directive syntax, requiring a space, to the new -syntax, prefixed by '!'. +The `prefix_directives` mode converts all pages from the old preprocessor +directive syntax, requiring a space, to the new syntax, prefixed by '!'. Preprocessor directives which already use the new syntax will remain unchanged. -Note that if the page contains wiki links with spaces, which some +Note that if a page contains wiki links with spaces, which some older versions of ikiwiki accepted, the prefix_directives transition will treat these as preprocessor directives and convert them. diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index cb7571289..8992fad01 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -486,7 +486,7 @@ use the following hashes, using a page name as the key: destination file. * `%pagesources` contains the name of the source file for each page. -Also, the %IkiWiki::version variable contains the version number for the +Also, the `%IkiWiki::version` variable contains the version number for the ikiwiki program. ### Library functions diff --git a/doc/tips/upgrade_to_3.0.mdwn b/doc/tips/upgrade_to_3.0.mdwn index 50c420103..3a515a61f 100644 --- a/doc/tips/upgrade_to_3.0.mdwn +++ b/doc/tips/upgrade_to_3.0.mdwn @@ -23,7 +23,7 @@ your wiki is upgraded to 3.0. You can move these preferences into the setup file by running `ikiwiki-transition moveprefs your.setup` -(Make sure you have converted the setuop file to the new format first.) +(Make sure you have converted the setup file to the new format first.) ## prefix directives @@ -37,15 +37,10 @@ following to your setup file: prefix_directives => 0, -But it's not hard to convert your wiki to the new syntax. You can use -[[ikiwiki-transition]]. It will convert preprocessor directives in all -files given on the command line. To convert an entire wiki: +To convert to the new syntax, run +`ikiwiki-transition prefix_directives your.setup` - find wikidir/ -type f -name '*.mdwn' -print0 | xargs -0 ikiwiki-transition prefix_directives - -Be sure to modify the find to list all pages in the wiki if you're using -other markup than markdown. You will probably want to commit the changes -when you're done too. +(And then commit the changes it makes to pages in your srcdir.) ## GlobLists diff --git a/ikiwiki-transition b/ikiwiki-transition index 9a5dd1362..b15d9f46b 100755 --- a/ikiwiki-transition +++ b/ikiwiki-transition @@ -1,4 +1,4 @@ -#!/usr/bin/perl -i +#!/usr/bin/perl use warnings; use strict; use IkiWiki; @@ -42,11 +42,33 @@ sub handle_directive { } sub prefix_directives { - $/=undef; # process whole files at once - - while (<>) { - s{$regex}{handle_directive($1, $2, $3, $4)}eg; - print; + my $setup=shift; + if (! defined $setup) { + usage(); + } + + require IkiWiki::Setup; + require IkiWiki::Plugin::aggregate; + + %config = IkiWiki::defaultconfig(); + IkiWiki::Setup::load($setup); + IkiWiki::loadplugins(); + IkiWiki::checkconfig(); + IkiWiki::loadindex(); + + if (! %pagesources) { + error "ikiwiki has not built this wiki yet, cannot transition"; + } + + foreach my $page (values %pagesources) { + next unless defined pagetype($page) && + -f $config{srcdir}."/".$page; + my $content=readfile($config{srcdir}."/".$page); + my $oldcontent=$content; + $content=~s{$regex}{handle_directive($1, $2, $3, $4)}eg; + if ($oldcontent ne $content) { + writefile($page, $config{srcdir}, $content); + } } } @@ -109,7 +131,7 @@ sub aggregateinternal { require IkiWiki::Plugin::aggregate; %config = IkiWiki::defaultconfig(); - IkiWiki::Setup::load(); + IkiWiki::Setup::load($setup); IkiWiki::checkconfig(); IkiWiki::Plugin::aggregate::migrate_to_internal(); @@ -196,12 +218,12 @@ sub moveprefs { sub usage { print STDERR "Usage: ikiwiki-transition type ...\n"; print STDERR "Currently supported transition subcommands:\n"; - print STDERR "\tprefix_directives file ...\n"; - print STDERR "\tindexdb srcdir\n"; - print STDERR "\thashpassword srcdir\n"; + print STDERR "\tprefix_directives setupfile ...\n"; print STDERR "\taggregateinternal setupfile\n"; print STDERR "\tsetupformat setupfile\n"; print STDERR "\tmoveprefs setupfile\n"; + print STDERR "\thashpassword srcdir\n"; + print STDERR "\tindexdb srcdir\n"; exit 1; } -- cgit v1.2.3 From dbd95c67bc787e57063f58f7cf0472375d35cd75 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 26 Dec 2008 15:06:00 -0500 Subject: add link to untrusted git push --- doc/plugins/lockedit.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/lockedit.mdwn b/doc/plugins/lockedit.mdwn index d2e98e07a..c8f64ea47 100644 --- a/doc/plugins/lockedit.mdwn +++ b/doc/plugins/lockedit.mdwn @@ -4,7 +4,7 @@ This plugin allows the administrator of a wiki to lock some pages, limiting who can edit them using the online interface. This doesn't prevent anyone who can commit to the underlying revision control system from editing the -pages, however. +pages, however. (Unless you set up [[tips/untrusted_git_push]].) The `locked_pages` setting configures what pages are locked. It is a [[ikiwiki/PageSpec]], so you have lots of control over what kind of pages -- cgit v1.2.3 From c2d2ff0199f16e028431cd83961b1bff5e2caa99 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 26 Dec 2008 15:27:49 -0500 Subject: deprecate embed plugin too I see that this plugin's lists of safe content are already well out of date, and htmlscrubber_skip offers a non whitelist based approach, so let's deprecate this plugin for 3.0. --- debian/changelog | 5 ++++- doc/plugins/embed.mdwn | 8 ++++++++ doc/plugins/htmlscrubber.mdwn | 8 ++++---- doc/tips/embedding_content.mdwn | 35 +++++++++++++++++++++++++++++++++++ doc/tips/upgrade_to_3.0.mdwn | 13 ++++++++++--- 5 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 doc/tips/embedding_content.mdwn (limited to 'doc/plugins') diff --git a/debian/changelog b/debian/changelog index 9a96f7415..ddb979c31 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,7 +8,10 @@ ikiwiki (3.00) UNRELEASED; urgency=low admin preferences into a setup file. * prefix_directives and aggregate_internal are now turned on by default. * ikiwiki-transition prefix_directives syntax changed - * googlecalendar: removed this deprecated plugin. Use embed instead. + * googlecalendar: removed this deprecated plugin. Use htmlscrubber_skip + instead. + * embed: This plugin is deprecated, use htmlscrubber_skip instead. + Closes: ##462970. * Version 3.00 of the plugin API. -- Joey Hess Wed, 24 Dec 2008 19:49:36 -0500 diff --git a/doc/plugins/embed.mdwn b/doc/plugins/embed.mdwn index 1d43061e0..2baf07da5 100644 --- a/doc/plugins/embed.mdwn +++ b/doc/plugins/embed.mdwn @@ -13,6 +13,14 @@ In the examples below, the parts of the html that you can change are denoted with "XXX"; everything else must appear exactly as shown to be accepted by the plugin. +*This plugin is deprecated.* Rather than relying on these complex lists +of safe content, which constantly fall out of date, you're recommended to +configure the [[htmlscrubber]] to not scrub some pages, which only trusted +users can edit. Then you can embed anything from anywhere on those pages. +See [[tips/embedding_content]] for details and examples. +This plugin's lists of safe embedded content will not be maintained, and +the plugin will be removed in a future release. + ## google maps Use html like this to embed a map: diff --git a/doc/plugins/htmlscrubber.mdwn b/doc/plugins/htmlscrubber.mdwn index b9f7e6d22..c59b46e14 100644 --- a/doc/plugins/htmlscrubber.mdwn +++ b/doc/plugins/htmlscrubber.mdwn @@ -32,10 +32,10 @@ other HTML-related functionality, such as whether [[meta]] allows potentially unsafe HTML tags. The `htmlscrubber_skip` configuration setting can be used to skip scrubbing -of some pages. Set it to a [[ikiwiki/PageSpec]], such as "!*/Discussion", and pages -matching that can have all the evil CSS, JavsScript, and unsafe html -elements you like. One safe way to use this is to use [[lockedit]] to lock -those pages, so only admins can edit them. +of some pages. Set it to a [[ikiwiki/PageSpec]], such as "!*/Discussion", +and pages matching that can have all the evil CSS, JavsScript, and unsafe +html elements you like. One safe way to use this is to use [[lockedit]] to +lock those pages, so only admins can edit them. ---- diff --git a/doc/tips/embedding_content.mdwn b/doc/tips/embedding_content.mdwn new file mode 100644 index 000000000..666f4dab3 --- /dev/null +++ b/doc/tips/embedding_content.mdwn @@ -0,0 +1,35 @@ +Content from sites such as YouTube can be embedded into a web page. Maybe +you want to do this. But you'll find that the [[plugins/htmlscrubber]] +doesn't let you. It blocks the tags used to embed such content, because +they can be abused in many evil ways. + +Some plugins have been written to try to work around this problem, by +whitelisting the html needed to embed things from a few sites like Google +calendar, videos, and YouTube. The problem with these plugins is that they +have to be kept up to date to add new sites, and follow changes to the html +such sites use for embedding. + +(Digression: The real problem with the plugins is that they hide the +underlying trust relationship. If you decide to embed html from a site, +you'd better trust that site. And if ikiwiki lets you enter such html, it +needs to trust you.) + +The [[plugins/htmlscrubber]] offers a different way around this problem. +You can configure it to skip scrubbing certian pages, so that content from +elsewhere can be embedded on those pages. Then use [[plugins/lockedit]] +to limit who can edit those unscrubbed pages. + +For example, suppose your blog is all under `blog/*`, and you want +only yourself to be able to post there, and you'd like to be able to embed +youtube videos etc in your blog. Other users can edit some pages in the +wiki (Discussion pages, say), but not your blog posts. Then you could configure +ikiwiki as follows: + + htmlscrubber_skip => 'blog/* and !*/Discussion', + locked_pages => '!*/Discussion', + +More simply, you might want to allow yourself to embed content anywhere +on the wiki, but scrub content written on Discussion pages: + + htmlscrubber_skip => '!*/Discussion', + locked_pages => '!*/Discussion', diff --git a/doc/tips/upgrade_to_3.0.mdwn b/doc/tips/upgrade_to_3.0.mdwn index 3a515a61f..a9664dfc3 100644 --- a/doc/tips/upgrade_to_3.0.mdwn +++ b/doc/tips/upgrade_to_3.0.mdwn @@ -82,7 +82,14 @@ Otherwise, follow this procedure to upgrade a wiki using the aggregate plugin: `ikiwiki-transition aggregateinternal your.setup`, 3. Refresh the wiki. (`ikiwiki -setup your.setup -refresh`) -## googlecalendar +## embed / googlecalendar -This plugin has been deprecated for a long time, and is removed in 3.0. If -your wiki used it, you should enable the [[plugins/embed]] plugin, instead. +The googlecalendar plugin has been deprecated for a long time, and is +removed in 3.0. + +The embed plugin is also now deprecated, though not yet removed. + +If you use either plugin to embed content from google, youtube, etc, +into your wiki, you should instead configure the [[plugins/htmlscrubber]] +to skip sanitising some pages, via the `htmlscrubber_skip` setting. +See [[embedding_content]] for examples. -- cgit v1.2.3 From 7da319efc69089662f9635216bbcc48ca53fe606 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 26 Dec 2008 16:08:33 -0500 Subject: inline: Run format hook first inline has a format hook that is an optimisation hack. Until this hook runs, the inlined content is not present on the page. This can prevent other format hooks, that process that content, from acting on inlined content. In bug ##509710, we discovered this happened commonly for the embed plugin, but it could in theory happen for many other plugins (color, cutpaste, etc) that use format to fill in special html after sanitization. The ordering was essentially random (hash key order). That's kinda a good thing, because hooks should be independent of other hooks and able to run in any order. But for things like inline, that just doesn't work. To fix the immediate problem, let's make hooks able to be registered as running "first". There was already the ability to make them run "last". Now, this simple first/middle/last ordering is obviously not going to work if a lot of things need to run first, or last, since then we'll be back to being unable to specify ordering inside those sets. But before worrying about that too much, and considering dependency ordering, etc, observe how few plugins use last ordering: Exactly one needs it. And, so far, exactly one needs first ordering. So for now, KISS. Another implementation note: I could have sorted the plugins with first/last/middle as the primary key, and plugin name secondary, to get a guaranteed stable order. Instead, I chose to preserve hash order. Two opposing things pulled me toward that decision: 1. Since has order is randomish, it will ensure that no accidental ordering assumptions are made. 2. Assume for a minute that ordering matters a lot more than expected. Drastically changing the order a particular configuration uses could result in a lot of subtle bugs cropping up. (I hope this assumption is false, partly due to #1, but can't rule it out.) --- IkiWiki.pm | 16 ++++++++++------ IkiWiki/Plugin/inline.pm | 4 ++-- debian/changelog | 2 ++ doc/plugins/write.mdwn | 4 ++-- 4 files changed, 16 insertions(+), 10 deletions(-) (limited to 'doc/plugins') diff --git a/IkiWiki.pm b/IkiWiki.pm index cc1e89acc..54e00ec7b 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -1536,15 +1536,19 @@ sub run_hooks ($$) { my $sub=shift; if (exists $hooks{$type}) { - my @deferred; + my (@first, @middle, @last); foreach my $id (keys %{$hooks{$type}}) { - if ($hooks{$type}{$id}{last}) { - push @deferred, $id; - next; + if ($hooks{$type}{$id}{first}) { + push @first, $id; + } + elsif ($hooks{$type}{$id}{last}) { + push @last, $id; + } + else { + push @middle, $id; } - $sub->($hooks{$type}{$id}{call}); } - foreach my $id (@deferred) { + foreach my $id (@first, @middle, @last) { $sub->($hooks{$type}{$id}{call}); } } diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 8490b455f..58da0beb8 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -1,4 +1,4 @@ -#!/usr/bin/perl +!/usr/bin/perl # Page inlining and blogging. package IkiWiki::Plugin::inline; @@ -22,7 +22,7 @@ sub import { call => \&IkiWiki::preprocess_inline); hook(type => "pagetemplate", id => "inline", call => \&IkiWiki::pagetemplate_inline); - hook(type => "format", id => "inline", call => \&format); + hook(type => "format", id => "inline", call => \&format, first => 1); # Hook to change to do pinging since it's called late. # This ensures each page only pings once and prevents slow # pings interrupting page builds. diff --git a/debian/changelog b/debian/changelog index 96a70fcc9..0fa6590f0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,8 @@ ikiwiki (2.72) UNRELEASED; urgency=low * camelcase: Add camelcase_ignore setting. * googlecalendar: Add runtime deprecation warning. * comments: Deal with users entering unqualified or partial urls. + * inline: Run format hook first, to ensure other format hooks can affect + inlined content. Closes: #509710 -- Joey Hess Mon, 22 Dec 2008 19:02:16 -0500 diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index b6fa96f91..9b5cf27f7 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -55,8 +55,8 @@ plugin, and a "call" parameter, which tells what function to call for the hook. An optional "last" parameter, if set to a true value, makes the hook run -after all other hooks of its type. Useful if the hook depends on some other -hook being run first. +after all other hooks of its type, and an optional "first" parameter makes +it run first. Useful if the hook depends on some other hook being run first. ## Types of hooks -- cgit v1.2.3 From 484cb2ddcff437fbb173881ba6f00b670886745f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 31 Dec 2008 15:28:03 -0500 Subject: formatting --- doc/plugins/embed.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/embed.mdwn b/doc/plugins/embed.mdwn index 2baf07da5..85592cb72 100644 --- a/doc/plugins/embed.mdwn +++ b/doc/plugins/embed.mdwn @@ -13,7 +13,7 @@ In the examples below, the parts of the html that you can change are denoted with "XXX"; everything else must appear exactly as shown to be accepted by the plugin. -*This plugin is deprecated.* Rather than relying on these complex lists +**This plugin is deprecated.** Rather than relying on these complex lists of safe content, which constantly fall out of date, you're recommended to configure the [[htmlscrubber]] to not scrub some pages, which only trusted users can edit. Then you can embed anything from anywhere on those pages. -- cgit v1.2.3 From 0bf9ea723ad8969a422b4589ced8385ef6c0f170 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Fri, 2 Jan 2009 11:21:18 +0100 Subject: meta branch merge required Signed-off-by: intrigeri --- doc/bugs/pagetitle_function_does_not_respect_meta_titles.mdwn | 2 ++ doc/plugins/contrib/po.mdwn | 5 +++++ 2 files changed, 7 insertions(+) (limited to 'doc/plugins') diff --git a/doc/bugs/pagetitle_function_does_not_respect_meta_titles.mdwn b/doc/bugs/pagetitle_function_does_not_respect_meta_titles.mdwn index 158656a13..cccd53d05 100644 --- a/doc/bugs/pagetitle_function_does_not_respect_meta_titles.mdwn +++ b/doc/bugs/pagetitle_function_does_not_respect_meta_titles.mdwn @@ -14,3 +14,5 @@ The `IkiWiki::pagetitle` function does not respect title changes via `meta.title >> It was actually more complicated than expected. A working prototype is >> now in my `meta` branch, see my userpage for the up-to-date url. >> Thus tagging [[patch]]. --[[intrigeri]] +>> +>>> Joey, please consider merging my `meta` branch. --[[intrigeri]] diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index f90ffeed2..9919ac595 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -139,6 +139,11 @@ Any thoughts on this? >>>>> to have the links text generation more customizable through >>>>> plugins, I could do both at the same time if we consider this >>>>> matter to be important enough. --[[intrigeri]] +>>>>> +>>>>>> The translation status in links is now implemented in my +>>>>>> `po`branch. It requires my `meta` branch changes to +>>>>>> work, though. I consider the latter to be mature enough to +>>>>>> be merged. --[[intrigeri]] >> FWIW, I'm tracking your po branch in ikiwiki master git in the po >> branch. One thing I'd like to try in there is setting up a translated -- cgit v1.2.3 From ba47fe42465b1e1bc5bef7f82ceeac8f3feee696 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Fri, 2 Jan 2009 12:54:58 +0100 Subject: po: added note about now implemented feature Signed-off-by: intrigeri --- doc/plugins/contrib/po.mdwn | 3 +++ 1 file changed, 3 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index 9919ac595..edd665185 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -86,6 +86,9 @@ Any thoughts on this? >>> to avoid breaking existing functionality, it implies to hack a bit >>> [[plugins/edittemplate]] so that multiple templates can be >>> inserted at page creation time. [[--intrigeri]] +>>> +>>>> I implemented such a warning using the formbuilder_setup hook. +>>>> --[[intrigeri]] >> >> And also, is there any way to start a translation of a page into a new >> lanauge using the web interface? -- cgit v1.2.3 From 81b088866be5f55433c12e09c90e2ae404a8ed89 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 7 Jan 2009 15:48:07 -0500 Subject: repolist: New plugin to support the rel=vcs-* microformat. * repolist: New plugin to support the rel=vcs-* microformat. * goodstuff: Include repolist by default. (But it does nothing until configured with the repository locations.) --- IkiWiki/Plugin/goodstuff.pm | 1 + IkiWiki/Plugin/repolist.pm | 51 +++++++++++++++++++++++++++++++++++++++++++++ debian/changelog | 3 +++ doc/pagehistory.mdwn | 3 +++ doc/plugins/goodstuff.mdwn | 1 + doc/plugins/repolist.mdwn | 17 +++++++++++++++ templates/page.tmpl | 1 + 7 files changed, 77 insertions(+) create mode 100644 IkiWiki/Plugin/repolist.pm create mode 100644 doc/plugins/repolist.mdwn (limited to 'doc/plugins') diff --git a/IkiWiki/Plugin/goodstuff.pm b/IkiWiki/Plugin/goodstuff.pm index 46f2380cf..451cd6f84 100644 --- a/IkiWiki/Plugin/goodstuff.pm +++ b/IkiWiki/Plugin/goodstuff.pm @@ -22,6 +22,7 @@ my @bundle=qw{ template toc toggle + repolist }; sub import { diff --git a/IkiWiki/Plugin/repolist.pm b/IkiWiki/Plugin/repolist.pm new file mode 100644 index 000000000..f69ec3988 --- /dev/null +++ b/IkiWiki/Plugin/repolist.pm @@ -0,0 +1,51 @@ +#!/usr/bin/perl +package IkiWiki::Plugin::repolist; + +use warnings; +use strict; +use IkiWiki 3.00; + +sub import { + hook(type => "getsetup", id => "repolist", call => \&getsetup); + hook(type => "checkconfig", id => "repolist", call => \&checkconfig); +} + +sub getsetup () { + return + plugin => { + safe => 1, + rebuild => undef, + }, + repositories => { + type => "string", + example => ["svn://svn.example.org/wiki/trunk"], + description => "URIs of repositories containing the wiki's source", + safe => 1, + rebuild => undef, + }, +} + +my $relvcs; + +sub checkconfig () { + if (defined $config{rcs} && $config{repositories}) { + $relvcs=join("\n", map { + s/"//g; # avoid quotes just in case + qq{} + } @{$config{repositories}}); + + hook(type => "pagetemplate", id => "repolist", call => \&pagetemplate); + } +} + +sub pagetemplate (@) { + my %params=@_; + my $page=$params{page}; + my $template=$params{template}; + + if (defined $relvcs && $template->query(name => "relvcs")) { + $template->param(relvcs => $relvcs); + } +} + +1 diff --git a/debian/changelog b/debian/changelog index f4f9df041..74556906e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,9 @@ ikiwiki (3.02) UNRELEASED; urgency=low * table: Find links in external files in scan pass. * rename: Show full names of affected pages. * comments: Fix cache avoidance hack. + * repolist: New plugin to support the rel=vcs-* microformat. + * goodstuff: Include repolist by default. (But it does nothing until + configured with the repository locations.) -- Joey Hess Tue, 06 Jan 2009 15:02:52 -0500 diff --git a/doc/pagehistory.mdwn b/doc/pagehistory.mdwn index fc2a3f543..465062736 100644 --- a/doc/pagehistory.mdwn +++ b/doc/pagehistory.mdwn @@ -3,3 +3,6 @@ revison history of a page. This is enabled by the `historyurl` setting, which is used to specify the URL to a web interface such as [[ViewVC]] (for Subversion) or [[Gitweb]]. In that url, "\[[file]]" is replaced with the name of the file to view. + +The [[plugins/repolist]] plugin can suppliment this information with +urls to the underlying repository of the wiki. diff --git a/doc/plugins/goodstuff.mdwn b/doc/plugins/goodstuff.mdwn index ed57c0f01..ee1bffcfa 100644 --- a/doc/plugins/goodstuff.mdwn +++ b/doc/plugins/goodstuff.mdwn @@ -24,5 +24,6 @@ Currently included: * [[template]] * [[toc]] * [[toggle]] +* [[repolist]] New plugins will be added to this bundle from time to time. diff --git a/doc/plugins/repolist.mdwn b/doc/plugins/repolist.mdwn new file mode 100644 index 000000000..9b3a7575e --- /dev/null +++ b/doc/plugins/repolist.mdwn @@ -0,0 +1,17 @@ +[[!template id=plugin name=repolist author="[[Joey]]"]] +[[!tag type/useful]] + +This plugin allows you to configure ikiwiki with the location of +[[rcs]] repositories for your wiki's source. This is done via the +"repositories" setting in the setup file. Once you tell it where the source +to your wiki can be downloaded from, this information can be published on +your wiki in various ways. + +This plugin supports the [rel-vcs-*](http://kitenet.net/~joey/rfc/rel-vcs/) +microformat, and uses it to embed the repository location information in +every wiki page. + +By using this plugin, you will make [[Joey]] very happy, as he will be able +to easily check out the source of your wiki, for purposes of debugging and +general curiosity. More generally, making it easy for others to find the +repository for your wiki is just a Plain Good Idea(TM). diff --git a/templates/page.tmpl b/templates/page.tmpl index f75491127..29ba688c7 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -13,6 +13,7 @@ + -- cgit v1.2.3 From f7b2cfcf50f12ad6ce7358f74e8db9d6083aa284 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 16 Jan 2009 20:46:55 -0500 Subject: checkcontent: New hook, can be used to implement arbitrary content filters, including spam filters. --- IkiWiki/Plugin/comments.pm | 13 ++++++++++-- IkiWiki/Plugin/editpage.pm | 53 ++++++++++++++++++++++++++++++++++++++++------ debian/changelog | 2 ++ doc/plugins/write.mdwn | 22 ++++++++++++++++++- 4 files changed, 80 insertions(+), 10 deletions(-) (limited to 'doc/plugins') diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index 16f9a873f..14e785c8f 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -467,9 +467,18 @@ sub sessioncgi ($$) { } if ($form->submitted eq POST_COMMENT && $form->validate) { - my $file = "$location._comment"; - IkiWiki::checksessionexpiry($cgi, $session); + + IkiWiki::check_content(content => $form->field('editcontent'), + subject => $form->field('subject'), + $config{comments_allowauthor} ? ( + author => $form->field('author'), + url => $form->field('url'), + ) : (), + page => $location, + cgi => $cgi, session => $session); + + my $file = "$location._comment"; # FIXME: could probably do some sort of graceful retry # on error? Would require significant unwinding though diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm index ed994306f..bba52e4fd 100644 --- a/IkiWiki/Plugin/editpage.pm +++ b/IkiWiki/Plugin/editpage.pm @@ -78,7 +78,43 @@ sub check_canedit ($$$;$) { } } }); - return $canedit; + return defined $canedit ? $canedit : 1; +} + +sub check_content (@) { + my %params=@_; + + return 1 if ! exists $hooks{checkcontent}; # optimisation + + if (exists $pagesources{$params{page}}) { + my @diff; + my %old=map { $_ => 1 } + split("\n", readfile(srcfile($pagesources{$params{page}}))); + foreach my $line (split("\n", $params{content})) { + push @diff, $line if ! exists $old{$_}; + } + $params{content}=join("\n", @diff); + } + + my $ok; + run_hooks(checkcontent => sub { + return if defined $ok; + my $ret=shift->(%params); + if (defined $ret) { + if ($ret eq "") { + $ok=1; + } + elsif (ref $ret eq 'CODE') { + $ret->(); + $ok=0; + } + elsif (defined $ret) { + error($ret); + } + } + + }); + return defined $ok ? $ok : 1; } sub cgi_editpage ($$) { @@ -368,8 +404,17 @@ sub cgi_editpage ($$) { showform($form, \@buttons, $session, $q, forcebaseurl => $baseurl); exit; } + + my $message=""; + if (defined $form->field('comments') && + length $form->field('comments')) { + $message=$form->field('comments'); + } my $content=$form->field('editcontent'); + check_content(content => $content, page => $page, + cgi => $q, session => $session, + subject => $message); run_hooks(editcontent => sub { $content=shift->( content => $content, @@ -403,12 +448,6 @@ sub cgi_editpage ($$) { my $conflict; if ($config{rcs}) { - my $message=""; - if (defined $form->field('comments') && - length $form->field('comments')) { - $message=$form->field('comments'); - } - if (! $exists) { rcs_add($file); } diff --git a/debian/changelog b/debian/changelog index f35606148..b75fe6afc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,6 +18,8 @@ ikiwiki (3.02) UNRELEASED; urgency=low behave better. * Add auto-blog.setup, which will set up an ikiwiki instance tuned for use in blogging. + * checkcontent: New hook, can be used to implement arbitrary content + filters, including spam filters. -- Joey Hess Tue, 06 Jan 2009 15:02:52 -0500 diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 405876d58..99eea3d16 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -303,7 +303,7 @@ can check if the session object has a "name" parameter set. ### canedit - hook(type => "canedit", id => "foo", call => \&pagelocked); + hook(type => "canedit", id => "foo", call => \&canedit); This hook can be used to implement arbitrary access methods to control when a page can be edited using the web interface (commits from revision control @@ -321,6 +321,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. +### checkcontent + + hook(type => "checkcontent", id => "foo", call => \&checkcontent); + +This hook is called to check the content a user has entered on a page, +before it is saved, and decide if it should be allowed. + +It is passed named parameters: `content`, `page`, `cgi`, and `session`. If +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. + +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 +that can be run to perform whatever action is necessary to allow the user +to post the content. + ### editcontent hook(type => "editcontent", id => "foo", call => \&editcontent); -- cgit v1.2.3 From 7ee92cab4095fb22d77a0b0100a472c6901eb519 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 16 Jan 2009 22:39:11 -0500 Subject: blogspam: New plugin, adding spam filtering for page editing / comment posting using the BlogSpam.net API. --- IkiWiki/Plugin/blogspam.pm | 111 +++++++++++++++++++++++++++++++++++++ debian/changelog | 2 + doc/plugins/blogspam.mdwn | 23 ++++++++ doc/todo/anti-spam_protection.mdwn | 11 ++++ t/syntax.t | 4 +- 5 files changed, 149 insertions(+), 2 deletions(-) create mode 100644 IkiWiki/Plugin/blogspam.pm create mode 100644 doc/plugins/blogspam.mdwn (limited to 'doc/plugins') diff --git a/IkiWiki/Plugin/blogspam.pm b/IkiWiki/Plugin/blogspam.pm new file mode 100644 index 000000000..6e68a9856 --- /dev/null +++ b/IkiWiki/Plugin/blogspam.pm @@ -0,0 +1,111 @@ +#!/usr/bin/perl +package IkiWiki::Plugin::blogspam; + +use warnings; +use strict; +use IkiWiki 3.00; +require RPC::XML; +require RPC::XML::Client; + +my $defaulturl='http://test.blogspam.net:8888/'; + +sub import { + hook(type => "getsetup", id => "blogspam", call => \&getsetup); + hook(type => "checkcontent", id => "blogspam", call => \&checkcontent); +} + +sub getsetup () { + return + plugin => { + safe => 1, + rebuild => 0, + }, + blogspam_pagespec => { + type => 'pagespec', + example => 'postcomment(*)', + description => 'PageSpec of pages to check for spam', + link => 'ikiwiki/PageSpec', + safe => 1, + rebuild => 0, + }, + blogspam_options => { + type => "string", + example => "blacklist=1.2.3.4,blacklist=8.7.6.5,max-links=10", + description => "options to send to blogspam server", + link => "http://blogspam.net/api/testComment.html#options", + safe => 1, + rebuild => 0, + }, + blogspam_server => { + type => "string", + default => $defaulturl, + description => "blogspam server XML-RPC url", + safe => 1, + rebuild => 0, + }, +} + +sub checkcontent (@) { + my %params=@_; + + if (exists $config{blogspam_pagespec}) { + return undef + if ! pagespec_match($params{page}, $config{blogspam_pagespec}, + location => $params{page}); + } + + my $url=$defaulturl; + $url = $params{blogspam_server} if exists $params{blogspam_server}; + my $client = RPC::XML::Client->new($url); + + my @options = split(",", $params{blogspam_options}) + if exists $params{blogspam_options}; + + # Allow short comments and whitespace-only edits, unless the user + # has overridden min-words themselves. + push @options, "min-words=0" + unless grep /^min-words=/i, @options; + # Wiki pages can have a lot of urls, unless the user specifically + # wants to limit them. + push @options, "exclude=lotsaurls" + unless grep /^max-links/i, @options; + # Unless the user specified a size check, disable such checking. + push @options, "exclude=size" + unless grep /^(?:max|min)-size/i, @options; + # This test has absurd false positives on words like "alpha" + # and "buy". + push @options, "exclude=stopwords"; + + # blogspam API does not have a field for author url, so put it in + # the content to be checked. + if (exists $params{url}) { + $params{content}.="\n".$params{url}; + } + + my $res = $client->send_request('testComment', { + ip => $ENV{REMOTE_ADDR}, + comment => $params{content}, + subject => defined $params{subject} ? $params{subject} : "", + name => defined $params{author} ? $params{author} : "", + options => join(",", @options), + site => $config{url}, + version => "ikiwiki ".$IkiWiki::version, + }); + + if (! ref $res || ! defined $res->value) { + debug("failed to get response from blogspam server ($url)"); + return undef; + } + elsif ($res->value =~ /^SPAM:(.*)/) { + return gettext("Sorry, but that looks like spam to blogspam: ").$1; + } + elsif ($res->value ne 'OK') { + debug(gettext("blogspam server failure: ").$res->value); + return undef; + } + else { + return undef; + } +} + +1 diff --git a/debian/changelog b/debian/changelog index b75fe6afc..cb362d6e2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -20,6 +20,8 @@ ikiwiki (3.02) UNRELEASED; urgency=low in blogging. * checkcontent: New hook, can be used to implement arbitrary content filters, including spam filters. + * blogspam: New plugin, adding spam filtering for page editing / comment + posting using the BlogSpam.net API. -- Joey Hess Tue, 06 Jan 2009 15:02:52 -0500 diff --git a/doc/plugins/blogspam.mdwn b/doc/plugins/blogspam.mdwn new file mode 100644 index 000000000..307d4646d --- /dev/null +++ b/doc/plugins/blogspam.mdwn @@ -0,0 +1,23 @@ +[[!template id=plugin name=blogspam author="[[Joey]]"]] +[[!tag type/auth]] + +This plugin adds antispam support to ikiwiki, using the +[blogspam.net](http://blogspam.net/) API. Both page edits and +[[comment|comments]] postings can be checked for spam. Currently, +detected spam is not saved for human review, it is just rejected. + +You can control how content is tested via the `blogspam_options` +setting. By default, the options are configured in a way that is +appropriate for wiki content. This includes turning off some of the +more problimatic tests. + +The `blogspam_pagespec` setting is a [[ikiwiki/PageSpec]] that can be +used to configure which pages are checked for spam. The default is to check +all edits. If you only want to check [[comments]] (not wiki page edits), +set it to "postcomment(*)". + +By default, the blogspam.net server is used to do the spam checking. To +change this, the `blogspam_server` option can be set to the url for a +different server implementing the same API. Note that content is sent +unencrypted over the internet to the server, and the server sees +the full text of the content. diff --git a/doc/todo/anti-spam_protection.mdwn b/doc/todo/anti-spam_protection.mdwn index cb45faee5..b0524be5f 100644 --- a/doc/todo/anti-spam_protection.mdwn +++ b/doc/todo/anti-spam_protection.mdwn @@ -17,3 +17,14 @@ Cheers, You might look at the Wikipedia page on "Spam\_in\_blogs" for more ideas. In particular, would it be possible to force a subset of the pages (by regex, but you'd choose the regex to match those pages which are publicly writable) to use rel="nofollow" in all links. > I just wanted to leave a link here to the [[todo/require_CAPTCHA_to_edit]] plugin patch. Unfortunately that plugin currently interacts badly with the openid plugin. -- [[Will]] + + +--- + +Ikiwiki now has a checkcontent hook that plugins can use to see content +that is being entered and check it for spam/whatever. + +There is a blogspam plugin that uses the blogspam.org service +to check for common spam signatures. --[[Joey]] + +[[done]] diff --git a/t/syntax.t b/t/syntax.t index d09d17f7f..9d5cbc373 100755 --- a/t/syntax.t +++ b/t/syntax.t @@ -5,8 +5,8 @@ use Test::More; my @progs="ikiwiki.in"; my @libs="IkiWiki.pm"; -# monotone, external, amazon_s3 skipped since they need perl modules -push @libs, map { chomp; $_ } `find IkiWiki -type f -name \\*.pm | grep -v monotone.pm | grep -v external.pm | grep -v amazon_s3.pm`; +# monotone, external, blogspam, amazon_s3 skipped since they need perl modules +push @libs, map { chomp; $_ } `find IkiWiki -type f -name \\*.pm | grep -v monotone.pm | grep -v external.pm | grep -v blogspam.pm | grep -v amazon_s3.pm`; push @libs, 'IkiWiki/Plugin/skeleton.pm.example'; plan(tests => (@progs + @libs)); -- cgit v1.2.3 From 26fc2dde448151a4c83857738e0bcb8f8169c228 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 16 Jan 2009 22:46:10 -0500 Subject: add link to options list --- doc/plugins/blogspam.mdwn | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/blogspam.mdwn b/doc/plugins/blogspam.mdwn index 307d4646d..fd854b02e 100644 --- a/doc/plugins/blogspam.mdwn +++ b/doc/plugins/blogspam.mdwn @@ -6,10 +6,10 @@ This plugin adds antispam support to ikiwiki, using the [[comment|comments]] postings can be checked for spam. Currently, detected spam is not saved for human review, it is just rejected. -You can control how content is tested via the `blogspam_options` -setting. By default, the options are configured in a way that is -appropriate for wiki content. This includes turning off some of the -more problimatic tests. +You can control how content is tested via the `blogspam_options` setting. +The list of options is [here](http://blogspam.net/api/testComment.html#options). +By default, the options are configured in a way that is appropriate for +wiki content. This includes turning off some of the more problimatic tests. The `blogspam_pagespec` setting is a [[ikiwiki/PageSpec]] that can be used to configure which pages are checked for spam. The default is to check -- cgit v1.2.3 From a214d537b300a9277a6786a01488ba201e8bc8bb Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 16 Jan 2009 23:07:02 -0500 Subject: mention dep --- doc/plugins/blogspam.mdwn | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/blogspam.mdwn b/doc/plugins/blogspam.mdwn index fd854b02e..a090f9c60 100644 --- a/doc/plugins/blogspam.mdwn +++ b/doc/plugins/blogspam.mdwn @@ -6,6 +6,8 @@ This plugin adds antispam support to ikiwiki, using the [[comment|comments]] postings can be checked for spam. Currently, detected spam is not saved for human review, it is just rejected. +The plugin requires the [[!cpan RPC::XML]] perl module. + You can control how content is tested via the `blogspam_options` setting. The list of options is [here](http://blogspam.net/api/testComment.html#options). By default, the options are configured in a way that is appropriate for -- cgit v1.2.3 From c727e23fdbadd559c6271cc68dbd8606941ffb50 Mon Sep 17 00:00:00 2001 From: PaulePanter Date: Sat, 17 Jan 2009 09:56:50 -0500 Subject: Typo. --- doc/plugins/calendar.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/calendar.mdwn b/doc/plugins/calendar.mdwn index c9e95ce7e..d695762b7 100644 --- a/doc/plugins/calendar.mdwn +++ b/doc/plugins/calendar.mdwn @@ -6,7 +6,7 @@ The directive displays a calendar, similar to the typical calendars shown on some blogs. Since ikiwiki is a wiki compiler, to keep the calendar up-to-date, -wikis that include it need to be preiodically refreshes, typically by cron +wikis that include it need to be periodically refreshes, typically by cron at midnight. Example crontab: 0 0 * * * ikiwiki -setup ~/ikiwiki.setup -refresh -- cgit v1.2.3 From 5f80ac3202e61440d3a0fbcc486e13c16309d5ad Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Sun, 18 Jan 2009 09:52:51 -0500 Subject: underlay plugin, a command-line interface for add_underlay() --- doc/plugins/contrib/underlay.mdwn | 55 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 doc/plugins/contrib/underlay.mdwn (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/underlay.mdwn b/doc/plugins/contrib/underlay.mdwn new file mode 100644 index 000000000..94651f1d3 --- /dev/null +++ b/doc/plugins/contrib/underlay.mdwn @@ -0,0 +1,55 @@ +[[!template id=plugin name=underlay author="[[Simon_McVittie|smcv]]"]] +[[!tag type/useful]] + +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 +instance, the smiley images used by [[plugins/smileys]]), but they can also be +used as a way to pull in external files that you don't want in revision control, +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. + + #!/usr/bin/perl + package IkiWiki::Plugin::underlay; + # Copyright © 2008 Simon McVittie + # Licensed under the GNU GPL, version 2, or any later version published by the + # Free Software Foundation + + use warnings; + use strict; + use IkiWiki 2.00; + + sub import { + hook(type => "getsetup", id => "underlay", call => \&getsetup); + hook(type => "checkconfig", id => "underlay", call => \&checkconfig); + } + + sub getsetup () { + return + plugin => { + safe => 0, + rebuild => undef, + }, + add_underlays => { + type => "string", + default => [], + description => "extra underlay 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); + } + } + + 1; -- cgit v1.2.3 From e98f1b246a91f499d332f2d6e42d45a88d368681 Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Sun, 18 Jan 2009 11:40:57 -0500 Subject: fix typo, mention git branch --- doc/plugins/contrib/underlay.mdwn | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/underlay.mdwn b/doc/plugins/contrib/underlay.mdwn index 94651f1d3..72893c992 100644 --- a/doc/plugins/contrib/underlay.mdwn +++ b/doc/plugins/contrib/underlay.mdwn @@ -5,7 +5,7 @@ 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 -instance, the smiley images used by [[plugins/smileys]]), but they can also be +instance, the images used by the [[plugins/smiley]] plugin), but they can also be used as a way to pull in external files that you don't want in revision control, like photos or software releases. @@ -13,6 +13,9 @@ 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. +Please feel free to add this plugin to ikiwiki if it seems like a good +thing to have. See the 'underlay' branch in my git repository. + #!/usr/bin/perl package IkiWiki::Plugin::underlay; # Copyright © 2008 Simon McVittie -- cgit v1.2.3 From 2fd1857a527303f529274a229596dd6eb64b0a48 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sun, 18 Jan 2009 16:43:07 +0000 Subject: Document underlay plugin as included --- doc/plugins/contrib/underlay.mdwn | 58 --------------------------------------- doc/plugins/underlay.mdwn | 14 ++++++++++ 2 files changed, 14 insertions(+), 58 deletions(-) delete mode 100644 doc/plugins/contrib/underlay.mdwn create mode 100644 doc/plugins/underlay.mdwn (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/underlay.mdwn b/doc/plugins/contrib/underlay.mdwn deleted file mode 100644 index 72893c992..000000000 --- a/doc/plugins/contrib/underlay.mdwn +++ /dev/null @@ -1,58 +0,0 @@ -[[!template id=plugin name=underlay author="[[Simon_McVittie|smcv]]"]] -[[!tag type/useful]] - -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 -instance, the images used by the [[plugins/smiley]] plugin), but they can also be -used as a way to pull in external files that you don't want in revision control, -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. - -Please feel free to add this plugin to ikiwiki if it seems like a good -thing to have. See the 'underlay' branch in my git repository. - - #!/usr/bin/perl - package IkiWiki::Plugin::underlay; - # Copyright © 2008 Simon McVittie - # Licensed under the GNU GPL, version 2, or any later version published by the - # Free Software Foundation - - use warnings; - use strict; - use IkiWiki 2.00; - - sub import { - hook(type => "getsetup", id => "underlay", call => \&getsetup); - hook(type => "checkconfig", id => "underlay", call => \&checkconfig); - } - - sub getsetup () { - return - plugin => { - safe => 0, - rebuild => undef, - }, - add_underlays => { - type => "string", - default => [], - description => "extra underlay 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); - } - } - - 1; diff --git a/doc/plugins/underlay.mdwn b/doc/plugins/underlay.mdwn new file mode 100644 index 000000000..09d096a6e --- /dev/null +++ b/doc/plugins/underlay.mdwn @@ -0,0 +1,14 @@ +[[!template id=plugin name=underlay author="[[Simon_McVittie|smcv]]"]] +[[!tag type/useful]] + +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 +instance, the images used by the [[plugins/smiley]] plugin), but they can also be +used as a way to pull in external files that you don't want in revision control, +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. -- cgit v1.2.3 From daaf4885384568822c9a134f28cee667b6940d66 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 20 Jan 2009 00:53:46 +0100 Subject: po: let's walk the last steps needed before merge! Signed-off-by: intrigeri --- doc/plugins/contrib/po.mdwn | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index edd665185..af748a8d3 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -171,3 +171,30 @@ Any thoughts on this? I've set this plugin development aside for a while. I will be back and finish it at some point in the first quarter of 2009. --[[intrigeri]] + +> Abstract: Joey, please have a look at my po and meta branches. +> +> Detailed progress report: +> +> * it seems the po branch in your repository has not been tracking my +> own po branch for two months. any config issue? +> * all the plugin's todo items have been completed, robustness tests +> done +> * I've finished the detailed security audit, and the fix for po4a +> bugs has entered upstream CVS last week +> * I've merged your new `checkcontent` hook with the `cansave` hook +> I previously introduced in my own branch; blogspam plugin updated +> accordingly +> * the rename hook changes we discussed elsewhere are also part of my +> branch +> * I've introduced two new hooks (`canremove` and `canrename`), not +> a big deal; IMHO, they extend quite logically the plugin interface +> * as highlighted on [[bugs/pagetitle_function_does_not_respect_meta_titles]], +> my `meta` branch contains a new feature that is really useful in a +> translatable wiki +> +> As a conclusion, I'm feeling that my branches are ready to be +> merged; only thing missing, I guess, are a bit of discussion and +> subsequent adjustments. +> +> --[[intrigeri]] -- cgit v1.2.3 From c154fa5d6cd1620be7b139b08040740a1bdfafbc Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 25 Jan 2009 15:42:13 -0500 Subject: comments: If comment content checks fail, store the comment (in .ikiwiki/comments_pending) for moderator review. --- IkiWiki/Plugin/comments.pm | 43 +++++++++++++++++++++++++++++++------------ IkiWiki/Plugin/editpage.pm | 5 +++-- debian/changelog | 2 ++ doc/plugins/comments.mdwn | 7 +++++++ 4 files changed, 43 insertions(+), 14 deletions(-) (limited to 'doc/plugins') diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index 6d0e45a97..4d225b90a 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -380,14 +380,7 @@ sub sessioncgi ($$) { IkiWiki::check_canedit($page, $cgi, $session); $postcomment=0; - # FIXME: rather a simplistic way to make the comments... - my $i = 0; - my $file; - my $location; - do { - $i++; - $location = "$page/$config{comments_pagename}$i"; - } while (-e "$config{srcdir}/$location._comment"); + my $location=unique_comment_location($page, $config{srcdir}); my $content = "[[!_comment format=$type\n"; @@ -470,21 +463,33 @@ sub sessioncgi ($$) { IkiWiki::checksessionexpiry($cgi, $session); $postcomment=1; - IkiWiki::check_content(content => $form->field('editcontent'), + my $ok=IkiWiki::check_content(content => $form->field('editcontent'), subject => $form->field('subject'), $config{comments_allowauthor} ? ( author => $form->field('author'), url => $form->field('url'), ) : (), page => $location, - cgi => $cgi, session => $session + cgi => $cgi, + session => $session, + nonfatal => 1, ); $postcomment=0; - - my $file = "$location._comment"; + + if (! $ok) { + my $penddir=$config{wikistatedir}."/comments_pending"; + $location=unique_comment_location($page, $penddir); + writefile("$location._comment", $penddir, $content); + print IkiWiki::misctemplate(gettext(gettext("comment stored for moderation")), + "

    ". + gettext("Your comment will be posted after moderator review"), + "

    "); + exit; + } # FIXME: could probably do some sort of graceful retry # on error? Would require significant unwinding though + my $file = "$location._comment"; writefile($file, $config{srcdir}, $content); my $conflict; @@ -654,6 +659,20 @@ sub pagetemplate (@) { } } +sub unique_comment_location ($) { + my $page=shift; + my $dir=shift; + + my $location; + my $i = 0; + do { + $i++; + $location = "$page/$config{comments_pagename}$i"; + } while (-e "$dir/$location._comment"); + + return $location; +} + package IkiWiki::PageSpec; sub match_postcomment ($$;@) { diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm index bba52e4fd..c206d96a4 100644 --- a/IkiWiki/Plugin/editpage.pm +++ b/IkiWiki/Plugin/editpage.pm @@ -105,11 +105,12 @@ sub check_content (@) { $ok=1; } elsif (ref $ret eq 'CODE') { - $ret->(); + $ret->() unless $params{nonfatal}; $ok=0; } elsif (defined $ret) { - error($ret); + error($ret) unless $params{nonfatal}; + $ok=0; } } diff --git a/debian/changelog b/debian/changelog index 96089c101..002ae12c1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,8 @@ ikiwiki (3.03) UNRELEASED; urgency=low * Remove nonstandard css. Closes: #512378 * blogspam: Fix use of blogspam_options and blogspam_server config settings. + * comments: If comment content checks fail, store the comment + (in .ikiwiki/comments_pending) for moderator review. -- Joey Hess Sun, 18 Jan 2009 14:50:57 -0500 diff --git a/doc/plugins/comments.mdwn b/doc/plugins/comments.mdwn index 72b11af64..4cee3b9ad 100644 --- a/doc/plugins/comments.mdwn +++ b/doc/plugins/comments.mdwn @@ -41,3 +41,10 @@ There are some global options for the setup file: specify a name for themselves, and the \[[!meta author]] and \[[!meta authorurl]] directives will not be overridden by the comments plugin + +## comment moderation + +If you enable the [[blogspam]] plugin, comments that appear spammy will be +held for moderation. These comments are stored in +`.ikiwiki/comments_pending/`, and can be deleted, or moved into the +wiki's srcdir to be posted. -- cgit v1.2.3 From 7a7e28c55f1ffa64eedbaf36ee1729c6bbd27762 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 25 Jan 2009 19:04:45 -0500 Subject: add a button to prefs page for comment moderation --- IkiWiki/Plugin/comments.pm | 13 +++++++++++++ doc/plugins/comments.mdwn | 8 +++++--- doc/wikitemplates.mdwn | 2 ++ 3 files changed, 20 insertions(+), 3 deletions(-) (limited to 'doc/plugins') diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index ad5395a82..c95f77a42 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -26,6 +26,7 @@ sub import { hook(type => "htmlize", id => "_comment", call => \&htmlize); hook(type => "pagetemplate", id => "comments", call => \&pagetemplate); hook(type => "cgi", id => "comments", call => \&linkcgi); + hook(type => "formbuilder_setup", id => "comments", call => \&formbuilder_setup); IkiWiki::loadplugin("inline"); } @@ -618,6 +619,18 @@ sub commentmoderation ($$) { exit; } +sub formbuilder_setup (@) { + my %params=@_; + + my $form=$params{form}; + if ($form->title eq "preferences") { + push @{$params{buttons}}, "Comment Moderation"; + if ($form->submitted && $form->submitted eq "Comment Moderation") { + commentmoderation($params{cgi}, $params{session}); + } + } +} + sub comments_pending () { my $dir="$config{wikistatedir}/comments_pending/"; return unless -d $dir; diff --git a/doc/plugins/comments.mdwn b/doc/plugins/comments.mdwn index 4cee3b9ad..c13a6daa6 100644 --- a/doc/plugins/comments.mdwn +++ b/doc/plugins/comments.mdwn @@ -45,6 +45,8 @@ There are some global options for the setup file: ## comment moderation If you enable the [[blogspam]] plugin, comments that appear spammy will be -held for moderation. These comments are stored in -`.ikiwiki/comments_pending/`, and can be deleted, or moved into the -wiki's srcdir to be posted. +held for moderation. Wiki admins can access the comment moderation queue +via a button on their Preferences page. + +The comments are stored in `.ikiwiki/comments_pending/`, and can be +deleted, or moved into the wiki's srcdir to be posted. diff --git a/doc/wikitemplates.mdwn b/doc/wikitemplates.mdwn index dc217cd30..fc5893677 100644 --- a/doc/wikitemplates.mdwn +++ b/doc/wikitemplates.mdwn @@ -33,6 +33,8 @@ located in /usr/share/ikiwiki/templates by default. by the [[plugins/comments]] plugin. * `editcomment.tmpl` - This template is the comment post form for the [[plugins/comments]] plugin. +* `commentmoderation.tmpl` - This template is used to produce the comment + moderation form. The [[plugins/pagetemplate]] plugin can allow individual pages to use a different template than `page.tmpl`. -- cgit v1.2.3 From ff9a61b48100c66d2a212270017d7b5cae0386ac Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 25 Jan 2009 22:59:20 -0500 Subject: update --- doc/plugins/blogspam.mdwn | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/blogspam.mdwn b/doc/plugins/blogspam.mdwn index a090f9c60..28d0432b3 100644 --- a/doc/plugins/blogspam.mdwn +++ b/doc/plugins/blogspam.mdwn @@ -3,8 +3,7 @@ This plugin adds antispam support to ikiwiki, using the [blogspam.net](http://blogspam.net/) API. Both page edits and -[[comment|comments]] postings can be checked for spam. Currently, -detected spam is not saved for human review, it is just rejected. +[[comment|comments]] postings can be checked for spam. The plugin requires the [[!cpan RPC::XML]] perl module. -- cgit v1.2.3 From 51cd34afff17f27cdcdf45a1e9c4ce047a2eef80 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 25 Jan 2009 23:02:11 -0500 Subject: update --- doc/plugins/blogspam.mdwn | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/blogspam.mdwn b/doc/plugins/blogspam.mdwn index 28d0432b3..1d152faac 100644 --- a/doc/plugins/blogspam.mdwn +++ b/doc/plugins/blogspam.mdwn @@ -3,7 +3,9 @@ This plugin adds antispam support to ikiwiki, using the [blogspam.net](http://blogspam.net/) API. Both page edits and -[[comment|comments]] postings can be checked for spam. +[[comment|comments]] postings can be checked for spam. Page edits that +appear to contain spam will be rejected; comments that look spammy will be +stored in a queue for moderation by an admin. The plugin requires the [[!cpan RPC::XML]] perl module. -- cgit v1.2.3 From 96073d77af7530cd0a530fc71bd2ff076fa1f87d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 26 Jan 2009 14:13:52 -0500 Subject: review --- doc/plugins/contrib/po.mdwn | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index af748a8d3..490cc2d6c 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -198,3 +198,41 @@ finish it at some point in the first quarter of 2009. --[[intrigeri]] > subsequent adjustments. > > --[[intrigeri]] + +> I've looked it over and updated my branch with some (untested) +> changes. +> +> Sorry, I'd forgotten about your cansave hook.. sorry for the duplicate +> work there. +> +> Reviewing the changes, mostly outside of `po.pm`, I have +> the following issues. +> +> * renamepage to renamelink change would break the ikiwiki +> 3.x API, which I've promised not to do, so needs to be avoided +> somehow. (Sorry, I guess I dropped the ball on not getting this +> API change in before cutting 3.0..) +> * I don't understand the parentlinks code change and need to figure it +> out. Can you explain what is going on there? +> * canrename's mix of positional and named parameters is way too +> ugly to get into an ikiwiki API. Use named parameters +> entirely. Also probably should just use named parameters +> for canremove. +> * `skeleton.pm.example`'s canrename needs fixing to use either +> the current or my suggested parameters. +> * I don't like the exporting of `%backlinks` and `$backlinks_calculated` +> (the latter is exported but not used). +> * What is this `IkiWiki::nicepagetitle` and why are you +> injecting it into that namespace when only your module uses it? +> Actually, I can't even find a caller of it in your module. +> * I'm very fearful of the `add_depends` in `postscan`. +> Does this make every page depend on every page that links +> to it? Won't this absurdly bloat the dependency pagespecs +> and slow everything down? And since nicepagetitle is given +> as the reason for doing it, and nicepagetitle isn't used, +> why do it? +> * The po4a Suggests should be versioned to the first version +> that can be used safely, and that version documented in +> `plugins/po.mdwn`. +> +> --[[Joey]] -- cgit v1.2.3 From dfc50165dd187968fa9fd27856f3dc952ad783e9 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Mon, 26 Jan 2009 22:32:31 +0100 Subject: po and doc/todo/need_global_renamepage_hook: response Signed-off-by: intrigeri --- doc/plugins/contrib/po.mdwn | 46 +++++++++++++++++++++++++++++++ doc/todo/need_global_renamepage_hook.mdwn | 6 ++++ 2 files changed, 52 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index 490cc2d6c..8b8bccb5a 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -212,27 +212,73 @@ finish it at some point in the first quarter of 2009. --[[intrigeri]] > 3.x API, which I've promised not to do, so needs to be avoided > somehow. (Sorry, I guess I dropped the ball on not getting this > API change in before cutting 3.0..) +> +>> I'm discussing the solutions we now have on +>> [[todo/need_global_renamepage_hook]], as the solution I implemented +>> was initially agreed on there. +>> > * I don't understand the parentlinks code change and need to figure it > out. Can you explain what is going on there? +>> +>> I'm calling `bestlink` there so that po's injected `bestlink` is +>> run. This way, the parent links of a page link to the parent page +>> version in the proper language, depending on the +>> `po_link_to=current` and `po_link_to=negotiated` settings. +>> Moreover, when using my meta branch enhancements plus meta title to +>> make pages titles translatable, this small patch is needed to get +>> the translated titles into parentlinks. +>> > * canrename's mix of positional and named parameters is way too > ugly to get into an ikiwiki API. Use named parameters > entirely. Also probably should just use named parameters > for canremove. > * `skeleton.pm.example`'s canrename needs fixing to use either > the current or my suggested parameters. +>> +>> I'll do both. +>> > * I don't like the exporting of `%backlinks` and `$backlinks_calculated` > (the latter is exported but not used). +>> +>> The commit message for 85f865b5d98e0122934d11e3f3eb6703e4f4c620 +>> contains the rationale for this change. I guess I don't understand +>> the subtleties of `our` use, and perldoc does not help me a lot. +>> IIRC, I actually did not use `our` to "export" these variables, but +>> rather to have them shared between `Render.pm` uses. +>> > * What is this `IkiWiki::nicepagetitle` and why are you > injecting it into that namespace when only your module uses it? > Actually, I can't even find a caller of it in your module. +>> +>> I guess you should have a look to my `meta` branch and to +>> [[bugs/pagetitle_function_does_not_respect_meta_titles]] in order +>> to understand this :) +>> > * I'm very fearful of the `add_depends` in `postscan`. > Does this make every page depend on every page that links > to it? Won't this absurdly bloat the dependency pagespecs > and slow everything down? And since nicepagetitle is given > as the reason for doing it, and nicepagetitle isn't used, > why do it? +>> +>> As explained in the 85f865b5d98e0122934d11e3f3eb6703e4f4c620 log: +>> this feature hits performance a bit. Its cost was quite small in my +>> real-world use-cases (a few percents bigger refresh time), but +>> could be bigger in worst cases. When using the po plugin with my +>> meta branch changes (i.e. the `nicepagetitle` thing), and having +>> enabled the option to display translation status in links, this +>> maintains the translation status up-to-date in backlinks. Same when +>> using meta title to make the pages titles translatable. It does +>> help having a nice and consistent translated wiki, but as it hurts +>> performance, I'm proposing to turn it into an option. +>> > * The po4a Suggests should be versioned to the first version > that can be used safely, and that version documented in > `plugins/po.mdwn`. +>> +>> Sure. I was waiting for the necessary version to be actually +>> released, but we can guess it will be 0.35. +>> +>> --[[intrigeri]] > > --[[Joey]] diff --git a/doc/todo/need_global_renamepage_hook.mdwn b/doc/todo/need_global_renamepage_hook.mdwn index f4e18baa2..aa543a64c 100644 --- a/doc/todo/need_global_renamepage_hook.mdwn +++ b/doc/todo/need_global_renamepage_hook.mdwn @@ -55,3 +55,9 @@ would solve my problem. Hmmm? --[[intrigeri]] >> In my `po` branch, I renamed `renamepage` to `renamelink`, and >> created a `rename` hook that is passed a reference to `@torename`. >> --[[intrigeri]] + +>>> As Joey highlights it on [[plugins/contrib/po]], it's too late to +>>> merge such a change, as the 3.x plugin API is released and should +>>> not be broken. I'm thus proposing to keep the existing +>>> `renamepage` as it is, and call `rename` the global hook I need. +>>> --[[intrigeri]] -- cgit v1.2.3 From be43f94b9fe33d725445864a412a92b448b42f59 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Mon, 26 Jan 2009 23:47:02 +0100 Subject: contrib/po: update after implementing suggested changes Signed-off-by: intrigeri --- doc/plugins/contrib/po.mdwn | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index 8b8bccb5a..70f5aa5a2 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -202,6 +202,8 @@ finish it at some point in the first quarter of 2009. --[[intrigeri]] > I've looked it over and updated my branch with some (untested) > changes. > +>> I've merged your changes into my branch. Only one was buggy. +> > Sorry, I'd forgotten about your cansave hook.. sorry for the duplicate > work there. > @@ -212,7 +214,7 @@ finish it at some point in the first quarter of 2009. --[[intrigeri]] > 3.x API, which I've promised not to do, so needs to be avoided > somehow. (Sorry, I guess I dropped the ball on not getting this > API change in before cutting 3.0..) -> +>> >> I'm discussing the solutions we now have on >> [[todo/need_global_renamepage_hook]], as the solution I implemented >> was initially agreed on there. @@ -235,7 +237,7 @@ finish it at some point in the first quarter of 2009. --[[intrigeri]] > * `skeleton.pm.example`'s canrename needs fixing to use either > the current or my suggested parameters. >> ->> I'll do both. +>> Done. >> > * I don't like the exporting of `%backlinks` and `$backlinks_calculated` > (the latter is exported but not used). @@ -276,8 +278,7 @@ finish it at some point in the first quarter of 2009. --[[intrigeri]] > that can be used safely, and that version documented in > `plugins/po.mdwn`. >> ->> Sure. I was waiting for the necessary version to be actually ->> released, but we can guess it will be 0.35. +>> Done. >> >> --[[intrigeri]] > -- cgit v1.2.3 From 183f03aa968882c9d0e8e70b33e8a482aa16726a Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 27 Jan 2009 00:02:15 +0100 Subject: the rename hooks names waltz seems over Another set of hooks would not endure such heavy renaming, but the rename* hooks actually do ;) Signed-off-by: intrigeri --- doc/plugins/contrib/po.mdwn | 4 +--- doc/todo/need_global_renamepage_hook.mdwn | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index 70f5aa5a2..1751a6f7f 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -215,9 +215,7 @@ finish it at some point in the first quarter of 2009. --[[intrigeri]] > somehow. (Sorry, I guess I dropped the ball on not getting this > API change in before cutting 3.0..) >> ->> I'm discussing the solutions we now have on ->> [[todo/need_global_renamepage_hook]], as the solution I implemented ->> was initially agreed on there. +>> Fixed, see [[todo/need_global_renamepage_hook]]. >> > * I don't understand the parentlinks code change and need to figure it > out. Can you explain what is going on there? diff --git a/doc/todo/need_global_renamepage_hook.mdwn b/doc/todo/need_global_renamepage_hook.mdwn index c5b2b1096..7af2bdc56 100644 --- a/doc/todo/need_global_renamepage_hook.mdwn +++ b/doc/todo/need_global_renamepage_hook.mdwn @@ -60,3 +60,5 @@ would solve my problem. Hmmm? --[[intrigeri]] >>> merge such a change, as the 3.x plugin API is released and should >>> not be broken. I will thus keep the existing `renamepage` as it >>> is, and call `rename` the global hook I need. --[[intrigeri]] + +>>>> Done in my `po` branch. --[[intrigeri]] -- cgit v1.2.3 From eb9c05e18cb7880a402c76dc86b652ca381c8d7a Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 27 Jan 2009 00:27:41 +0100 Subject: contrib/po: backlinks=>dependencies is now an option Signed-off-by: intrigeri --- doc/plugins/contrib/po.mdwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index 1751a6f7f..f7ed35a82 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -269,8 +269,8 @@ finish it at some point in the first quarter of 2009. --[[intrigeri]] >> enabled the option to display translation status in links, this >> maintains the translation status up-to-date in backlinks. Same when >> using meta title to make the pages titles translatable. It does ->> help having a nice and consistent translated wiki, but as it hurts ->> performance, I'm proposing to turn it into an option. +>> help having a nice and consistent translated wiki, but as it can +>> also involve problems, I just turned it into an option. >> > * The po4a Suggests should be versioned to the first version > that can be used safely, and that version documented in -- cgit v1.2.3 From aba655c6e0d5c4b0eaa3d113129d6de58f4541c2 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 26 Jan 2009 19:46:24 -0500 Subject: comments --- doc/plugins/contrib/po.mdwn | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index f7ed35a82..f2d46c391 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -245,7 +245,9 @@ finish it at some point in the first quarter of 2009. --[[intrigeri]] >> the subtleties of `our` use, and perldoc does not help me a lot. >> IIRC, I actually did not use `our` to "export" these variables, but >> rather to have them shared between `Render.pm` uses. ->> +>> +>>> My wording was unclear, I meant exposing. --[[Joey]] +>>> > * What is this `IkiWiki::nicepagetitle` and why are you > injecting it into that namespace when only your module uses it? > Actually, I can't even find a caller of it in your module. @@ -253,6 +255,9 @@ finish it at some point in the first quarter of 2009. --[[intrigeri]] >> I guess you should have a look to my `meta` branch and to >> [[bugs/pagetitle_function_does_not_respect_meta_titles]] in order >> to understand this :) +>> +>>> It would probably be good if I could merge this branch without +>>> having to worry about also immediatly merging that one. --[[Joey]] >> > * I'm very fearful of the `add_depends` in `postscan`. > Does this make every page depend on every page that links -- cgit v1.2.3 From af5b9b90c4f3d694ac0d8394eeee4fa45f23f843 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 27 Jan 2009 18:16:56 +0100 Subject: contrib/po: misc answers and questions Step by step... :) Signed-off-by: intrigeri --- doc/plugins/contrib/po.mdwn | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index f2d46c391..7eff8fa1c 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -248,6 +248,18 @@ finish it at some point in the first quarter of 2009. --[[intrigeri]] >> >>> My wording was unclear, I meant exposing. --[[Joey]] >>> +>>>> I guess I still don't know Perl's `our` enough to understand clearly. +>>>> No matter whether these variables are declared with `my` or `our`, +>>>> any plugin can `use IkiWiki::Render` and then access +>>>> `$IkiWiki::backlinks`, as already does e.g. the pagestat plugin. +>>>> So I guess your problem is not with letting plugins use these +>>>> variables, but with them being visible for every piece of +>>>> (possibly external) code called from `Render.pm`. Am I right? +>>>> If I understand clearly, using a brace block to lexically enclose +>>>> these two `our` declarations, alongside with the `calculate_backlinks` +>>>> and `backlinks` subs definitions, would be a proper solution, wouldn't +>>>> it? --[[intrigeri]] +>>>> > * What is this `IkiWiki::nicepagetitle` and why are you > injecting it into that namespace when only your module uses it? > Actually, I can't even find a caller of it in your module. @@ -258,7 +270,16 @@ finish it at some point in the first quarter of 2009. --[[intrigeri]] >> >>> It would probably be good if I could merge this branch without >>> having to worry about also immediatly merging that one. --[[Joey]] ->> +>>> +>>>> I removed all dependencies on my `meta` branch from the `po` one. +>>>> This implied removing the `po_translation_status_in_links` and +>>>> `po_strictly_refresh_backlinks` features, and every link text is now +>>>> displayed in the master language. I believe the removed features really +>>>> enhance user experience of a translatable wiki, that's why I was +>>>> initially supposing the `meta` branch would be merged first. +>>>> IMHO, we'll need to come back to this quite soon after `po` is merged. +>>>> --[[intrigeri]] +>>> > * I'm very fearful of the `add_depends` in `postscan`. > Does this make every page depend on every page that links > to it? Won't this absurdly bloat the dependency pagespecs @@ -277,6 +298,9 @@ finish it at some point in the first quarter of 2009. --[[intrigeri]] >> help having a nice and consistent translated wiki, but as it can >> also involve problems, I just turned it into an option. >> +>>> This has been completely removed for now due to the removal of +>>> the dependency on my `meta` branch. --[[intrigeri]] +>> > * The po4a Suggests should be versioned to the first version > that can be used safely, and that version documented in > `plugins/po.mdwn`. -- cgit v1.2.3 From be63bed593877db0f9a511182ea8329993d3d019 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 27 Jan 2009 13:20:33 -0500 Subject: response --- doc/plugins/contrib/po.mdwn | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index 7eff8fa1c..6cd097e94 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -259,6 +259,10 @@ finish it at some point in the first quarter of 2009. --[[intrigeri]] >>>> these two `our` declarations, alongside with the `calculate_backlinks` >>>> and `backlinks` subs definitions, would be a proper solution, wouldn't >>>> it? --[[intrigeri]] +>>>> +>>>>> No, %backlinks and the backlinks() function are not the same thing. +>>>>> The variable is lexically scoped; only accessible from inside +>>>>> `Render.pm` --[[Joey]] >>>> > * What is this `IkiWiki::nicepagetitle` and why are you > injecting it into that namespace when only your module uses it? @@ -279,6 +283,10 @@ finish it at some point in the first quarter of 2009. --[[intrigeri]] >>>> initially supposing the `meta` branch would be merged first. >>>> IMHO, we'll need to come back to this quite soon after `po` is merged. >>>> --[[intrigeri]] +>>>> +>>>> Maybe you should keep those features in a meta-po branch? +>>>> I did a cursory review of your meta last night, have some issues with it, +>>>> but this page isn't the place for a detailed review. --[[Joey]] >>> > * I'm very fearful of the `add_depends` in `postscan`. > Does this make every page depend on every page that links -- cgit v1.2.3 From 4db549721da28fb7aca3863af72675324fb5fb43 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 27 Jan 2009 19:45:12 +0100 Subject: contrib/po: announce my meta-po integration branch Signed-off-by: intrigeri --- doc/plugins/contrib/po.mdwn | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index 6cd097e94..8b19afae6 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -287,6 +287,8 @@ finish it at some point in the first quarter of 2009. --[[intrigeri]] >>>> Maybe you should keep those features in a meta-po branch? >>>> I did a cursory review of your meta last night, have some issues with it, >>>> but this page isn't the place for a detailed review. --[[Joey]] +>>>> +>>>>> Done. --[[intrigeri]] >>> > * I'm very fearful of the `add_depends` in `postscan`. > Does this make every page depend on every page that links -- cgit v1.2.3 From a46cf100f01b5db96980737b1c2b25deff68e5a0 Mon Sep 17 00:00:00 2001 From: "http://weakish.int.eu.org/" Date: Thu, 29 Jan 2009 10:28:32 -0500 Subject: removed --- doc/plugins/textile/discussion.mdwn | 1 - 1 file changed, 1 deletion(-) delete mode 100644 doc/plugins/textile/discussion.mdwn (limited to 'doc/plugins') diff --git a/doc/plugins/textile/discussion.mdwn b/doc/plugins/textile/discussion.mdwn deleted file mode 100644 index 945c9b46d..000000000 --- a/doc/plugins/textile/discussion.mdwn +++ /dev/null @@ -1 +0,0 @@ -. \ No newline at end of file -- cgit v1.2.3 From 46b880f8390ac82d746add01de38a05155743374 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sat, 31 Jan 2009 22:32:10 +0000 Subject: Split apache404 into an independent plugin Also make it ignore the 'do' parameter at Joey's suggestion, to have one less thing to remember when configuring. --- IkiWiki/CGI.pm | 49 +------------------------- IkiWiki/Plugin/apache404.pm | 76 ++++++++++++++++++++++++++++++++++++++++ doc/plugins/apache404.mdwn | 11 ++++++ doc/tips/apache_404_handler.mdwn | 10 ------ t/apache404.t | 45 ++++++++++++++++++++++++ t/cgi_page_from_404.t | 43 ----------------------- 6 files changed, 133 insertions(+), 101 deletions(-) create mode 100644 IkiWiki/Plugin/apache404.pm create mode 100644 doc/plugins/apache404.mdwn delete mode 100644 doc/tips/apache_404_handler.mdwn create mode 100755 t/apache404.t delete mode 100755 t/cgi_page_from_404.t (limited to 'doc/plugins') diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index 8734cdd49..e75ebcd27 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -338,46 +338,6 @@ sub cgi_goto ($;$) { exit; } -sub cgi_page_from_404 ($$$) { - my $path = shift; - my $baseurl = shift; - my $usedirs = shift; - - # fail if missing from environment or whatever - return undef unless defined $path; - return undef unless defined $baseurl; - - # with usedirs on, path is like /~fred/foo/bar/ or /~fred/foo/bar or - # /~fred/foo/bar/index.html - # with usedirs off, path is like /~fred/foo/bar.html - # baseurl is like 'http://people.example.com/~fred' - - # convert baseurl to ~fred - unless ($baseurl =~ s{^https?://[^/]+/?}{}) { - return undef; - } - - # convert path to /~fred/foo/bar - if ($usedirs) { - $path =~ s/\/*(?:index\.$config{htmlext})?$//; - } - else { - $path =~ s/\.$config{htmlext}$//; - } - - # remove /~fred/ - unless ($path =~ s{^/*\Q$baseurl\E/*}{}) { - return undef; - } - - # special case for the index - unless ($path) { - return 'index'; - } - - return $path; -} - sub cgi (;$$) { my $q=shift; my $session=shift; @@ -409,14 +369,7 @@ sub cgi (;$$) { # commenter are for compatibility with any saved URLs if ($do eq 'goto' || $do eq 'recentchanges_link' || $do eq 'commenter') { - my $page = undef; - - if ($ENV{REDIRECT_STATUS} eq '404') { - $page = cgi_page_from_404($ENV{REDIRECT_URL}, - $config{url}, $config{usedirs}); - } - - cgi_goto($q, $page); + cgi_goto($q); } # Need to lock the wiki before getting a session. diff --git a/IkiWiki/Plugin/apache404.pm b/IkiWiki/Plugin/apache404.pm new file mode 100644 index 000000000..3ac6b3af5 --- /dev/null +++ b/IkiWiki/Plugin/apache404.pm @@ -0,0 +1,76 @@ +#!/usr/bin/perl +# Copyright © 2009 Simon McVittie +# Licensed under the GNU GPL, version 2, or any later version published by the +# Free Software Foundation +package IkiWiki::Plugin::apache404; + +use warnings; +use strict; +use IkiWiki 3.00; + +sub import { + hook(type => "cgi", id => 'apache404', call => \&cgi); +} + +sub getsetup () { + return + plugin => { + # not really a matter of safety, but enabling/disabling + # through a web interface is useless - it needs web + # server admin action too + safe => 0, + rebuild => 0, + } +} + +sub cgi_page_from_404 ($$$) { + my $path = shift; + my $baseurl = shift; + my $usedirs = shift; + + # fail if missing from environment or whatever + return undef unless defined $path; + return undef unless defined $baseurl; + + # with usedirs on, path is like /~fred/foo/bar/ or /~fred/foo/bar or + # /~fred/foo/bar/index.html + # with usedirs off, path is like /~fred/foo/bar.html + # baseurl is like 'http://people.example.com/~fred' + + # convert baseurl to ~fred + unless ($baseurl =~ s{^https?://[^/]+/?}{}) { + return undef; + } + + # convert path to /~fred/foo/bar + if ($usedirs) { + $path =~ s/\/*(?:index\.$config{htmlext})?$//; + } + else { + $path =~ s/\.$config{htmlext}$//; + } + + # remove /~fred/ + unless ($path =~ s{^/*\Q$baseurl\E/*}{}) { + return undef; + } + + # special case for the index + unless ($path) { + return 'index'; + } + + return $path; +} + +sub cgi ($) { + my $cgi=shift; + + if ($ENV{REDIRECT_STATUS} eq '404') { + my $page = cgi_page_from_404($ENV{REDIRECT_URL}, + $config{url}, $config{usedirs}); + IkiWiki::cgi_goto($cgi, $page); + } +} + +1; diff --git a/doc/plugins/apache404.mdwn b/doc/plugins/apache404.mdwn new file mode 100644 index 000000000..bab8fb59d --- /dev/null +++ b/doc/plugins/apache404.mdwn @@ -0,0 +1,11 @@ +[[!template id=plugin name=apache404 author="[[Simon_McVittie|smcv]]"]] +[[!tag type/useful]] + +This plugin lets you use the IkiWiki CGI script as an Apache 404 handler, +to give the behaviour of various other wiki engines where visiting a +nonexistent page provides you with a link to create it. + +To achieve this, put something like this in the wiki's Apache configuration +file: + + ErrorDocument 404 /cgi-bin/ikiwiki.cgi diff --git a/doc/tips/apache_404_handler.mdwn b/doc/tips/apache_404_handler.mdwn deleted file mode 100644 index 0fda759e7..000000000 --- a/doc/tips/apache_404_handler.mdwn +++ /dev/null @@ -1,10 +0,0 @@ -[[!meta title="Apache 404 handler"]] - -Sufficiently recent versions of IkiWiki can be used as an Apache 404 handler, -to give the behaviour of various other wiki engines where visiting a -nonexistent page provides you with a link to create it. - -To achieve this, put something like this in the wiki's Apache configuration -file: - - ErrorDocument 404 /cgi-bin/ikiwiki.cgi?do=goto diff --git a/t/apache404.t b/t/apache404.t new file mode 100755 index 000000000..00fc35250 --- /dev/null +++ b/t/apache404.t @@ -0,0 +1,45 @@ +#!/usr/bin/perl +use warnings; +use strict; +use Test::More tests => 17; + +BEGIN { use_ok("IkiWiki::Plugin::apache404"); } + +sub cgi_page_from_404 { + return IkiWiki::Plugin::apache404::cgi_page_from_404(shift, shift, + shift); +} + +$IkiWiki::config{htmlext} = 'html'; + +is(cgi_page_from_404('/', 'http://example.com', 1), 'index'); +is(cgi_page_from_404('/index.html', 'http://example.com', 0), 'index'); +is(cgi_page_from_404('/', 'http://example.com/', 1), 'index'); +is(cgi_page_from_404('/index.html', 'http://example.com/', 0), 'index'); + +is(cgi_page_from_404('/~user/foo/bar', 'http://example.com/~user', 1), + 'foo/bar'); +is(cgi_page_from_404('/~user/foo/bar/index.html', 'http://example.com/~user', 1), + 'foo/bar'); +is(cgi_page_from_404('/~user/foo/bar/', 'http://example.com/~user', 1), + 'foo/bar'); +is(cgi_page_from_404('/~user/foo/bar.html', 'http://example.com/~user', 0), + 'foo/bar'); + +is(cgi_page_from_404('/~user/foo/bar', 'http://example.com/~user/', 1), + 'foo/bar'); +is(cgi_page_from_404('/~user/foo/bar/index.html', 'http://example.com/~user/', 1), + 'foo/bar'); +is(cgi_page_from_404('/~user/foo/bar/', 'http://example.com/~user/', 1), + 'foo/bar'); +is(cgi_page_from_404('/~user/foo/bar.html', 'http://example.com/~user/', 0), + 'foo/bar'); + +is(cgi_page_from_404('/~user/foo', 'https://example.com/~user', 1), + 'foo'); +is(cgi_page_from_404('/~user/foo/index.html', 'https://example.com/~user', 1), + 'foo'); +is(cgi_page_from_404('/~user/foo/', 'https://example.com/~user', 1), + 'foo'); +is(cgi_page_from_404('/~user/foo.html', 'https://example.com/~user', 0), + 'foo'); diff --git a/t/cgi_page_from_404.t b/t/cgi_page_from_404.t deleted file mode 100755 index adbbdf874..000000000 --- a/t/cgi_page_from_404.t +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/perl -use warnings; -use strict; -use Test::More tests => 18; - -BEGIN { use_ok("IkiWiki"); } -BEGIN { use_ok("IkiWiki::CGI"); } - -sub cgi_page_from_404 { return IkiWiki::cgi_page_from_404(shift, shift, shift); } - -$IkiWiki::config{htmlext} = 'html'; - -is(cgi_page_from_404('/', 'http://example.com', 1), 'index'); -is(cgi_page_from_404('/index.html', 'http://example.com', 0), 'index'); -is(cgi_page_from_404('/', 'http://example.com/', 1), 'index'); -is(cgi_page_from_404('/index.html', 'http://example.com/', 0), 'index'); - -is(cgi_page_from_404('/~user/foo/bar', 'http://example.com/~user', 1), - 'foo/bar'); -is(cgi_page_from_404('/~user/foo/bar/index.html', 'http://example.com/~user', 1), - 'foo/bar'); -is(cgi_page_from_404('/~user/foo/bar/', 'http://example.com/~user', 1), - 'foo/bar'); -is(cgi_page_from_404('/~user/foo/bar.html', 'http://example.com/~user', 0), - 'foo/bar'); - -is(cgi_page_from_404('/~user/foo/bar', 'http://example.com/~user/', 1), - 'foo/bar'); -is(cgi_page_from_404('/~user/foo/bar/index.html', 'http://example.com/~user/', 1), - 'foo/bar'); -is(cgi_page_from_404('/~user/foo/bar/', 'http://example.com/~user/', 1), - 'foo/bar'); -is(cgi_page_from_404('/~user/foo/bar.html', 'http://example.com/~user/', 0), - 'foo/bar'); - -is(cgi_page_from_404('/~user/foo', 'https://example.com/~user', 1), - 'foo'); -is(cgi_page_from_404('/~user/foo/index.html', 'https://example.com/~user', 1), - 'foo'); -is(cgi_page_from_404('/~user/foo/', 'https://example.com/~user', 1), - 'foo'); -is(cgi_page_from_404('/~user/foo.html', 'https://example.com/~user', 0), - 'foo'); -- cgit v1.2.3 From c886bea32084a920f3ba26b3f96327681f5db917 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sat, 31 Jan 2009 23:01:10 +0000 Subject: Split cgi_goto into a goto plugin --- IkiWiki/CGI.pm | 51 --------------------------- IkiWiki/Plugin/apache404.pm | 3 +- IkiWiki/Plugin/comments.pm | 2 ++ IkiWiki/Plugin/goto.pm | 76 +++++++++++++++++++++++++++++++++++++++++ IkiWiki/Plugin/recentchanges.pm | 2 ++ doc/plugins/goto.mdwn | 10 ++++++ 6 files changed, 92 insertions(+), 52 deletions(-) create mode 100644 IkiWiki/Plugin/goto.pm create mode 100644 doc/plugins/goto.mdwn (limited to 'doc/plugins') diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index e75ebcd27..c91914564 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -294,50 +294,6 @@ sub cgi_savesession ($) { umask($oldmask); } -# cgi_goto(CGI, [page]) -# Redirect to a specified page, or display "not found". If not specified, -# the page param from the CGI object is used. -sub cgi_goto ($;$) { - my $q = shift; - my $page = shift; - - if (!defined $page) { - $page = decode_utf8($q->param("page")); - - if (!defined $page) { - error("missing page parameter"); - } - } - - loadindex(); - - # If the page is internal (like a comment), see if it has a - # permalink. Comments do. - if (isinternal($page) && - defined $pagestate{$page}{meta}{permalink}) { - redirect($q, $pagestate{$page}{meta}{permalink}); - } - - my $link = bestlink("", $page); - - if (! length $link) { - print $q->header(-status => "404 Not Found"); - print misctemplate(gettext("missing page"), - "

    ". - sprintf(gettext("The page %s does not exist."), - htmllink("", "", $page)). - "

    ". - # Internet Explorer won't show custom 404 responses - # unless they're >= 512 bytes - (" " x 512)); - } - else { - redirect($q, urlto($link, undef, 1)); - } - - exit; -} - sub cgi (;$$) { my $q=shift; my $session=shift; @@ -365,13 +321,6 @@ sub cgi (;$$) { } } - # goto is the preferred name for this; recentchanges_link and - # commenter are for compatibility with any saved URLs - if ($do eq 'goto' || $do eq 'recentchanges_link' || - $do eq 'commenter') { - cgi_goto($q); - } - # Need to lock the wiki before getting a session. lockwiki(); loadindex(); diff --git a/IkiWiki/Plugin/apache404.pm b/IkiWiki/Plugin/apache404.pm index 3ac6b3af5..e7ce70435 100644 --- a/IkiWiki/Plugin/apache404.pm +++ b/IkiWiki/Plugin/apache404.pm @@ -10,6 +10,7 @@ use IkiWiki 3.00; sub import { hook(type => "cgi", id => 'apache404', call => \&cgi); + IkiWiki::loadplugin("goto"); } sub getsetup () { @@ -69,7 +70,7 @@ sub cgi ($) { if ($ENV{REDIRECT_STATUS} eq '404') { my $page = cgi_page_from_404($ENV{REDIRECT_URL}, $config{url}, $config{usedirs}); - IkiWiki::cgi_goto($cgi, $page); + IkiWiki::Plugin::goto::cgi_goto($cgi, $page); } } diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index 995d1f4eb..3cdffe856 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -26,6 +26,8 @@ sub import { hook(type => "htmlize", id => "_comment", call => \&htmlize); hook(type => "pagetemplate", id => "comments", call => \&pagetemplate); hook(type => "formbuilder_setup", id => "comments", call => \&formbuilder_setup); + # Load goto to fix up user page links for logged-in commenters + IkiWiki::loadplugin("goto"); IkiWiki::loadplugin("inline"); } diff --git a/IkiWiki/Plugin/goto.pm b/IkiWiki/Plugin/goto.pm new file mode 100644 index 000000000..9e7a2621f --- /dev/null +++ b/IkiWiki/Plugin/goto.pm @@ -0,0 +1,76 @@ +#!/usr/bin/perl +package IkiWiki::Plugin::goto; + +use warnings; +use strict; +use IkiWiki 3.00; + +sub import { + hook(type => "cgi", id => 'goto', call => \&cgi); +} + +sub getsetup () { + return + plugin => { + safe => 1, + rebuild => 0, + } +} + +# cgi_goto(CGI, [page]) +# Redirect to a specified page, or display "not found". If not specified, +# the page param from the CGI object is used. +sub cgi_goto ($;$) { + my $q = shift; + my $page = shift; + + if (!defined $page) { + $page = IkiWiki::decode_utf8($q->param("page")); + + if (!defined $page) { + error("missing page parameter"); + } + } + + IkiWiki::loadindex(); + + # If the page is internal (like a comment), see if it has a + # permalink. Comments do. + if (IkiWiki::isinternal($page) && + defined $pagestate{$page}{meta}{permalink}) { + redirect($q, $pagestate{$page}{meta}{permalink}); + } + + my $link = bestlink("", $page); + + if (! length $link) { + print $q->header(-status => "404 Not Found"); + print IkiWiki::misctemplate(gettext("missing page"), + "

    ". + sprintf(gettext("The page %s does not exist."), + htmllink("", "", $page)). + "

    ". + # Internet Explorer won't show custom 404 responses + # unless they're >= 512 bytes + (" " x 512)); + } + else { + IkiWiki::redirect($q, urlto($link, undef, 1)); + } + + exit; +} + +sub cgi ($) { + my $cgi=shift; + my $do = $cgi->param('do'); + + if (defined $do && ($do eq 'goto' || $do eq 'commenter' || + $do eq 'recentchanged_link')) { + # goto is the preferred name for this; recentchanges_link and + # commenter are for compatibility with any saved URLs + cgi_goto($cgi); + } +} + +1; diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm index 56e80e7b8..329dd6f32 100644 --- a/IkiWiki/Plugin/recentchanges.pm +++ b/IkiWiki/Plugin/recentchanges.pm @@ -13,6 +13,8 @@ sub import { hook(type => "refresh", id => "recentchanges", call => \&refresh); hook(type => "pagetemplate", id => "recentchanges", call => \&pagetemplate); hook(type => "htmlize", id => "_change", call => \&htmlize); + # Load goto to fix up links from recentchanges + IkiWiki::loadplugin("goto"); } sub getsetup () { diff --git a/doc/plugins/goto.mdwn b/doc/plugins/goto.mdwn new file mode 100644 index 000000000..21dda16b2 --- /dev/null +++ b/doc/plugins/goto.mdwn @@ -0,0 +1,10 @@ +[[!template id=plugin name=goto author="[[Simon_McVittie|smcv]]"]] +[[!tag type/useful]] + +This plugin adds a `do=goto` mode for the IkiWiki CGI script. It's mainly +for internal use by the [[apache404]], [[comments]] and [[recentchanges]] +plugins, which enable it automatically. + +With this plugin enabled you can link to `ikiwiki.cgi?do=goto&page=some/where` +to make a link that will redirect to the page `/some/where` if it exists, or +offer a link to create it if it doesn't. -- cgit v1.2.3 From 3b83e520182a83e4ae6c61ab7b360b0eb939469f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 31 Jan 2009 19:26:36 -0500 Subject: rename apache404 -> 404 This may already work with other web servers that have copied apache's interface, and it should be easy to add support to it for web servers that use some other interface. So, make the name more general. --- IkiWiki/Plugin/404.pm | 77 +++++++++++++++++++++++++++++++++++++++++++++ IkiWiki/Plugin/apache404.pm | 77 --------------------------------------------- debian/changelog | 2 +- debian/copyright | 2 +- doc/plugins/404.mdwn | 11 +++++++ doc/plugins/apache404.mdwn | 11 ------- doc/plugins/goto.mdwn | 2 +- doc/tips/dot_cgi.mdwn | 9 +++--- t/404.t | 44 ++++++++++++++++++++++++++ t/apache404.t | 45 -------------------------- 10 files changed, 139 insertions(+), 141 deletions(-) create mode 100644 IkiWiki/Plugin/404.pm delete mode 100644 IkiWiki/Plugin/apache404.pm create mode 100644 doc/plugins/404.mdwn delete mode 100644 doc/plugins/apache404.mdwn create mode 100755 t/404.t delete mode 100755 t/apache404.t (limited to 'doc/plugins') diff --git a/IkiWiki/Plugin/404.pm b/IkiWiki/Plugin/404.pm new file mode 100644 index 000000000..5550ea7d1 --- /dev/null +++ b/IkiWiki/Plugin/404.pm @@ -0,0 +1,77 @@ +#!/usr/bin/perl +# Copyright © 2009 Simon McVittie +# Licensed under the GNU GPL, version 2, or any later version published by the +# Free Software Foundation +package IkiWiki::Plugin::404; + +use warnings; +use strict; +use IkiWiki 3.00; + +sub import { + hook(type => "cgi", id => '404', call => \&cgi); + IkiWiki::loadplugin("goto"); +} + +sub getsetup () { + return + plugin => { + # not really a matter of safety, but enabling/disabling + # through a web interface is useless - it needs web + # server admin action too + safe => 0, + rebuild => 0, + } +} + +sub cgi_page_from_404 ($$$) { + my $path = shift; + my $baseurl = shift; + my $usedirs = shift; + + # fail if missing from environment or whatever + return undef unless defined $path; + return undef unless defined $baseurl; + + # with usedirs on, path is like /~fred/foo/bar/ or /~fred/foo/bar or + # /~fred/foo/bar/index.html + # with usedirs off, path is like /~fred/foo/bar.html + # baseurl is like 'http://people.example.com/~fred' + + # convert baseurl to ~fred + unless ($baseurl =~ s{^https?://[^/]+/?}{}) { + return undef; + } + + # convert path to /~fred/foo/bar + if ($usedirs) { + $path =~ s/\/*(?:index\.$config{htmlext})?$//; + } + else { + $path =~ s/\.$config{htmlext}$//; + } + + # remove /~fred/ + unless ($path =~ s{^/*\Q$baseurl\E/*}{}) { + return undef; + } + + # special case for the index + unless ($path) { + return 'index'; + } + + return $path; +} + +sub cgi ($) { + my $cgi=shift; + + if ($ENV{REDIRECT_STATUS} eq '404') { + my $page = cgi_page_from_404($ENV{REDIRECT_URL}, + $config{url}, $config{usedirs}); + IkiWiki::Plugin::goto::cgi_goto($cgi, $page); + } +} + +1; diff --git a/IkiWiki/Plugin/apache404.pm b/IkiWiki/Plugin/apache404.pm deleted file mode 100644 index e7ce70435..000000000 --- a/IkiWiki/Plugin/apache404.pm +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/perl -# Copyright © 2009 Simon McVittie -# Licensed under the GNU GPL, version 2, or any later version published by the -# Free Software Foundation -package IkiWiki::Plugin::apache404; - -use warnings; -use strict; -use IkiWiki 3.00; - -sub import { - hook(type => "cgi", id => 'apache404', call => \&cgi); - IkiWiki::loadplugin("goto"); -} - -sub getsetup () { - return - plugin => { - # not really a matter of safety, but enabling/disabling - # through a web interface is useless - it needs web - # server admin action too - safe => 0, - rebuild => 0, - } -} - -sub cgi_page_from_404 ($$$) { - my $path = shift; - my $baseurl = shift; - my $usedirs = shift; - - # fail if missing from environment or whatever - return undef unless defined $path; - return undef unless defined $baseurl; - - # with usedirs on, path is like /~fred/foo/bar/ or /~fred/foo/bar or - # /~fred/foo/bar/index.html - # with usedirs off, path is like /~fred/foo/bar.html - # baseurl is like 'http://people.example.com/~fred' - - # convert baseurl to ~fred - unless ($baseurl =~ s{^https?://[^/]+/?}{}) { - return undef; - } - - # convert path to /~fred/foo/bar - if ($usedirs) { - $path =~ s/\/*(?:index\.$config{htmlext})?$//; - } - else { - $path =~ s/\.$config{htmlext}$//; - } - - # remove /~fred/ - unless ($path =~ s{^/*\Q$baseurl\E/*}{}) { - return undef; - } - - # special case for the index - unless ($path) { - return 'index'; - } - - return $path; -} - -sub cgi ($) { - my $cgi=shift; - - if ($ENV{REDIRECT_STATUS} eq '404') { - my $page = cgi_page_from_404($ENV{REDIRECT_URL}, - $config{url}, $config{usedirs}); - IkiWiki::Plugin::goto::cgi_goto($cgi, $page); - } -} - -1; diff --git a/debian/changelog b/debian/changelog index f3927f121..be32d3abf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ ikiwiki (3.04) UNRELEASED; urgency=low - * apache404: New plugin which lets you use the IkiWiki CGI script as + * 404: New plugin which lets you use the IkiWiki CGI script as an Apache 404 handler, to give the behaviour of various other wiki engines where visiting a nonexistent page provides you with a link to create it. (smcv) diff --git a/debian/copyright b/debian/copyright index bdfbaa573..f589b4a8f 100644 --- a/debian/copyright +++ b/debian/copyright @@ -118,7 +118,7 @@ Copyright: © 2008 Simon McVittie License: GPL-2+ -Files: apache404.pm +Files: 404.pm Copyright: © 2009 Simon McVittie License: GPL-2+ diff --git a/doc/plugins/404.mdwn b/doc/plugins/404.mdwn new file mode 100644 index 000000000..8d36279c8 --- /dev/null +++ b/doc/plugins/404.mdwn @@ -0,0 +1,11 @@ +[[!template id=plugin name=404 author="[[Simon_McVittie|smcv]]"]] +[[!tag type/useful]] + +This plugin lets you use the IkiWiki CGI script as an Apache 404 handler, +to give the behaviour of various other wiki engines where visiting a +nonexistent page provides you with a link to create it. + +To achieve this, put something like this in the wiki's Apache configuration +file: + + ErrorDocument 404 /cgi-bin/ikiwiki.cgi diff --git a/doc/plugins/apache404.mdwn b/doc/plugins/apache404.mdwn deleted file mode 100644 index bab8fb59d..000000000 --- a/doc/plugins/apache404.mdwn +++ /dev/null @@ -1,11 +0,0 @@ -[[!template id=plugin name=apache404 author="[[Simon_McVittie|smcv]]"]] -[[!tag type/useful]] - -This plugin lets you use the IkiWiki CGI script as an Apache 404 handler, -to give the behaviour of various other wiki engines where visiting a -nonexistent page provides you with a link to create it. - -To achieve this, put something like this in the wiki's Apache configuration -file: - - ErrorDocument 404 /cgi-bin/ikiwiki.cgi diff --git a/doc/plugins/goto.mdwn b/doc/plugins/goto.mdwn index 21dda16b2..9c401c5d2 100644 --- a/doc/plugins/goto.mdwn +++ b/doc/plugins/goto.mdwn @@ -2,7 +2,7 @@ [[!tag type/useful]] This plugin adds a `do=goto` mode for the IkiWiki CGI script. It's mainly -for internal use by the [[apache404]], [[comments]] and [[recentchanges]] +for internal use by the [[404]], [[comments]] and [[recentchanges]] plugins, which enable it automatically. With this plugin enabled you can link to `ikiwiki.cgi?do=goto&page=some/where` diff --git a/doc/tips/dot_cgi.mdwn b/doc/tips/dot_cgi.mdwn index ffcbf95d4..04d7a9721 100644 --- a/doc/tips/dot_cgi.mdwn +++ b/doc/tips/dot_cgi.mdwn @@ -26,11 +26,10 @@ configuration changes should work anywhere. Or, if you've put it in a `~/public_html`, edit `/etc/apache2/mods-available/userdir.conf`. -You may also want to enable the [[plugins/apache404]] -plugin. To make apache use it, the apache config file -will need a further modification to make it use ikiwiki's CGI -as the apache 404 handler. Something like this, with -the path adjusted to where you've put the CGI: +* You may also want to enable the [[plugins/404]] plugin. + To make apache use it, the apache config file will need a further + modification to make it use ikiwiki's CGI as the apache 404 handler. + Something like this, with the path adjusted to where you've put the CGI: ErrorDocument 404 /cgi-bin/ikiwiki.cgi diff --git a/t/404.t b/t/404.t new file mode 100755 index 000000000..0bb3c6063 --- /dev/null +++ b/t/404.t @@ -0,0 +1,44 @@ +#!/usr/bin/perl +use warnings; +use strict; +use Test::More tests => 17; + +BEGIN { use_ok("IkiWiki::Plugin::404"); } + +sub cgi_page_from_404 { + return IkiWiki::Plugin::404::cgi_page_from_404(shift, shift, shift); +} + +$IkiWiki::config{htmlext} = 'html'; + +is(cgi_page_from_404('/', 'http://example.com', 1), 'index'); +is(cgi_page_from_404('/index.html', 'http://example.com', 0), 'index'); +is(cgi_page_from_404('/', 'http://example.com/', 1), 'index'); +is(cgi_page_from_404('/index.html', 'http://example.com/', 0), 'index'); + +is(cgi_page_from_404('/~user/foo/bar', 'http://example.com/~user', 1), + 'foo/bar'); +is(cgi_page_from_404('/~user/foo/bar/index.html', 'http://example.com/~user', 1), + 'foo/bar'); +is(cgi_page_from_404('/~user/foo/bar/', 'http://example.com/~user', 1), + 'foo/bar'); +is(cgi_page_from_404('/~user/foo/bar.html', 'http://example.com/~user', 0), + 'foo/bar'); + +is(cgi_page_from_404('/~user/foo/bar', 'http://example.com/~user/', 1), + 'foo/bar'); +is(cgi_page_from_404('/~user/foo/bar/index.html', 'http://example.com/~user/', 1), + 'foo/bar'); +is(cgi_page_from_404('/~user/foo/bar/', 'http://example.com/~user/', 1), + 'foo/bar'); +is(cgi_page_from_404('/~user/foo/bar.html', 'http://example.com/~user/', 0), + 'foo/bar'); + +is(cgi_page_from_404('/~user/foo', 'https://example.com/~user', 1), + 'foo'); +is(cgi_page_from_404('/~user/foo/index.html', 'https://example.com/~user', 1), + 'foo'); +is(cgi_page_from_404('/~user/foo/', 'https://example.com/~user', 1), + 'foo'); +is(cgi_page_from_404('/~user/foo.html', 'https://example.com/~user', 0), + 'foo'); diff --git a/t/apache404.t b/t/apache404.t deleted file mode 100755 index 00fc35250..000000000 --- a/t/apache404.t +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/perl -use warnings; -use strict; -use Test::More tests => 17; - -BEGIN { use_ok("IkiWiki::Plugin::apache404"); } - -sub cgi_page_from_404 { - return IkiWiki::Plugin::apache404::cgi_page_from_404(shift, shift, - shift); -} - -$IkiWiki::config{htmlext} = 'html'; - -is(cgi_page_from_404('/', 'http://example.com', 1), 'index'); -is(cgi_page_from_404('/index.html', 'http://example.com', 0), 'index'); -is(cgi_page_from_404('/', 'http://example.com/', 1), 'index'); -is(cgi_page_from_404('/index.html', 'http://example.com/', 0), 'index'); - -is(cgi_page_from_404('/~user/foo/bar', 'http://example.com/~user', 1), - 'foo/bar'); -is(cgi_page_from_404('/~user/foo/bar/index.html', 'http://example.com/~user', 1), - 'foo/bar'); -is(cgi_page_from_404('/~user/foo/bar/', 'http://example.com/~user', 1), - 'foo/bar'); -is(cgi_page_from_404('/~user/foo/bar.html', 'http://example.com/~user', 0), - 'foo/bar'); - -is(cgi_page_from_404('/~user/foo/bar', 'http://example.com/~user/', 1), - 'foo/bar'); -is(cgi_page_from_404('/~user/foo/bar/index.html', 'http://example.com/~user/', 1), - 'foo/bar'); -is(cgi_page_from_404('/~user/foo/bar/', 'http://example.com/~user/', 1), - 'foo/bar'); -is(cgi_page_from_404('/~user/foo/bar.html', 'http://example.com/~user/', 0), - 'foo/bar'); - -is(cgi_page_from_404('/~user/foo', 'https://example.com/~user', 1), - 'foo'); -is(cgi_page_from_404('/~user/foo/index.html', 'https://example.com/~user', 1), - 'foo'); -is(cgi_page_from_404('/~user/foo/', 'https://example.com/~user', 1), - 'foo'); -is(cgi_page_from_404('/~user/foo.html', 'https://example.com/~user', 0), - 'foo'); -- cgit v1.2.3 From 7bf1207c07c12623f6afc791bf33037b92477c93 Mon Sep 17 00:00:00 2001 From: bremner Date: Wed, 4 Feb 2009 07:50:53 -0500 Subject: --- doc/plugins/contrib/sourcehighlight.mdwn | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/sourcehighlight.mdwn b/doc/plugins/contrib/sourcehighlight.mdwn index fb368945b..ac80f015c 100644 --- a/doc/plugins/contrib/sourcehighlight.mdwn +++ b/doc/plugins/contrib/sourcehighlight.mdwn @@ -12,11 +12,6 @@ highlight - I would like to have a link to the raw source; using will_render() and then copying the file should work. -- the common case of foo.c and foo.h breaks -because they both generate page working/dir/foo. -It looks to me like ikiwiki is hardcoded to strip the extension in `pagename()` (IkiWiki.pm). -This problem with sourcehighlight needs to be fixed before it is very useful. - - Is there a way to configure the colors used by source-highlight (other than editing the globally installed "default.style" file)? It would help if I could pass the command arbitrary command-line arguments; then I could configure which config file it's supposed to use. For instance, I'm not a fan of hard-coding the colors into the HTML output. IMHO, css-style formatting should be preferred. All that can be set via the command line ... --Peter > I don't really have time right now, but it should be easy to add, if you look at how src-lang is handled. Patches are welcome :-) --[[DavidBremner]] @@ -25,3 +20,5 @@ Note that [[Will]] wrote a plugin that uses source-highlight also. It's available [here|todo/automatic_use_of_syntax_plugin_on_source_code_files/discussion]]. --[[Joey]] + +*Updated* Now uses keepextension so multiple extensions should be OK -- cgit v1.2.3 From 80f2edffc0283d1e6074d9a18676795d35e6f4e1 Mon Sep 17 00:00:00 2001 From: bremner Date: Wed, 4 Feb 2009 07:56:04 -0500 Subject: fix joeyh's link :-) --- doc/plugins/contrib/sourcehighlight.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/sourcehighlight.mdwn b/doc/plugins/contrib/sourcehighlight.mdwn index ac80f015c..83ef879d7 100644 --- a/doc/plugins/contrib/sourcehighlight.mdwn +++ b/doc/plugins/contrib/sourcehighlight.mdwn @@ -18,7 +18,7 @@ highlight Note that [[Will]] wrote a plugin that uses source-highlight also. It's available -[here|todo/automatic_use_of_syntax_plugin_on_source_code_files/discussion]]. +[[here|todo/automatic_use_of_syntax_plugin_on_source_code_files/discussion]]. --[[Joey]] *Updated* Now uses keepextension so multiple extensions should be OK -- cgit v1.2.3 From d2842c126b199daece1839a6856b369123ef94d1 Mon Sep 17 00:00:00 2001 From: bremner Date: Wed, 4 Feb 2009 08:03:13 -0500 Subject: note possible abandonment of sourcehighlight in favour of sourcecode --- doc/plugins/contrib/sourcehighlight.mdwn | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/sourcehighlight.mdwn b/doc/plugins/contrib/sourcehighlight.mdwn index 83ef879d7..df480f325 100644 --- a/doc/plugins/contrib/sourcehighlight.mdwn +++ b/doc/plugins/contrib/sourcehighlight.mdwn @@ -21,4 +21,8 @@ available [[here|todo/automatic_use_of_syntax_plugin_on_source_code_files/discussion]]. --[[Joey]] +To be honest, [[Will]]'s version of this looks more polished. I will try his +plugin and see if it can just replace mine. --[[DavidBremner]] + + *Updated* Now uses keepextension so multiple extensions should be OK -- cgit v1.2.3 From 971df8889b46f314afb6d4e2e052c8ee7738b756 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 5 Feb 2009 15:31:37 -0500 Subject: note about path --- doc/plugins/404.mdwn | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/404.mdwn b/doc/plugins/404.mdwn index 8d36279c8..8a7ccd7d6 100644 --- a/doc/plugins/404.mdwn +++ b/doc/plugins/404.mdwn @@ -8,4 +8,7 @@ nonexistent page provides you with a link to create it. To achieve this, put something like this in the wiki's Apache configuration file: - ErrorDocument 404 /cgi-bin/ikiwiki.cgi + ErrorDocument 404 /ikiwiki.cgi + +(The path here needs to be whatever the path is to the ikiwiki.cgi from +the root of your web server.) -- cgit v1.2.3 From af5758049140265b22c17375ee195f6dcfbffa7b Mon Sep 17 00:00:00 2001 From: "http://taozhyn.myopenid.com/" Date: Fri, 6 Feb 2009 14:36:04 -0500 Subject: --- doc/plugins/tag/discussion.mdwn | 97 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/tag/discussion.mdwn b/doc/plugins/tag/discussion.mdwn index 7e7b88bc5..e478ec564 100644 --- a/doc/plugins/tag/discussion.mdwn +++ b/doc/plugins/tag/discussion.mdwn @@ -22,3 +22,100 @@ AOLMODE=true echo "I too would really like this feature, which would make cgi fr better" --[[DavidBremner]] Please make the actual text used a template some way or another. I may want `map` instead of `inline`. --[[madduck]] + +--- + +I have create a patch to tag.pm for add the option for auto create tag pages. +A new setting is used to enable or disable auto-create tag pages, `tag_autocreate`. +The new tag file is created during the preprocess phase. +The new tag file is then complied during the change phase. + + --- tag.pm 2009-02-06 10:26:03.000000000 -0700 + +++ tag_new.pm 2009-02-06 12:17:19.000000000 -0700 + @@ -14,6 +14,7 @@ + hook(type => "preprocess", id => "tag", call => \&preprocess_tag, scan => 1); + hook(type => "preprocess", id => "taglink", call => \&preprocess_taglink, scan => 1); + hook(type => "pagetemplate", id => "tag", call => \&pagetemplate); + + hook(type => "change", id => "tag", call => \&change); + } + + sub getopt () { + @@ -36,6 +37,36 @@ + safe => 1, + rebuild => 1, + }, + + tag_autocreate => { + + type => "boolean", + + example => 0, + + description => "Auto-create the new tag pages, uses autotagpage.tmpl ", + + safe => 1, + + rebulid => 1, + + }, + +} + + + +my $autocreated_page = 0; + + + +sub gen_tag_page($) { + + my $tag=shift; + + + + my $tag_file=$tag.'.'.$config{default_pageext}; + + return if (-f $config{srcdir}.$tag_file); + + + + my $template=template("autotagpage.tmpl"); + + $template->param(tag => $tag); + + writefile($tag_file, $config{srcdir}, $template->output); + + $autocreated_page = 1; + + + + if ($config{rcs}) { + + IkiWiki::disable_commit_hook(); + + IkiWiki::rcs_add($tag_file); + + IkiWiki::rcs_commit_staged( + + gettext("Automatic tag page generation"), + + undef, undef); + + IkiWiki::enable_commit_hook(); + + } + } + + sub tagpage ($) { + @@ -47,6 +78,10 @@ + $tag=~y#/#/#s; # squash dups + } + + + if (defined $config{tag_autocreate} && $config{tag_autocreate} ) { + + gen_tag_page($tag); + + } + + + return $tag; + } + + @@ -125,4 +160,18 @@ + } + } + + +sub change(@) { + + return unless($autocreated_page); + + $autocreated_page = 0; + + + + # This refresh/saveindex is to complie the autocreated tag pages + + IkiWiki::refresh(); + + IkiWiki::saveindex(); + + + + # This refresh/saveindex is to fix the Tags link + + # With out this additional refresh/saveindex the tag link displays ?tag + + IkiWiki::refresh(); + + IkiWiki::saveindex(); + +} + + + + +This uses a template called `autotagpage.tmpl`, here is my template file: + + \[[!inline pages="link()" archive="yes"]] + + +A quirk I have not figured out is during the `sub change`, see my comments in the code. +I am not sure if that is the best way to handle it. + +[[!tag patch]] +-- Jeremy Schultz + -- cgit v1.2.3 From f444d1206a75e597f65092e12dfbb061caa34ebd Mon Sep 17 00:00:00 2001 From: "http://www.cse.unsw.edu.au/~willu/" Date: Sat, 7 Feb 2009 05:47:32 -0500 Subject: Note todo with patch attached to solve listed problem --- doc/plugins/contrib/sourcehighlight.mdwn | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/sourcehighlight.mdwn b/doc/plugins/contrib/sourcehighlight.mdwn index df480f325..07ac2086f 100644 --- a/doc/plugins/contrib/sourcehighlight.mdwn +++ b/doc/plugins/contrib/sourcehighlight.mdwn @@ -10,7 +10,9 @@ where foo and bar are the (source-supported) languages you want to highlight ### Issues -- I would like to have a link to the raw source; using will_render() and then copying the file should work. +- I would like to have a link to the raw source; using will_render() and then copying the file should work. + +> You might also like to look at the [[todo/source_link]] todo. -- [[Will]] - Is there a way to configure the colors used by source-highlight (other than editing the globally installed "default.style" file)? It would help if I could pass the command arbitrary command-line arguments; then I could configure which config file it's supposed to use. For instance, I'm not a fan of hard-coding the colors into the HTML output. IMHO, css-style formatting should be preferred. All that can be set via the command line ... --Peter -- cgit v1.2.3 From 9a84181ad9bbef5bdc4a9ecb3160994f79d8b9cb Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 9 Feb 2009 16:04:33 -0500 Subject: document writefile symlink checks --- doc/plugins/write.mdwn | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 99eea3d16..1a119b99b 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -629,6 +629,16 @@ A failure to write the file will result in it dying with an error. If the destination directory doesn't exist, it will first be created. +The filename and directory are separate parameters because of +some security checks done to avoid symlink attacks. Before writing a file, +it checks to make sure there's not a symlink with its name, to avoid +following the symlink. If the filename parameter includes a subdirectory +to put the file in, it also checks if that subdirectory is a symlink, etc. +The directory parameter, however, is not checked for symlinks. So, +generally the directory parameter is a trusted toplevel directory like +the srcdir or destdir, and any subdirectories of this are included in the +filename parameter. + #### `will_render($$)` Given a page name and a destination file name (not including the base -- cgit v1.2.3 From 42b16cf8f3fb82f3c66100df46f92a4cf4a51d1b Mon Sep 17 00:00:00 2001 From: "http://weakish.int.eu.org/" Date: Tue, 10 Feb 2009 06:21:55 -0500 Subject: ikiwiki deb (3.0.3) doesn't suggests libtext-wikicreole-perl --- doc/plugins/creole/discussion.mdwn | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/creole/discussion.mdwn b/doc/plugins/creole/discussion.mdwn index 36b7ba869..9d58fffbf 100644 --- a/doc/plugins/creole/discussion.mdwn +++ b/doc/plugins/creole/discussion.mdwn @@ -8,4 +8,6 @@ I've installed Text::WikiCreole 0.05 and enabled the plugin, but I get an error >> I've added the patch to pkgsrc as well. Thanks. --[[schmonz]] +>> Currently the creole plugin is included in ikiwiki but the ikiwiki deb (3.0.3) doesn't suggests libtext-wikicreole-perl. Why? --[[weakish]] + I'm moving over a really stinkingly old UseMod and creole seems the nearest match. I've worked out that Bare /Subpage links need to become \[\[Subpage\]\], and Top/Sub links need to be \[\[Top/Sub\]\] (or \[\[Top/Sub|Top/Sub\]\], to display in exactly the same way), but I'm stuck on generic hyperlinks. The creole cheat sheet says I should be able to do \[\[http://url.path/foo|LinkText\]\], but that comes out as a link to create the "linktext" page, and Markdown-style \[Link Text\](http://url.path/foo) just gets rendered as is. Any suggestions? --[[schmonz]] -- cgit v1.2.3 From 2d989db76ae10552dc7406b23a9aceda167f4b1c Mon Sep 17 00:00:00 2001 From: "http://weakish.int.eu.org/" Date: Tue, 10 Feb 2009 08:10:13 -0500 Subject: more details on ikiwiki directives --- doc/plugins/creole.mdwn | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/creole.mdwn b/doc/plugins/creole.mdwn index c6491f754..6961e8d1d 100644 --- a/doc/plugins/creole.mdwn +++ b/doc/plugins/creole.mdwn @@ -13,4 +13,10 @@ wiki markup formats, so should be fairly easy to guess at. There is also a Links are standard [[WikiLinks|ikiwiki/WikiLink]]. Links and [[directives|ikiwiki/directive]] inside `{{{ }}}` blocks are still expanded, -since this happens before the creole format is processed. +since this happens before the creole format is processed. (You need to escape +them manually, via \\\[[directives]], the ~ escaping of creole doesn't work on +this.) + +The standard ikiwiki [[WikiLinks|ikiwiki/WikiLink]] is almost the same as Creole link, except that creole uses \[[pagename|description]] while ikiwiki uses \[[description|pagename]]. + + -- cgit v1.2.3 From fc2ec9255a0557ab461d933ad787cbe71aecf675 Mon Sep 17 00:00:00 2001 From: "http://weakish.int.eu.org/" Date: Wed, 11 Feb 2009 01:56:01 -0500 Subject: add instruction of lighttpd --- doc/plugins/404.mdwn | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/404.mdwn b/doc/plugins/404.mdwn index 8a7ccd7d6..ad332ee04 100644 --- a/doc/plugins/404.mdwn +++ b/doc/plugins/404.mdwn @@ -12,3 +12,9 @@ file: (The path here needs to be whatever the path is to the ikiwiki.cgi from the root of your web server.) + +Or put something like this in the wiki's Lighttpd (>=1.4.17) configuration file: + + server.error-handler-404 = "/ikiwiki.cgi" + + -- cgit v1.2.3 From 80781387fc5f0c797f6e1b8678db2f253af4b7f8 Mon Sep 17 00:00:00 2001 From: "http://weakish.int.eu.org/" Date: Wed, 11 Feb 2009 03:08:33 -0500 Subject: [tiny] add a link to meta plugin page --- ...fault_content_for___42__copyright__42___and___42__license__42__.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/plugins') 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 3efc68418..adb414ffb 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 @@ -20,7 +20,7 @@ template variable somebody wants to use. --[[bma]] Copyright and license values are not "template values", they are values -tracked by the meta plugin, and that various code compares and uses to fill +tracked by the [[meta]] plugin, and that various code compares and uses to fill out the templates. Something like varioki cannot do that. --[[Joey]] Somewhat more detailed usage documentation would be appreciated. I tried to setup -- cgit v1.2.3 From 4d25fce92a8c00951db9623eb98cf6e7de3c2121 Mon Sep 17 00:00:00 2001 From: "http://weakish.int.eu.org/" Date: Wed, 11 Feb 2009 05:32:51 -0500 Subject: removed --- doc/plugins/shortcut/discussion.mdwn | 1 - 1 file changed, 1 deletion(-) delete mode 100644 doc/plugins/shortcut/discussion.mdwn (limited to 'doc/plugins') diff --git a/doc/plugins/shortcut/discussion.mdwn b/doc/plugins/shortcut/discussion.mdwn deleted file mode 100644 index 8b1378917..000000000 --- a/doc/plugins/shortcut/discussion.mdwn +++ /dev/null @@ -1 +0,0 @@ - -- cgit v1.2.3 From a7e119767ce0b042075fd8955599e30df13e290b Mon Sep 17 00:00:00 2001 From: "http://weakish.int.eu.org/" Date: Thu, 12 Feb 2009 03:31:02 -0500 Subject: use shortcut with mdwn disabled --- doc/plugins/shortcut/discussion.mdwn | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 doc/plugins/shortcut/discussion.mdwn (limited to 'doc/plugins') diff --git a/doc/plugins/shortcut/discussion.mdwn b/doc/plugins/shortcut/discussion.mdwn new file mode 100644 index 000000000..d11639856 --- /dev/null +++ b/doc/plugins/shortcut/discussion.mdwn @@ -0,0 +1,16 @@ +The plugin somehow depends on [[mdwn]]. If you have +disabled [[mdwn]], to get [[shortcut]] work, you need +commit in a shortcuts.ext (ext is rcs|creole|html|txt|etc). + +Then edit the following lines in[[shortcut]] plugin source: + + my $srcfile=srcfile("shortcuts.mdwn", 1); + +and + + error(gettext("shortcut plugin will not work without a shortcuts.mdwn")); + + +(It is better to edit a local copy of shortcut.pm in, say, ~/.ikiwiki/IkiWiki/Plugin +and add ~/.ikiwiki to libdir in your ikiwiki.setup then edit the shortcut.pm installed +in system directly.) -- cgit v1.2.3 From 0826d993461c16c91de5d36ff4fc5b2e2bfd6f8c Mon Sep 17 00:00:00 2001 From: "http://weakish.int.eu.org/" Date: Thu, 12 Feb 2009 03:33:20 -0500 Subject: typo --- doc/plugins/shortcut/discussion.mdwn | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/shortcut/discussion.mdwn b/doc/plugins/shortcut/discussion.mdwn index d11639856..8fa3f7acf 100644 --- a/doc/plugins/shortcut/discussion.mdwn +++ b/doc/plugins/shortcut/discussion.mdwn @@ -1,8 +1,8 @@ The plugin somehow depends on [[mdwn]]. If you have disabled [[mdwn]], to get [[shortcut]] work, you need -commit in a shortcuts.ext (ext is rcs|creole|html|txt|etc). +commit in a shortcuts.ext (ext is `rcs|creole|html|txt|etc`). -Then edit the following lines in[[shortcut]] plugin source: +Then edit the following lines in [[shortcut]] plugin source: my $srcfile=srcfile("shortcuts.mdwn", 1); @@ -12,5 +12,5 @@ and (It is better to edit a local copy of shortcut.pm in, say, ~/.ikiwiki/IkiWiki/Plugin -and add ~/.ikiwiki to libdir in your ikiwiki.setup then edit the shortcut.pm installed +and add ~/.ikiwiki to libdir in your ikiwiki.setup than edit the shortcut.pm installed in system directly.) -- cgit v1.2.3 From 978a3570dbec85376fc44a3e564079664f5c26e5 Mon Sep 17 00:00:00 2001 From: "http://weakish.int.eu.org/" Date: Thu, 12 Feb 2009 05:08:58 -0500 Subject: warning about disable mdwn --- doc/plugins/mdwn/discussion.mdwn | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 doc/plugins/mdwn/discussion.mdwn (limited to 'doc/plugins') diff --git a/doc/plugins/mdwn/discussion.mdwn b/doc/plugins/mdwn/discussion.mdwn new file mode 100644 index 000000000..9ebf99b7e --- /dev/null +++ b/doc/plugins/mdwn/discussion.mdwn @@ -0,0 +1,11 @@ +Unlike other format, ikiwiki is somehow depends +on mdwn, since the underlay dir +is written in mdwn. If you want to disable mdwn, +you need to overwrite the underlay +dir (set underlaydir in ikiwiki.setup +to your own underlay dir or replace underlay pages +in your $SRC). + +Specially, the [[shortcut]] plugin is hardcoded to +use shortcuts.mdwn. So you need pay more care if +you [[use shortcut without mdwn|shortcut/discussion]]. -- cgit v1.2.3 From aa88d6beeff168b2bd56f90646dede7c89acc4ea Mon Sep 17 00:00:00 2001 From: "http://weakish.int.eu.org/" Date: Thu, 12 Feb 2009 05:54:20 -0500 Subject: patch for shortcut.pm to use $default_pageext instead of hardcode .mdwn. --- doc/plugins/shortcut/discussion.mdwn | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/shortcut/discussion.mdwn b/doc/plugins/shortcut/discussion.mdwn index 8fa3f7acf..770c95836 100644 --- a/doc/plugins/shortcut/discussion.mdwn +++ b/doc/plugins/shortcut/discussion.mdwn @@ -1,16 +1,27 @@ -The plugin somehow depends on [[mdwn]]. If you have +The plugin depends on [[mdwn]]. If you have disabled [[mdwn]], to get [[shortcut]] work, you need -commit in a shortcuts.ext (ext is `rcs|creole|html|txt|etc`). +commit in a shortcuts.ext (ext is `rcs|creole|html|txt|etc`), +and edit/patch [[shortcut]]. -Then edit the following lines in [[shortcut]] plugin source: +Maybe use the $default_pageext is better than hardcode .mdwn? - my $srcfile=srcfile("shortcuts.mdwn", 1); +
    +--- shortcut.pm.orig    2009-02-12 02:05:22.000000000 -0600
    ++++ shortcut.pm 2009-02-12 04:41:30.000000000 -0600
    +@@ -23,9 +23,9 @@
    +        if (defined $config{srcdir}) {
    +                # Preprocess the shortcuts page to get all the available shortcuts
    +                # defined before other pages are rendered.
    +-               my $srcfile=srcfile("shortcuts.mdwn", 1);
    ++               my $srcfile=srcfile("shortcuts.$config{default_pageext}", 1);
    +                if (! defined $srcfile) {
    +-                       error(gettext("shortcut plugin will not work without a shortcuts.mdwn"));
    ++                       error(gettext("shortcut plugin will not work without a shortcuts.$config{default_pageext}"));
    +                }
    +                IkiWiki::preprocess("shortcuts", "shortcuts", readfile($srcfile));
    +        }
    +
    -and +--[[weakish]] - error(gettext("shortcut plugin will not work without a shortcuts.mdwn")); - -(It is better to edit a local copy of shortcut.pm in, say, ~/.ikiwiki/IkiWiki/Plugin -and add ~/.ikiwiki to libdir in your ikiwiki.setup than edit the shortcut.pm installed -in system directly.) -- cgit v1.2.3 From 46819b530bca5a3adf00278500a34363a94c1fb2 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 12 Feb 2009 13:02:58 -0500 Subject: shortcut: If default_pageext is set, first look for shortcuts.default_pageext Falls back to looking for shortcuts.mdwn for backwards compatabiity; there probably exist wikis that have changed the pageext but still use shortcuts.mdwn. --- IkiWiki/Plugin/shortcut.pm | 8 ++++++-- debian/changelog | 2 ++ doc/plugins/mdwn/discussion.mdwn | 4 ---- doc/plugins/shortcut/discussion.mdwn | 21 +++------------------ 4 files changed, 11 insertions(+), 24 deletions(-) (limited to 'doc/plugins') diff --git a/IkiWiki/Plugin/shortcut.pm b/IkiWiki/Plugin/shortcut.pm index 0e7cbd4d1..c1e6a7eb3 100644 --- a/IkiWiki/Plugin/shortcut.pm +++ b/IkiWiki/Plugin/shortcut.pm @@ -23,9 +23,13 @@ sub checkconfig () { if (defined $config{srcdir}) { # Preprocess the shortcuts page to get all the available shortcuts # defined before other pages are rendered. - my $srcfile=srcfile("shortcuts.mdwn", 1); + my $srcfile=srcfile("shortcuts.".$config{default_pageext}, 1); if (! defined $srcfile) { - error(gettext("shortcut plugin will not work without a shortcuts.mdwn")); + $srcfile=srcfile("shortcuts.mdwn", 1); + } + if (! defined $srcfile) { + error(sprintf(gettext("shortcut plugin will not work without %s"), + "shortcuts.".$config{default_pageext})); } IkiWiki::preprocess("shortcuts", "shortcuts", readfile($srcfile)); } diff --git a/debian/changelog b/debian/changelog index 294d23197..7467508f6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,8 @@ ikiwiki (3.04) UNRELEASED; urgency=low * Fix unusual --setup --post-commit command line option combo. * Create any missing directory necessary to put the wrapper file into. Closes: #514384 + * shortcut: If default_pageext is set, first look for + shortcuts.default_pageext. -- Joey Hess Sat, 31 Jan 2009 19:04:45 -0500 diff --git a/doc/plugins/mdwn/discussion.mdwn b/doc/plugins/mdwn/discussion.mdwn index 9ebf99b7e..4b05e7f4e 100644 --- a/doc/plugins/mdwn/discussion.mdwn +++ b/doc/plugins/mdwn/discussion.mdwn @@ -5,7 +5,3 @@ you need to overwrite the underlay dir (set underlaydir in ikiwiki.setup to your own underlay dir or replace underlay pages in your $SRC). - -Specially, the [[shortcut]] plugin is hardcoded to -use shortcuts.mdwn. So you need pay more care if -you [[use shortcut without mdwn|shortcut/discussion]]. diff --git a/doc/plugins/shortcut/discussion.mdwn b/doc/plugins/shortcut/discussion.mdwn index 770c95836..4e11ce08c 100644 --- a/doc/plugins/shortcut/discussion.mdwn +++ b/doc/plugins/shortcut/discussion.mdwn @@ -3,25 +3,10 @@ disabled [[mdwn]], to get [[shortcut]] work, you need commit in a shortcuts.ext (ext is `rcs|creole|html|txt|etc`), and edit/patch [[shortcut]]. -Maybe use the $default_pageext is better than hardcode .mdwn? - -
    ---- shortcut.pm.orig    2009-02-12 02:05:22.000000000 -0600
    -+++ shortcut.pm 2009-02-12 04:41:30.000000000 -0600
    -@@ -23,9 +23,9 @@
    -        if (defined $config{srcdir}) {
    -                # Preprocess the shortcuts page to get all the available shortcuts
    -                # defined before other pages are rendered.
    --               my $srcfile=srcfile("shortcuts.mdwn", 1);
    -+               my $srcfile=srcfile("shortcuts.$config{default_pageext}", 1);
    -                if (! defined $srcfile) {
    --                       error(gettext("shortcut plugin will not work without a shortcuts.mdwn"));
    -+                       error(gettext("shortcut plugin will not work without a shortcuts.$config{default_pageext}"));
    -                }
    -                IkiWiki::preprocess("shortcuts", "shortcuts", readfile($srcfile));
    -        }
    -
    +Maybe use the `default_pageext` is better than hardcode .mdwn? --[[weakish]] +> done, it will use `default_pageext` now --[[Joey]] + -- cgit v1.2.3 From 9e786e7b2424b493bce092497fd648f4e96f7e14 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 12 Feb 2009 13:15:23 -0500 Subject: update deps and bundles --- Bundle/IkiWiki.pm | 12 ++++++------ Bundle/IkiWiki/Extras.pm | 4 ++++ debian/control | 2 +- doc/plugins/creole/discussion.mdwn | 2 ++ 4 files changed, 13 insertions(+), 7 deletions(-) (limited to 'doc/plugins') diff --git a/Bundle/IkiWiki.pm b/Bundle/IkiWiki.pm index 74832323a..769791d30 100644 --- a/Bundle/IkiWiki.pm +++ b/Bundle/IkiWiki.pm @@ -16,17 +16,17 @@ perl -MCPAN -e 'install Bundle::IkiWiki' =head1 CONTENTS -XML::Simple Text::Markdown -Date::Parse -HTML::Template HTML::Scrubber -CGI +HTML::Template +HTML::Parser +URI +XML::Simple +Date::Parse CGI::FormBuilder CGI::Session Mail::Sendmail -HTML::Parser -URI +CGI Data::Dumper =head1 AUTHOR diff --git a/Bundle/IkiWiki/Extras.pm b/Bundle/IkiWiki/Extras.pm index abf596f00..582d4a966 100644 --- a/Bundle/IkiWiki/Extras.pm +++ b/Bundle/IkiWiki/Extras.pm @@ -31,6 +31,10 @@ Text::Textile Text::WikiFormat XML::Feed Net::Amazon::S3 +Text::WikiCreole +Term::ReadLine::Gnu +HTML::Tree +Authen::Passphrase =head1 AUTHOR diff --git a/debian/control b/debian/control index fe5c3eee7..8622362bf 100644 --- a/debian/control +++ b/debian/control @@ -14,7 +14,7 @@ Package: ikiwiki Architecture: all Depends: ${perl:Depends}, libtext-markdown-perl | markdown, libhtml-scrubber-perl, libhtml-template-perl, libhtml-parser-perl, liburi-perl Recommends: gcc | c-compiler, libc6-dev | libc-dev, subversion | git-core (>= 1:1.5.0) | tla | bzr (>= 0.91) | mercurial | monotone (>= 0.38), libxml-simple-perl, libnet-openid-consumer-perl, liblwpx-paranoidagent-perl, libtimedate-perl, libcgi-formbuilder-perl (>= 3.05), libcgi-session-perl (>= 4.14-1), libmail-sendmail-perl, libauthen-passphrase-perl, libterm-readline-gnu-perl -Suggests: viewvc | gitweb | viewcvs, libsearch-xapian-perl, xapian-omega (>= 1.0.5), librpc-xml-perl, libtext-wikiformat-perl, python, python-docutils, polygen, tidy, libhtml-tree-perl, libxml-feed-perl, libmailtools-perl, perlmagick, libfile-mimeinfo-perl, libcrypt-ssleay-perl, liblocale-gettext-perl (>= 1.05-1), libtext-typography-perl, libtext-csv-perl, libdigest-sha1-perl, graphviz, libnet-amazon-s3-perl, sparkline-php, texlive, dvipng +Suggests: viewvc | gitweb | viewcvs, libsearch-xapian-perl, xapian-omega (>= 1.0.5), librpc-xml-perl, libtext-wikiformat-perl, python, python-docutils, polygen, tidy, libhtml-tree-perl, libxml-feed-perl, libmailtools-perl, perlmagick, libfile-mimeinfo-perl, libcrypt-ssleay-perl, liblocale-gettext-perl (>= 1.05-1), libtext-typography-perl, libtext-csv-perl, libdigest-sha1-perl, graphviz, libnet-amazon-s3-perl, sparkline-php, texlive, dvipng, libtext-wikicreole-perl Conflicts: ikiwiki-plugin-table Replaces: ikiwiki-plugin-table Provides: ikiwiki-plugin-table diff --git a/doc/plugins/creole/discussion.mdwn b/doc/plugins/creole/discussion.mdwn index 9d58fffbf..38ee2bd78 100644 --- a/doc/plugins/creole/discussion.mdwn +++ b/doc/plugins/creole/discussion.mdwn @@ -10,4 +10,6 @@ I've installed Text::WikiCreole 0.05 and enabled the plugin, but I get an error >> Currently the creole plugin is included in ikiwiki but the ikiwiki deb (3.0.3) doesn't suggests libtext-wikicreole-perl. Why? --[[weakish]] +>>> forgot, done now --[[Joey]] + I'm moving over a really stinkingly old UseMod and creole seems the nearest match. I've worked out that Bare /Subpage links need to become \[\[Subpage\]\], and Top/Sub links need to be \[\[Top/Sub\]\] (or \[\[Top/Sub|Top/Sub\]\], to display in exactly the same way), but I'm stuck on generic hyperlinks. The creole cheat sheet says I should be able to do \[\[http://url.path/foo|LinkText\]\], but that comes out as a link to create the "linktext" page, and Markdown-style \[Link Text\](http://url.path/foo) just gets rendered as is. Any suggestions? --[[schmonz]] -- cgit v1.2.3 From 206b583c0db7551dd9ec0f36d0f46018fd0f77e2 Mon Sep 17 00:00:00 2001 From: "http://weakish.int.eu.org/" Date: Fri, 13 Feb 2009 04:21:06 -0500 Subject: patch for googleform.tmpl to produce valid XHTML --- doc/plugins/google/discussion.mdwn | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 doc/plugins/google/discussion.mdwn (limited to 'doc/plugins') diff --git a/doc/plugins/google/discussion.mdwn b/doc/plugins/google/discussion.mdwn new file mode 100644 index 000000000..c18157665 --- /dev/null +++ b/doc/plugins/google/discussion.mdwn @@ -0,0 +1,22 @@ +This plugin uses the googleform.tmpl +which produces valid HTML but invalid XHTML. +This is not very good since the default ikiwiki +templates produce XHTML instead of HTML. + +To produces valid XHTML, you need to edit +googleform.tmpl (in e.g. /usr/share/ikiwiki/templates): + + + --- googleform.tmpl.orig 2009-02-13 02:47:00.000000000 -0600 + +++ googleform.tmpl 2009-02-13 02:47:40.000000000 -0600 + @@ -1,6 +1,6 @@ +
    +
    + - + - + + + + +
    +
    + +Just tow tiny changes. -- cgit v1.2.3 From bea8e0ad61578143786f57b416b3dc333864a1e4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 14 Feb 2009 02:38:17 -0500 Subject: apply patch to fix googleform xhtml --- doc/plugins/google/discussion.mdwn | 18 +----------------- templates/googleform.tmpl | 4 ++-- 2 files changed, 3 insertions(+), 19 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/google/discussion.mdwn b/doc/plugins/google/discussion.mdwn index c18157665..babc919d2 100644 --- a/doc/plugins/google/discussion.mdwn +++ b/doc/plugins/google/discussion.mdwn @@ -3,20 +3,4 @@ which produces valid HTML but invalid XHTML. This is not very good since the default ikiwiki templates produce XHTML instead of HTML. -To produces valid XHTML, you need to edit -googleform.tmpl (in e.g. /usr/share/ikiwiki/templates): - - - --- googleform.tmpl.orig 2009-02-13 02:47:00.000000000 -0600 - +++ googleform.tmpl 2009-02-13 02:47:40.000000000 -0600 - @@ -1,6 +1,6 @@ -
    -
    - - - - - + - + -
    -
    - -Just tow tiny changes. +> Fixed, thanks for the patch! --[[Joey]] diff --git a/templates/googleform.tmpl b/templates/googleform.tmpl index 523cff001..e2d4a1f43 100644 --- a/templates/googleform.tmpl +++ b/templates/googleform.tmpl @@ -1,6 +1,6 @@
    - - + +
    -- cgit v1.2.3 From 6f9c18f7cbbdc8305c6d4373a9d8a00d0c47af5f Mon Sep 17 00:00:00 2001 From: AlexandreDupas Date: Mon, 16 Feb 2009 08:00:18 -0500 Subject: correct WikiLinks to the WikiLink page --- doc/plugins/write.mdwn | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 1a119b99b..acf9a2cdd 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -90,6 +90,11 @@ function is passed no values. It's ok for the function to call This hook is called just before ikiwiki scans the wiki for changed files. It's useful for plugins that need to create or modify a source page. The + + + + + function is passed no values. ### needsbuild @@ -107,7 +112,7 @@ adding or removing files from it. This hook is called early in the process of building the wiki, and is used as a first pass scan of the page, to collect metadata about the page. It's -mostly used to scan the page for WikiLinks, and add them to `%links`. +mostly used to scan the page for [[WikiLinks|ikiwiki/WikiLink]], and add them to `%links`. Present in IkiWiki 2.40 and later. The function is passed named parameters "page" and "content". Its return @@ -168,7 +173,7 @@ htmlize the page) along with the rest of the page. hook(type => "linkify", id => "foo", call => \&linkify); -This hook is called to convert [[WikiLinks|WikiLink]] on the page into html +This hook is called to convert [[WikiLinks|ikiwiki/WikiLink]] on the page into html links. The function is passed named parameters "page", "destpage", and "content". It should return the linkified content. Present in IkiWiki 2.40 and later. @@ -434,7 +439,7 @@ describes the plugin as a whole. For example: * `example` can be set to an example value. * `description` is a short description of the option. * `link` is a link to further information about the option. This can either - be a wikilink, or an url. + be a [[ikiwiki/WikiLink]], or an url. * `advanced` can be set to true if the option is more suitable for advanced users. * `safe` should be false if the option should not be displayed in unsafe @@ -680,7 +685,7 @@ a wiki page name. #### `linkpage($)` This converts text that could have been entered by the user as a -[[WikiLink]] into a wiki page name. +[[ikiwiki/WikiLink]] into a wiki page name. #### `srcfile($;$)` @@ -745,7 +750,7 @@ are collected together to form the RecentChanges page, for example. To make an internal use page, register a filename extension that starts with "_". Internal use pages cannot be edited with the web interface, -generally shouldn't contain wikilinks or preprocessor directives (use +generally shouldn't contain [[WikiLinks|ikiwiki/WikiLink]] or preprocessor directives (use either on them with extreme caution), and are not matched by regular PageSpecs glob patterns, but instead only by a special `internal()` [[ikiwiki/PageSpec]]. @@ -914,7 +919,7 @@ or wrap one of the functions. For example, your plugin might want to override `displaytime`, to change the html markup used when displaying a date. Or it might want to override `IkiWiki::formattime`, to change how a date is formatted. Or perhaps you -want to override `bestlink` and change how ikiwiki deals with WikiLinks. +want to override `bestlink` and change how ikiwiki deals with [[WikiLinks|ikiwiki/WikiLink]]. By venturing into this territory, your plugin is becoming tightly tied to ikiwiki's internals. And it might break if those internals change. But -- cgit v1.2.3 From 008f1c19ac354b5d9fd2feaaf20913a29d04297d Mon Sep 17 00:00:00 2001 From: NicolasLimare Date: Tue, 17 Feb 2009 16:04:31 -0500 Subject: easy access to the userdb for apache auth? --- doc/plugins/passwordauth/discussion.mdwn | 50 ++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/passwordauth/discussion.mdwn b/doc/plugins/passwordauth/discussion.mdwn index f4e7ae7a1..8ae960edd 100644 --- a/doc/plugins/passwordauth/discussion.mdwn +++ b/doc/plugins/passwordauth/discussion.mdwn @@ -9,3 +9,53 @@ the *Preferences -- Subscriptions*. --[[tschwinge]] >> Aha, then the problem is Firefox, which is automatically filling the >> *Password* field with its previous value, but not filling the >> *Confirm Password* one. --[[tschwinge]] + +## easy access to the userdb for apache auth? + +My use case is: + +* restricted ikiwiki +* read/edit only allowed from the local network (done with apache restrictions) +* edit only for people authenticated (done with vanilla ikiwiki passwordauth) + +I would like to allow people to read/edit the wiki from outside of the +local network, if and only if they already have an ikiwiki account. + +[[httpauth]] doesn't fit since it doesn't allow anonymous local users +to create their own account. I want a single, local, simple auth +database. + +My (naïve?) idea would be: + +* keep the [[passwordauth]] system +* provide a way for Apache to use the userdb for authentication if +people want to connect from outside + +I looked at the various auth modules for apache2. It seems that none +can use a "perl Storable data" file. So, I think some solutions could +be: + +* use a sqlite database instead of a perl Storable file + * can be used with + [mod_auth_dbd](http://httpd.apache.org/docs/2.2/mod/mod_authn_dbd.html) + * requires a change in ikiwiki module [[passwordauth]] +* use an external program to read the userdb and talk with + [mod_auth_external](http://unixpapa.com/mod_auth_external.html) + * requires the maintainance of this external auth proxy over ikiwiki + userdb format changes + * (I don't know perl) +* include this wrapper in ikiwiki + * something like `ikiwiki --auth user:pass:userdb` check the + `user:pass` pair in `userdb` and returns an Accept/Reject flag to + Apache + * requires a change in ikiwiki core + * still requires + [mod_auth_external](http://unixpapa.com/mod_auth_external.html) +* do it with Apache perl sections + * (I don't know perl) + +Any opinion/suggestion/solution to this is welcome and appreciated. + +-- +[[NicolasLimare]] + -- cgit v1.2.3 From edad904f4c3b8621d11cd4e45e7bc5a669752d11 Mon Sep 17 00:00:00 2001 From: "http://arpitjain11.myopenid.com/" Date: Tue, 17 Feb 2009 18:53:56 -0500 Subject: --- doc/plugins/contrib/gallery.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/gallery.mdwn b/doc/plugins/contrib/gallery.mdwn index 7148de3ef..72df13bd0 100644 --- a/doc/plugins/contrib/gallery.mdwn +++ b/doc/plugins/contrib/gallery.mdwn @@ -2,7 +2,7 @@ This plugin would create a nice looking gallery of the images. It has been build over the img plugin in Ikiwiki -SVN repository of plugin is located at +GIT repo of the plugin is located at USAGE : -- cgit v1.2.3 From 3ce8a2f8b91ed468fc174da55e5161745ef0d9d1 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 17 Feb 2009 22:17:59 -0500 Subject: revert addition of several blank lines --- doc/plugins/write.mdwn | 5 ----- 1 file changed, 5 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index acf9a2cdd..2e907938f 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -90,11 +90,6 @@ function is passed no values. It's ok for the function to call This hook is called just before ikiwiki scans the wiki for changed files. It's useful for plugins that need to create or modify a source page. The - - - - - function is passed no values. ### needsbuild -- cgit v1.2.3 From 66dc253437e7ce2e3e8984513b3ecf96603d6670 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 19 Feb 2009 18:38:45 -0500 Subject: Add noextension parameter to htmlize hooks to support, eg, Makefile. --- IkiWiki.pm | 23 ++++++++++++++--------- debian/changelog | 1 + doc/plugins/write.mdwn | 7 ++++++- doc/todo/Allow_filenames_that_are_all_type.mdwn | 4 ++++ t/pagename.t | 23 ++++++++++++++++++----- t/pagetype.t | 15 --------------- 6 files changed, 43 insertions(+), 30 deletions(-) delete mode 100755 t/pagetype.t (limited to 'doc/plugins') diff --git a/IkiWiki.pm b/IkiWiki.pm index ce1ceb351..f580d1f0d 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -627,27 +627,32 @@ sub dirname ($) { return $file; } -sub pagetype ($) { +sub isinternal ($) { my $page=shift; + return exists $pagesources{$page} && + $pagesources{$page} =~ /\._([^.]+)$/; +} + +sub pagetype ($) { + my $file=shift; - if ($page =~ /\.([^.]+)$/) { + if ($file =~ /\.([^.]+)$/) { return $1 if exists $hooks{htmlize}{$1}; } + elsif ($hooks{htmlize}{basename($file)}{noextension}) { + return basename($file); + } return; } -sub isinternal ($) { - my $page=shift; - return exists $pagesources{$page} && - $pagesources{$page} =~ /\._([^.]+)$/; -} - sub pagename ($) { my $file=shift; my $type=pagetype($file); my $page=$file; - $page=~s/\Q.$type\E*$// if defined $type && !$hooks{htmlize}{$type}{keepextension}; + $page=~s/\Q.$type\E*$// + if defined $type && !$hooks{htmlize}{$type}{keepextension} + && !$hooks{htmlize}{$type}{noextension}; if ($config{indexpages} && $page=~/(.*)\/index$/) { $page=$1; } diff --git a/debian/changelog b/debian/changelog index b644ac99c..810c59f4e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,7 @@ ikiwiki (3.05) UNRELEASED; urgency=low directives, and other links on templates affect the page using the template reliably. * goto: Fix redirect to comments. + * Add noextension parameter to htmlize hooks to support, eg, Makefile. -- Joey Hess Sun, 15 Feb 2009 20:11:57 -0500 diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 2e907938f..696bc6bc3 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -189,9 +189,14 @@ The function is passed named parameters: "page" and "content" and should return the htmlized content. If `hook` is passed an optional "keepextension" parameter, set to a true -value, then this extension will not be stripped from the source filename when +value, then the extension will not be stripped from the source filename when generating the page. +If `hook` is passed an optional "noextension" parameter, set to a true +value, then the id parameter specifies not a filename extension, but +a whole filename that can be htmlized. This is useful for files +like `Makefile` that have no extension. + ### pagetemplate hook(type => "pagetemplate", id => "foo", call => \&pagetemplate); diff --git a/doc/todo/Allow_filenames_that_are_all_type.mdwn b/doc/todo/Allow_filenames_that_are_all_type.mdwn index e165da7dc..bebbcafa8 100644 --- a/doc/todo/Allow_filenames_that_are_all_type.mdwn +++ b/doc/todo/Allow_filenames_that_are_all_type.mdwn @@ -22,6 +22,10 @@ lost because it didn't have its own bug to track it. Now it does :). -- [[Will >> >> So, yeah, I think this patch is complete. :) -- [[Will]] +>>> Thanks, [[applied|done]], but I added a noextension parameter, +>>> since having keepextension allow files with no extension didn't make +>>> sense. Also, made it work for pages in subdirs.. --[[Joey]] + diff --git a/IkiWiki.pm b/IkiWiki.pm index 8d728c9..1bd46a9 100644 --- a/IkiWiki.pm diff --git a/t/pagename.t b/t/pagename.t index 488e341fa..540d10f4c 100755 --- a/t/pagename.t +++ b/t/pagename.t @@ -1,22 +1,35 @@ #!/usr/bin/perl use warnings; use strict; -use Test::More tests => 8; +use Test::More tests => 19; BEGIN { use_ok("IkiWiki"); } -# Used internally. +# define mdwn as an extension $IkiWiki::hooks{htmlize}{mdwn}={}; -$IkiWiki::hooks{htmlize}{txt}={keepextension => 1}; - +is(pagetype("foo.mdwn"), "mdwn"); is(pagename("foo.mdwn"), "foo"); +is(pagetype("foo/bar.mdwn"), "mdwn"); is(pagename("foo/bar.mdwn"), "foo/bar"); -# bare files get the full filename as page name +# bare files get the full filename as page name, undef type +is(pagetype("foo.png"), undef); is(pagename("foo.png"), "foo.png"); +is(pagetype("foo/bar.png"), undef); is(pagename("foo/bar.png"), "foo/bar.png"); +is(pagetype("foo"), undef); is(pagename("foo"), "foo"); # keepextension preserves the extension in the page name +$IkiWiki::hooks{htmlize}{txt}={keepextension => 1}; is(pagename("foo.txt"), "foo.txt"); +is(pagetype("foo.txt"), "txt"); is(pagename("foo/bar.txt"), "foo/bar.txt"); +is(pagetype("foo/bar.txt"), "txt"); + +# noextension makes extensionless files be treated as first-class pages +$IkiWiki::hooks{htmlize}{Makefile}={noextension =>1}; +is(pagetype("Makefile"), "Makefile"); +is(pagename("Makefile"), "Makefile"); +is(pagetype("foo/Makefile"), "Makefile"); +is(pagename("foo/Makefile"), "foo/Makefile"); diff --git a/t/pagetype.t b/t/pagetype.t deleted file mode 100755 index bb06a1568..000000000 --- a/t/pagetype.t +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/perl -use warnings; -use strict; -use Test::More tests => 6; - -BEGIN { use_ok("IkiWiki"); } - -# Used internally. -$IkiWiki::hooks{htmlize}{mdwn}={}; - -is(pagetype("foo.mdwn"), "mdwn"); -is(pagetype("foo/bar.mdwn"), "mdwn"); -is(pagetype("foo.png"), undef); -is(pagetype("foo/bar.png"), undef); -is(pagetype("foo"), undef); -- cgit v1.2.3 From f813b10fef13682c95ada9c9a9ccf05ff602c172 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 19 Feb 2009 18:54:25 -0500 Subject: rename tag() to tagged(); add docs --- IkiWiki/Plugin/tag.pm | 2 +- debian/changelog | 1 + doc/ikiwiki/pagespec.mdwn | 3 ++- doc/plugins/tag.mdwn | 3 +++ doc/todo/tag_pagespec_function.mdwn | 2 +- 5 files changed, 8 insertions(+), 3 deletions(-) (limited to 'doc/plugins') diff --git a/IkiWiki/Plugin/tag.pm b/IkiWiki/Plugin/tag.pm index 48c197748..8fe9c6828 100644 --- a/IkiWiki/Plugin/tag.pm +++ b/IkiWiki/Plugin/tag.pm @@ -127,7 +127,7 @@ sub pagetemplate (@) { package IkiWiki::PageSpec; -sub match_tag ($$;@) { +sub match_tagged ($$;@) { my $page = shift; my $glob = shift; return match_link($page, IkiWiki::Plugin::tag::tagpage($glob)); diff --git a/debian/changelog b/debian/changelog index 810c59f4e..80b3c5d8e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,7 @@ ikiwiki (3.05) UNRELEASED; urgency=low template reliably. * goto: Fix redirect to comments. * Add noextension parameter to htmlize hooks to support, eg, Makefile. + * Add tagged() PageSpec. -- Joey Hess Sun, 15 Feb 2009 20:11:57 -0500 diff --git a/doc/ikiwiki/pagespec.mdwn b/doc/ikiwiki/pagespec.mdwn index 86abe5745..b476bde1f 100644 --- a/doc/ikiwiki/pagespec.mdwn +++ b/doc/ikiwiki/pagespec.mdwn @@ -25,6 +25,7 @@ match all pages except for Discussion pages and the SandBox: Some more elaborate limits can be added to what matches using these functions: * "`link(page)`" - match only pages that link to a given page (or glob) +* "`tagged(tag)`" - match pages that are tagged or link to the given tag (or glob) * "`backlink(page)`" - match only pages that a given page links to * "`creation_month(month)`" - match only pages created on the given month * "`creation_day(mday)`" - or day of the month @@ -65,7 +66,7 @@ More complex expressions can also be created, by using parentheses for grouping. For example, to match pages in a blog that are tagged with either of two tags, use: - blog/* and (link(tag/foo) or link(tag/bar)) + blog/* and (tagged(foo) or tagged(bar)) Note that page names in PageSpecs are matched against the absolute filenames of the pages in the wiki, so a pagespec "foo" used on page diff --git a/doc/plugins/tag.mdwn b/doc/plugins/tag.mdwn index 17bb086a1..8ff70a069 100644 --- a/doc/plugins/tag.mdwn +++ b/doc/plugins/tag.mdwn @@ -5,6 +5,9 @@ This plugin provides the [[ikiwiki/directive/tag]] and [[ikiwiki/directive/taglink]] [[directives|ikiwiki/directive]]. These directives allow tagging pages. +It also provides the `tagged()` [[ikiwiki/PageSpec]], which can be used to +match pages that are tagged with a specific tag. + [[!if test="enabled(tag)" then=""" This wiki has the tag plugin enabled, so you'll see a note below that this page is tagged with the "tags" tag. diff --git a/doc/todo/tag_pagespec_function.mdwn b/doc/todo/tag_pagespec_function.mdwn index 060368179..681a1f661 100644 --- a/doc/todo/tag_pagespec_function.mdwn +++ b/doc/todo/tag_pagespec_function.mdwn @@ -15,7 +15,7 @@ match tagged pages independent of whatever the tagbase is set to. > > One other thing, perhaps it should be called `tagged()`? --[[Joey]] -[[!tag patch]] +[[!tag patch done]] --- a/plugins/IkiWiki/Plugin/tag.pm 2009-02-16 11:30:11.000000000 +0000 +++ b/plugins/IkiWiki/Plugin/tag.pm 2009-02-17 15:40:03.000000000 +0000 -- cgit v1.2.3 From ae8266f8bcaef4a29e29163507a9dcf14d440c8f Mon Sep 17 00:00:00 2001 From: "http://taozhyn.myopenid.com/" Date: Fri, 20 Feb 2009 05:00:42 -0500 Subject: Moved to patch to todo/auto-create --- doc/plugins/tag/discussion.mdwn | 95 +---------------------------------------- 1 file changed, 1 insertion(+), 94 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/tag/discussion.mdwn b/doc/plugins/tag/discussion.mdwn index e478ec564..1b3043014 100644 --- a/doc/plugins/tag/discussion.mdwn +++ b/doc/plugins/tag/discussion.mdwn @@ -23,99 +23,6 @@ better" --[[DavidBremner]] Please make the actual text used a template some way or another. I may want `map` instead of `inline`. --[[madduck]] ---- - -I have create a patch to tag.pm for add the option for auto create tag pages. -A new setting is used to enable or disable auto-create tag pages, `tag_autocreate`. -The new tag file is created during the preprocess phase. -The new tag file is then complied during the change phase. - - --- tag.pm 2009-02-06 10:26:03.000000000 -0700 - +++ tag_new.pm 2009-02-06 12:17:19.000000000 -0700 - @@ -14,6 +14,7 @@ - hook(type => "preprocess", id => "tag", call => \&preprocess_tag, scan => 1); - hook(type => "preprocess", id => "taglink", call => \&preprocess_taglink, scan => 1); - hook(type => "pagetemplate", id => "tag", call => \&pagetemplate); - + hook(type => "change", id => "tag", call => \&change); - } - - sub getopt () { - @@ -36,6 +37,36 @@ - safe => 1, - rebuild => 1, - }, - + tag_autocreate => { - + type => "boolean", - + example => 0, - + description => "Auto-create the new tag pages, uses autotagpage.tmpl ", - + safe => 1, - + rebulid => 1, - + }, - +} - + - +my $autocreated_page = 0; - + - +sub gen_tag_page($) { - + my $tag=shift; - + - + my $tag_file=$tag.'.'.$config{default_pageext}; - + return if (-f $config{srcdir}.$tag_file); - + - + my $template=template("autotagpage.tmpl"); - + $template->param(tag => $tag); - + writefile($tag_file, $config{srcdir}, $template->output); - + $autocreated_page = 1; - + - + if ($config{rcs}) { - + IkiWiki::disable_commit_hook(); - + IkiWiki::rcs_add($tag_file); - + IkiWiki::rcs_commit_staged( - + gettext("Automatic tag page generation"), - + undef, undef); - + IkiWiki::enable_commit_hook(); - + } - } - - sub tagpage ($) { - @@ -47,6 +78,10 @@ - $tag=~y#/#/#s; # squash dups - } - - + if (defined $config{tag_autocreate} && $config{tag_autocreate} ) { - + gen_tag_page($tag); - + } - + - return $tag; - } - - @@ -125,4 +160,18 @@ - } - } - - +sub change(@) { - + return unless($autocreated_page); - + $autocreated_page = 0; - + - + # This refresh/saveindex is to complie the autocreated tag pages - + IkiWiki::refresh(); - + IkiWiki::saveindex(); - + - + # This refresh/saveindex is to fix the Tags link - + # With out this additional refresh/saveindex the tag link displays ?tag - + IkiWiki::refresh(); - + IkiWiki::saveindex(); - +} - + - - -This uses a template called `autotagpage.tmpl`, here is my template file: - - \[[!inline pages="link()" archive="yes"]] - - -A quirk I have not figured out is during the `sub change`, see my comments in the code. -I am not sure if that is the best way to handle it. - -[[!tag patch]] +See [[/todo/auto-create]] -- Jeremy Schultz -- cgit v1.2.3 From 08615b9a5e54b6402e52b88be377e48b8bc42944 Mon Sep 17 00:00:00 2001 From: "http://taozhyn.myopenid.com/" Date: Fri, 20 Feb 2009 05:05:57 -0500 Subject: Fix wikilink to correct todo page --- doc/plugins/tag/discussion.mdwn | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/tag/discussion.mdwn b/doc/plugins/tag/discussion.mdwn index 1b3043014..b6dab5358 100644 --- a/doc/plugins/tag/discussion.mdwn +++ b/doc/plugins/tag/discussion.mdwn @@ -23,6 +23,8 @@ better" --[[DavidBremner]] Please make the actual text used a template some way or another. I may want `map` instead of `inline`. --[[madduck]] -See [[/todo/auto-create]] + +See [[todo/auto-create tag pages according to a template]] + -- Jeremy Schultz -- cgit v1.2.3 From 786a9e20efbd6e8f3a321e4fde410828904e71bd Mon Sep 17 00:00:00 2001 From: intrigeri Date: Mon, 23 Feb 2009 07:02:34 -0500 Subject: link to other todo item, personal opinions --- doc/plugins/passwordauth/discussion.mdwn | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/passwordauth/discussion.mdwn b/doc/plugins/passwordauth/discussion.mdwn index 8ae960edd..3362ae7d2 100644 --- a/doc/plugins/passwordauth/discussion.mdwn +++ b/doc/plugins/passwordauth/discussion.mdwn @@ -59,3 +59,9 @@ Any opinion/suggestion/solution to this is welcome and appreciated. -- [[NicolasLimare]] +For a similar use case, I've been intending to implement +[[todo/httpauth_feature_parity_with_passwordauth]], but your idea may +actually be the way to go. IMHO, the Perl sections idea is the +easiest to setup, but on the long run, I'd prefer ikiwiki to optionnally +use a userdb storage backend supported at least by Apache and lighttpd. +--[[intrigeri]] -- cgit v1.2.3 From 29d387d2bacfdf10cc8712af1250e5655967f1b9 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 7 Mar 2009 18:57:06 -0500 Subject: wmd stuff --- debian/changelog | 2 ++ debian/copyright | 4 ++++ doc/plugins/wmd.mdwn | 15 +++++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 doc/plugins/wmd.mdwn (limited to 'doc/plugins') diff --git a/debian/changelog b/debian/changelog index 801dc154f..d6ee6fd8a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ ikiwiki (3.07) UNRELEASED; urgency=low * Updated German translation (Kai Wasserbäch). Closes: #518377 * Updated French translation (Jean-Luc Coulon). Closes: #518510 + * wmd: New plugin contributed by William Uther to support the WMD + Wysiwym markdown editor. -- Joey Hess Thu, 05 Mar 2009 15:43:02 -0500 diff --git a/debian/copyright b/debian/copyright index f589b4a8f..67f0ac540 100644 --- a/debian/copyright +++ b/debian/copyright @@ -122,6 +122,10 @@ Files: 404.pm Copyright: © 2009 Simon McVittie License: GPL-2+ +Files: wmd.pm +Copyright: © 2009 William Uther +License: GPL-2+ + Files: doc/logo/* Copyright: © 2006 Recai Oktaş License: GPL-2+ diff --git a/doc/plugins/wmd.mdwn b/doc/plugins/wmd.mdwn new file mode 100644 index 000000000..31a508cdb --- /dev/null +++ b/doc/plugins/wmd.mdwn @@ -0,0 +1,15 @@ +[[!template id=plugin name=wmd author="[[Will]]"]] +[[!tag type/chrome]] + +[WMD](http://wmd-editor.com/) is a What You See Is What You Mean editor for +[[mdwn]]. This plugin makes WMD be used for editing pages in the wiki. + +To use the plugin, you will need to install WMD. Download the [WMD +source](http://wmd-editor.com/downloads/wmd-1.0.1.zip). In that zip file +you'll find a few example html files, a readme and `wmd` directory. Move the +`wmd` directory into the ikiwiki `underlaydir` directory (ie +`/usr/share/ikiwiki/`). You should now have a `wmd/wmd.js` file as well as +some other javascript files and an images directory in the same place. + +Note that the WMD plugin does **not** handle ikiwiki directives. For this +reason the normal `preview` button remains. -- cgit v1.2.3 From 9a82ef32b96b07278b90a1219fa555fa2a970912 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 7 Mar 2009 19:22:27 -0500 Subject: look for wmd/wmd.js This means that the underlay needs to have a wmd/wmd/wmd.js, which is a trifle weird, but it isolates all the wmd stuff in a single wmd subdirectory of the built wiki. The wmd/images creating a toplevel images directory was particularly bad. --- IkiWiki/Plugin/wmd.pm | 2 +- doc/plugins/wmd.mdwn | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'doc/plugins') diff --git a/IkiWiki/Plugin/wmd.pm b/IkiWiki/Plugin/wmd.pm index 9e9f17f7f..bdbcecc06 100644 --- a/IkiWiki/Plugin/wmd.pm +++ b/IkiWiki/Plugin/wmd.pm @@ -38,7 +38,7 @@ sub include_javascript ($;$) { my $page=shift; my $absolute=shift; - return ''."\n"; } diff --git a/doc/plugins/wmd.mdwn b/doc/plugins/wmd.mdwn index 31a508cdb..dc9a30703 100644 --- a/doc/plugins/wmd.mdwn +++ b/doc/plugins/wmd.mdwn @@ -6,10 +6,11 @@ To use the plugin, you will need to install WMD. Download the [WMD source](http://wmd-editor.com/downloads/wmd-1.0.1.zip). In that zip file -you'll find a few example html files, a readme and `wmd` directory. Move the -`wmd` directory into the ikiwiki `underlaydir` directory (ie -`/usr/share/ikiwiki/`). You should now have a `wmd/wmd.js` file as well as -some other javascript files and an images directory in the same place. +you'll find a few example html files, a readme and `wmd` directory. Create +a 'wmd' subdirectory in the ikiwiki `underlaydir` directory (ie `sudo mkdir +/usr/share/ikiwiki/wmd`). Move the `wmd` directory into the directory you +made. You should now have a `wmd/wmd/wmd.js` file as well as some other +javascript files and an images directory in the same place. Note that the WMD plugin does **not** handle ikiwiki directives. For this reason the normal `preview` button remains. -- cgit v1.2.3 From 0978be7affa6222d91a0bc71ddd1e86f81fc56cd Mon Sep 17 00:00:00 2001 From: intrigeri Date: Mon, 9 Mar 2009 00:30:19 +0100 Subject: po: fixed last unaddressed item from Joey's review, please have a look Signed-off-by: intrigeri --- doc/plugins/contrib/po.mdwn | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index 8b19afae6..c39008466 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -320,3 +320,11 @@ finish it at some point in the first quarter of 2009. --[[intrigeri]] >> --[[intrigeri]] > > --[[Joey]] + +I reverted the `%backlinks` and `$backlinks_calculated` exposing. +The issue they were solving probably will arise again when I'll work +on my meta branch again (i.e. when the simplified po one is merged), +but the po thing is supposed to work without these ugly `our`. +Seems like it was the last unaddressed item from Joey's review, so I'm +daring a timid "please pull"... or rather, please review again :) +--[[intrigeri]] -- cgit v1.2.3 From 50871cf4bd151d2d271128e70a89ebf012f80779 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Wed, 11 Mar 2009 06:26:25 -0400 Subject: apache vs. passwordauth: done a bit more research --- doc/plugins/passwordauth/discussion.mdwn | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/passwordauth/discussion.mdwn b/doc/plugins/passwordauth/discussion.mdwn index 3362ae7d2..e5ea1b922 100644 --- a/doc/plugins/passwordauth/discussion.mdwn +++ b/doc/plugins/passwordauth/discussion.mdwn @@ -65,3 +65,15 @@ actually be the way to go. IMHO, the Perl sections idea is the easiest to setup, but on the long run, I'd prefer ikiwiki to optionnally use a userdb storage backend supported at least by Apache and lighttpd. --[[intrigeri]] + +Tons of CPAN modules may help, but most of them are specific to =mod_perl=, +and AFAIK, ikiwiki is generally not run with =mod_perl=. It's not clear to me +wether these modules depend on the webapp to be run with =mod_perl= set +as the script handler, or only on =mod_perl= to be installed and loaded. + +* CPAN's =Apache::AuthenHook= allows to plug arbitrary Perl handlers as + Apache authentication providers. +* CPAN's =Apache::Authen::Program= (=mod_perl=) +* [http://www.openfusion.com.au/labs/mod_auth_tkt/](mod_auth_tkt) along with CPAN's + =Apache::AuthTkt= +--[[intrigeri]] -- cgit v1.2.3 From 12432198a68c9fb391c3ec6d284fb152f0fc3d17 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Wed, 11 Mar 2009 06:27:41 -0400 Subject: formatting --- doc/plugins/passwordauth/discussion.mdwn | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/passwordauth/discussion.mdwn b/doc/plugins/passwordauth/discussion.mdwn index e5ea1b922..672970c21 100644 --- a/doc/plugins/passwordauth/discussion.mdwn +++ b/doc/plugins/passwordauth/discussion.mdwn @@ -66,14 +66,14 @@ easiest to setup, but on the long run, I'd prefer ikiwiki to optionnally use a userdb storage backend supported at least by Apache and lighttpd. --[[intrigeri]] -Tons of CPAN modules may help, but most of them are specific to =mod_perl=, -and AFAIK, ikiwiki is generally not run with =mod_perl=. It's not clear to me -wether these modules depend on the webapp to be run with =mod_perl= set -as the script handler, or only on =mod_perl= to be installed and loaded. +Tons of CPAN modules may help, but most of them are specific to `mod_perl`, +and AFAIK, ikiwiki is generally not run with `mod_perl`. It's not clear to me +wether these modules depend on the webapp to be run with `mod_perl` set +as the script handler, or only on `mod_perl` to be installed and loaded. -* CPAN's =Apache::AuthenHook= allows to plug arbitrary Perl handlers as +* CPAN's `Apache::AuthenHook` allows to plug arbitrary Perl handlers as Apache authentication providers. -* CPAN's =Apache::Authen::Program= (=mod_perl=) +* CPAN's `Apache::Authen::Program` (`mod_perl`) * [http://www.openfusion.com.au/labs/mod_auth_tkt/](mod_auth_tkt) along with CPAN's - =Apache::AuthTkt= + `Apache::AuthTkt` --[[intrigeri]] -- cgit v1.2.3 From 2852cf14a2b2b6610ea1d4c64f3bb9741b494ae1 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 27 Mar 2009 15:51:13 -0400 Subject: review --- doc/plugins/contrib/po.mdwn | 11 +++++++++++ doc/todo/need_global_renamepage_hook.mdwn | 4 ++++ 2 files changed, 15 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index c39008466..a5e3375ce 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -328,3 +328,14 @@ but the po thing is supposed to work without these ugly `our`. Seems like it was the last unaddressed item from Joey's review, so I'm daring a timid "please pull"... or rather, please review again :) --[[intrigeri]] + +> Ok, I've reviewed and merged into my own po branch. It's looking very +> mergeable. I would still like to go over the `po.pm` code in detail and +> review it, but it's very complex, and I'm happy with all the changes +> outside `po.pm`. +> +> * Is it worth trying to fix compatability with `indexpages`? +> * Would it make sense to go ahead and modify `page.tmpl` to use +> OTHERLANGUAGES and PERCENTTRANSLATED, instead of documenting how to modify it? +> +> --[[Joey]] diff --git a/doc/todo/need_global_renamepage_hook.mdwn b/doc/todo/need_global_renamepage_hook.mdwn index 69655f2e9..b065c82f3 100644 --- a/doc/todo/need_global_renamepage_hook.mdwn +++ b/doc/todo/need_global_renamepage_hook.mdwn @@ -107,3 +107,7 @@ hashes is desired, it could return the full set of hashes. >>> I've implemented this nice solution in my po branch, please review. >>> I'm slowly coming back to do the last bits needed to get my po and >>> meta branch merged. --[[intrigeri]] + +>>>> It looks good. I made some small changes to it in my own po branch. +>>>> Nothing significant really. If this were not tied up in the po branch, +>>>> I've have merged it to master already. --[[Joey]] -- cgit v1.2.3 From 44688008ef69d2093a580679494c6e70eaf93d37 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 27 Mar 2009 17:40:58 -0400 Subject: another question --- doc/plugins/contrib/po.mdwn | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index a5e3375ce..3f128c9f8 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -337,5 +337,7 @@ daring a timid "please pull"... or rather, please review again :) > * Is it worth trying to fix compatability with `indexpages`? > * Would it make sense to go ahead and modify `page.tmpl` to use > OTHERLANGUAGES and PERCENTTRANSLATED, instead of documenting how to modify it? +> * Would it be better to disable po support for pages that use unsupported +> or poorly-supported markup languages? > > --[[Joey]] -- cgit v1.2.3 From 19f3093c49450dea465e554d989dfeca66afa257 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sat, 28 Mar 2009 11:04:36 +0100 Subject: po: answering Joey --- doc/plugins/contrib/po.mdwn | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index 3f128c9f8..c42cf3481 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -335,9 +335,28 @@ daring a timid "please pull"... or rather, please review again :) > outside `po.pm`. > > * Is it worth trying to fix compatability with `indexpages`? +>> +>> Supporting `usedirs` being enabled or disabled was already quite +>> hard IIRC, so supporting all four combinations of `usedirs` and +>> `indexpages` settings will probably be painful. I propose we forget +>> about it until someone reports he/she badly needs it, and then +>> we'll see what can be done. +>> > * Would it make sense to go ahead and modify `page.tmpl` to use > OTHERLANGUAGES and PERCENTTRANSLATED, instead of documenting how to modify it? +>> +>> Sure, I'll do this today. +>> > * Would it be better to disable po support for pages that use unsupported > or poorly-supported markup languages? > +>> I prefer keeping it enabled, as: +>> * most wiki markups "almost work" +>> * when someone needs one of these to be fully supported, it's not +>> that hard to add dedicated support for it to po4a; if it were +>> disabled, I fear the ones who could do this would maybe think +>> it's blandly impossible and give up. +>> > --[[Joey]] +>> +>> --[[intrigeri]] -- cgit v1.2.3 From 00a9b8c176b1c9475fbd9848dea3037c7b287275 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sat, 28 Mar 2009 06:43:31 -0400 Subject: po follow-up --- doc/plugins/contrib/po.mdwn | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index c42cf3481..5f0de3b5e 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -345,12 +345,13 @@ daring a timid "please pull"... or rather, please review again :) > * Would it make sense to go ahead and modify `page.tmpl` to use > OTHERLANGUAGES and PERCENTTRANSLATED, instead of documenting how to modify it? >> ->> Sure, I'll do this today. +>> Done in my branch. >> > * Would it be better to disable po support for pages that use unsupported > or poorly-supported markup languages? > >> I prefer keeping it enabled, as: +>> >> * most wiki markups "almost work" >> * when someone needs one of these to be fully supported, it's not >> that hard to add dedicated support for it to po4a; if it were -- cgit v1.2.3 From b1551ed0e297e75492e578bf2445fcde99dad86a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 29 Mar 2009 14:54:08 -0400 Subject: review --- doc/plugins/contrib/po.mdwn | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index 3f128c9f8..3f5a65c05 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -332,12 +332,44 @@ daring a timid "please pull"... or rather, please review again :) > Ok, I've reviewed and merged into my own po branch. It's looking very > mergeable. I would still like to go over the `po.pm` code in detail and > review it, but it's very complex, and I'm happy with all the changes -> outside `po.pm`. +> outside `po.pm`. (Reviewed the first 520 lines, up to injected +> functions.) > > * Is it worth trying to fix compatability with `indexpages`? +>> +>> Supporting `usedirs` being enabled or disabled was already quite +>> hard IIRC, so supporting all four combinations of `usedirs` and +>> `indexpages` settings will probably be painful. I propose we forget +>> about it until someone reports he/she badly needs it, and then +>> we'll see what can be done. +>> > * Would it make sense to go ahead and modify `page.tmpl` to use > OTHERLANGUAGES and PERCENTTRANSLATED, instead of documenting how to modify it? +>> +>> Done in my branch. +>> > * Would it be better to disable po support for pages that use unsupported > or poorly-supported markup languages? > +>> I prefer keeping it enabled, as: +>> +>> * most wiki markups "almost work" +>> * when someone needs one of these to be fully supported, it's not +>> that hard to add dedicated support for it to po4a; if it were +>> disabled, I fear the ones who could do this would maybe think +>> it's blandly impossible and give up. +>> +> +> * What's the reasoning behind checking that the link plugin +> is enabled? AFAICS, the same code in the scan hook should +> also work when other link plugins like camelcase are used. +> * In `pagetemplate` there is a comment that claims the code +> relies on `genpage`, but I don't see how it does; it seems +> to always add a discussion link? +> * Is there any real reason not to allow removing a translation? +> I'm imagining a spammy translation, which an admin might not +> be able to fix, but could remove. +> > --[[Joey]] +>> +>> --[[intrigeri]] -- cgit v1.2.3 From b94b0b564d90b357d2cb1ba5a5d364f8802fed3b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 29 Mar 2009 15:25:14 -0400 Subject: another issue --- doc/plugins/contrib/po.mdwn | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index 618e16598..fba8de282 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -369,6 +369,17 @@ daring a timid "please pull"... or rather, please review again :) > * Is there any real reason not to allow removing a translation? > I'm imagining a spammy translation, which an admin might not > be able to fix, but could remove. +> * Re the meta title escaping issue worked around by `change`. +> I suppose this does not only affect meta, but other things +> at scan time too. Also, handling it only on rebuild feels +> suspicious -- a refresh could involve changes to multiple +> pages and trigger the same problem, I think. Also, exposing +> this rebuild to the user seems really ugly, not confidence inducing. +> +> So I wonder if there's a better way. Such as making po, at scan time, +> re-run the scan hooks, passing them modified content (either converted +> from po to mdwn or with the escaped stuff cheaply de-escaped). (Of +> course the scan hook would need to avoid calling itself!) > > --[[Joey]] >> -- cgit v1.2.3 From 843b9c579c885a7ea2c1830c53cd296bce25820f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 29 Mar 2009 15:37:26 -0400 Subject: comment --- doc/plugins/contrib/po.mdwn | 3 +++ 1 file changed, 3 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index fba8de282..8d1fe4c3e 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -380,6 +380,9 @@ daring a timid "please pull"... or rather, please review again :) > re-run the scan hooks, passing them modified content (either converted > from po to mdwn or with the escaped stuff cheaply de-escaped). (Of > course the scan hook would need to avoid calling itself!) +> +> (This doesn't need to block the merge, but I hope it can be addressed +> eventually..) > > --[[Joey]] >> -- cgit v1.2.3 From 06dc69946fc87ec750693636b94990edd8c899ff Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 29 Mar 2009 15:56:56 -0400 Subject: done reviewing po.pm (Still a few bits I haven't bothered fully comprehending in detail.) --- doc/plugins/contrib/po.mdwn | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/po.mdwn b/doc/plugins/contrib/po.mdwn index 8d1fe4c3e..61ec53ea8 100644 --- a/doc/plugins/contrib/po.mdwn +++ b/doc/plugins/contrib/po.mdwn @@ -330,10 +330,7 @@ daring a timid "please pull"... or rather, please review again :) --[[intrigeri]] > Ok, I've reviewed and merged into my own po branch. It's looking very -> mergeable. I would still like to go over the `po.pm` code in detail and -> review it, but it's very complex, and I'm happy with all the changes -> outside `po.pm`. (Reviewed the first 520 lines, up to injected -> functions.) +> mergeable. > > * Is it worth trying to fix compatability with `indexpages`? >> -- cgit v1.2.3 From 7bbe9cf94d75b52fe979d87e4e3951514dbd1b76 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 30 Mar 2009 13:07:50 -0400 Subject: Fix documentation of anonok_pagespec. Closes: #521793 --- debian/changelog | 1 + doc/plugins/anonok.mdwn | 4 ++-- doc/plugins/comments/discussion.mdwn | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'doc/plugins') diff --git a/debian/changelog b/debian/changelog index 158db9a4d..581a3bf33 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,6 +10,7 @@ ikiwiki (3.09) UNRELEASED; urgency=low * comments: Fix too loose test for comments pages that matched normal pages with "comment_" in their name. Closes: #521322 * comments: Fix anchor ids to be legal xhtml. Closes: #521339 + * Fix documentation of anonok_pagespec. Closes: #521793 -- Joey Hess Thu, 19 Mar 2009 15:32:49 -0400 diff --git a/doc/plugins/anonok.mdwn b/doc/plugins/anonok.mdwn index ab2f744e2..a3fec4d89 100644 --- a/doc/plugins/anonok.mdwn +++ b/doc/plugins/anonok.mdwn @@ -5,10 +5,10 @@ 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_pages`. This +The plugin also has a configuration setting, `anonok_pagespec`. This [[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: - anonok_pages => "postcomment(*)" + anonok_pagespec => "postcomment(*)" diff --git a/doc/plugins/comments/discussion.mdwn b/doc/plugins/comments/discussion.mdwn index 2a87a3d93..3d7452b9a 100644 --- a/doc/plugins/comments/discussion.mdwn +++ b/doc/plugins/comments/discussion.mdwn @@ -60,7 +60,7 @@ spam problems. So, use `check_canedit` as at least a first-level check? > have postcomment(blog/*) or something. (Perhaps instead of taking a glob, postcomment > should take a pagespec, so you can have postcomment(link(tags/commentable))?) > -> This is why `anonok_pages => 'postcomment(*)'` and `locked_pages => '!postcomment(*)'` +> This is why `anonok_pagespec => 'postcomment(*)'` and `locked_pages => '!postcomment(*)'` > are necessary to allow anonymous and logged-in editing (respectively). > >> I changed that to move the flag out of the page name, and into a variable that the `match_postcomment` -- cgit v1.2.3