From 91fde37f13a89b4593e128852c2f8927b478d881 Mon Sep 17 00:00:00 2001 From: "http://kerravonsen.dreamwidth.org/" Date: Thu, 1 Jul 2010 00:30:58 +0000 Subject: response to Microdata question --- doc/plugins/contrib/field/discussion.mdwn | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/contrib/field/discussion.mdwn b/doc/plugins/contrib/field/discussion.mdwn index 5f4c9b942..191f8b27d 100644 --- a/doc/plugins/contrib/field/discussion.mdwn +++ b/doc/plugins/contrib/field/discussion.mdwn @@ -325,4 +325,8 @@ smcv's discuission of field author vs meta author above. --[[Joey]] >>> --[[KathrynAndersen]] +----- + I was just looking at HTML5 and wondered if the field plugin should generate the new Microdata tags (as well as the internal structures)? -- [[Will]] + +> This could just as easily be done as a separate plugin. Feel free to do so. --[[KathrynAndersen]] -- cgit v1.2.3 From 824ad84e2b490e3aa9107e3a3d244bd8e041d918 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 1 Jul 2010 15:52:03 -0400 Subject: add note about genwrapper code running before wrapper sanitizes environment (That is needed for the receive test code.) --- doc/plugins/write.mdwn | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index a921b9a02..bb8012342 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -595,7 +595,10 @@ describes the plugin as a whole. For example: hook(type => "genwrapper", id => "foo", call => \&genwrapper); This hook is used to inject C code (which it returns) into the `main` -function of the ikiwiki wrapper when it is being generated. +function of the ikiwiki wrapper when it is being generated. + +The code runs before anything else -- in particular it runs before +the suid wrapper has sanitized its environment. ## Exported variables -- cgit v1.2.3 From 1b14a849fff50888e6a48d7299c23c7d5821572a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 4 Jul 2010 14:27:57 -0400 Subject: example --- doc/plugins/po.mdwn | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/po.mdwn b/doc/plugins/po.mdwn index dd85edf3d..2e16cc7c4 100644 --- a/doc/plugins/po.mdwn +++ b/doc/plugins/po.mdwn @@ -296,6 +296,12 @@ underlay, and the underlays lack translation to a given language. > Any simple testcase to reproduce it, please? I've never seen this > happen yet. --[[intrigeri]] +>> Sure, go here +>> (Currently 0% translateed) and see the 'WikiLink' link at the bottom, +>> which goes to +>> Compare with eg, the 100% translated Dansk version, where +>> the WikiLink link links to the English WikiLink page. --[[Joey]] + Double commits of po files -------------------------- -- cgit v1.2.3 From 8fe277c2ab42393b754fc65d966bf4ec242719ab Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sat, 26 Jun 2010 00:59:20 +0200 Subject: typo fix. (cherry picked from commit 924f559e5049a63488a5f2baca610299a7e02957) --- doc/plugins/po.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/plugins') diff --git a/doc/plugins/po.mdwn b/doc/plugins/po.mdwn index 2e16cc7c4..646d0cef3 100644 --- a/doc/plugins/po.mdwn +++ b/doc/plugins/po.mdwn @@ -130,7 +130,7 @@ lighttpd -------- Recent versions of lighttpd should be able to use -`$HTTP["language"]` to configure the translatted pages to be served. +`$HTTP["language"]` to configure the translated pages to be served. See [Lighttpd Issue](http://redmine.lighttpd.net/issues/show/1119) -- cgit v1.2.3 From cd03bd0b804cf4919a5d195c53bcea1f9730a51f Mon Sep 17 00:00:00 2001 From: intrigeri Date: Fri, 25 Jun 2010 23:18:34 +0200 Subject: po: added support for html pagetype ... after having audited the po4a Xml and Xhtml modules for security issues. Signed-off-by: intrigeri (cherry picked from commit a128c256a51392fcf752bf612d83a90e8c68027e) --- IkiWiki/Plugin/po.pm | 47 +++++++++++++++++++++++++++++++++--------- doc/plugins/po.mdwn | 10 ++++----- doc/plugins/po/discussion.mdwn | 17 +++++++++++++++ 3 files changed, 59 insertions(+), 15 deletions(-) (limited to 'doc/plugins') diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm index e85c9d760..4e6eff94f 100644 --- a/IkiWiki/Plugin/po.pm +++ b/IkiWiki/Plugin/po.pm @@ -848,8 +848,8 @@ sub refreshpot ($) { my $masterfile=shift; my $potfile=potfile($masterfile); - my %options = ("markdown" => (pagetype($masterfile) eq 'mdwn') ? 1 : 0); - my $doc=Locale::Po4a::Chooser::new('text',%options); + my $doc=Locale::Po4a::Chooser::new(po4a_type($masterfile), + po4a_options($masterfile)); $doc->{TT}{utf_mode} = 1; $doc->{TT}{file_in_charset} = 'UTF-8'; $doc->{TT}{file_out_charset} = 'UTF-8'; @@ -940,10 +940,8 @@ sub percenttranslated ($) { return gettext("N/A") unless istranslation($page); my $file=srcfile($pagesources{$page}); my $masterfile = srcfile($pagesources{masterpage($page)}); - my %options = ( - "markdown" => (pagetype($masterfile) eq 'mdwn') ? 1 : 0, - ); - my $doc=Locale::Po4a::Chooser::new('text',%options); + my $doc=Locale::Po4a::Chooser::new(po4a_type($masterfile), + po4a_options($masterfile)); $doc->process( 'po_in_name' => [ $file ], 'file_in_name' => [ $masterfile ], @@ -1094,10 +1092,8 @@ sub po_to_markup ($$) { or return $fail->(sprintf(gettext("failed to write %s"), $infile)); my $masterfile = srcfile($pagesources{masterpage($page)}); - my %options = ( - "markdown" => (pagetype($masterfile) eq 'mdwn') ? 1 : 0, - ); - my $doc=Locale::Po4a::Chooser::new('text',%options); + my $doc=Locale::Po4a::Chooser::new(po4a_type($masterfile), + po4a_options($masterfile)); $doc->process( 'po_in_name' => [ $infile ], 'file_in_name' => [ $masterfile ], @@ -1160,6 +1156,37 @@ sub isvalidpo ($) { "to previous page to continue edit")); } +sub po4a_type ($) { + my $file = shift; + + my $pagetype = pagetype($file); + if ($pagetype eq 'html') { + return 'xhtml'; + } + return 'text'; +} + +sub po4a_options($) { + my $file = shift; + + my %options; + my $pagetype = pagetype($file); + + if ($pagetype eq 'html') { + # how to disable options is not consistent across po4a modules + $options{includessi} = ''; + $options{includeexternal} = 0; + } + elsif ($pagetype eq 'mdwn') { + $options{markdown} = 1; + } + else { + $options{markdown} = 0; + } + + return %options; +} + # ,---- # | PageSpecs # `---- diff --git a/doc/plugins/po.mdwn b/doc/plugins/po.mdwn index 646d0cef3..fab6053b3 100644 --- a/doc/plugins/po.mdwn +++ b/doc/plugins/po.mdwn @@ -213,16 +213,16 @@ preferred `$EDITOR`, without needing to be online. Markup languages support ------------------------ -[[Markdown|mdwn]] is well supported. Some other markup languages supported -by ikiwiki mostly work, but some pieces of syntax are not rendered -correctly on the slave pages: +[[Markdown|mdwn]] and [[html]] are well supported. Some other markup +languages supported by ikiwiki mostly work, but some pieces of syntax +are not rendered correctly on the slave pages: * [[reStructuredText|rst]]: anonymous hyperlinks and internal cross-references * [[wikitext]]: conversion of newlines to paragraphs * [[creole]]: verbatim text is wrapped, tables are broken -* [[html]] and LaTeX: not supported yet; the dedicated po4a modules - could be used to support them, but they would need a security audit +* LaTeX: not supported yet; the dedicated po4a module + could be used to support it, but it would need a security audit * other markup languages have not been tested. Security diff --git a/doc/plugins/po/discussion.mdwn b/doc/plugins/po/discussion.mdwn index 27683f1ea..73858c818 100644 --- a/doc/plugins/po/discussion.mdwn +++ b/doc/plugins/po/discussion.mdwn @@ -150,6 +150,23 @@ The following analysis was done with his help. variables; according to [[Joey]], this is "Freaky code, but seems ok due to use of `quotementa`". +##### Locale::Po4a::Xhtml + +* does not run any external program +* does not build regexp's from untrusted variables + +=> Seems safe as far as the `includessi` option is disabled; the po +plugin explicitly disables it. + +Relies on Locale::Po4a::Xml` to do most of the work. + +##### Locale::Po4a::Xml + +* does not run any external program +* the `includeexternal` option makes it able to read external files; + the po plugin explicitly disables it +* untrusted variables are escaped when used to build regexp's + ##### Text::WrapI18N `Text::WrapI18N` can cause DoS -- cgit v1.2.3 From 472d3fba7db7184fee3c4122d8f628cd6436c6bc Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 4 Jul 2010 16:08:54 -0400 Subject: comment --- doc/plugins/po.mdwn | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/po.mdwn b/doc/plugins/po.mdwn index fab6053b3..fe4d75748 100644 --- a/doc/plugins/po.mdwn +++ b/doc/plugins/po.mdwn @@ -266,6 +266,14 @@ to an array to support this. (If twere done, twere best done quickly.) > Done in my po branch, preserving backward compatibility. Please > review :) --[[intrigeri]] +>> Right, well my immediate concern is that using an array to hold +>> hash-like pairs is not very clear to the user. It will be displayed +>> in a confusing way by websetup; dumping a setup file will probably +>> also cause it to be formatted in a confusing way. And the code +>> seems to assume that the array length is even, and probably blows +>> up if it is not.. and the value is marked safe so websetup can be +>> used to modify it and break that way too. --[[Joey]] + Pagespecs --------- -- cgit v1.2.3 From 2dd0c177a6b33488dfcfff9041a3749b44484f34 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 6 Jul 2010 13:57:17 -0400 Subject: aggregate: Write timestamp next aggregation can happen to .ikiwiki/aggregatetime, to allow for more sophisticated cron jobs. --- IkiWiki/Plugin/aggregate.pm | 18 ++++++++++++++++-- debian/changelog | 2 ++ doc/plugins/aggregate.mdwn | 15 ++++++++++++--- 3 files changed, 30 insertions(+), 5 deletions(-) (limited to 'doc/plugins') diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index 5a9eb433d..7789c4c2a 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -298,7 +298,7 @@ sub loadstate () { return if $state_loaded; $state_loaded=1; if (-e "$config{wikistatedir}/aggregate") { - open(IN, "$config{wikistatedir}/aggregate") || + open(IN, "<", "$config{wikistatedir}/aggregate") || die "$config{wikistatedir}/aggregate: $!"; while () { $_=IkiWiki::possibly_foolish_untaint($_); @@ -335,7 +335,7 @@ sub savestate () { garbage_collect(); my $newfile="$config{wikistatedir}/aggregate.new"; my $cleanup = sub { unlink($newfile) }; - open (OUT, ">$newfile") || error("open $newfile: $!", $cleanup); + open (OUT, ">", $newfile) || error("open $newfile: $!", $cleanup); foreach my $data (values %feeds, values %guids) { my @line; foreach my $field (keys %$data) { @@ -356,6 +356,20 @@ sub savestate () { close OUT || error("save $newfile: $!", $cleanup); rename($newfile, "$config{wikistatedir}/aggregate") || error("rename $newfile: $!", $cleanup); + + my $timestamp=undef; + foreach my $feed (keys %feeds) { + my $t=$feeds{$feed}->{lastupdate}+$feeds{$feed}->{updateinterval}; + if (! defined $timestamp || $timestamp > $t) { + $timestamp=$t; + } + } + $newfile=~s/\.new$/time/; + open (OUT, ">", $newfile) || error("open $newfile: $!", $cleanup); + if (defined $timestamp) { + print OUT $timestamp."\n"; + } + close OUT || error("save $newfile: $!", $cleanup); } sub garbage_collect () { diff --git a/debian/changelog b/debian/changelog index 18db7c0c2..9d88b5c9c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,8 @@ ikiwiki (3.20100705) UNRELEASED; urgency=low * img: Add a margin around images displayed by this directive. * comments: Added commentmoderation directive for easy linking to the comment moderation queue. + * aggregate: Write timestamp next aggregation can happen to + .ikiwiki/aggregatetime, to allow for more sophisticated cron jobs. -- Joey Hess Mon, 05 Jul 2010 13:59:42 -0400 diff --git a/doc/plugins/aggregate.mdwn b/doc/plugins/aggregate.mdwn index bb828b05c..2925b6fba 100644 --- a/doc/plugins/aggregate.mdwn +++ b/doc/plugins/aggregate.mdwn @@ -5,9 +5,13 @@ 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]]. -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. +## requirements + +The [[meta]] and [[tag]] plugins are also recommended to be used with this +one. Either the [[htmltidy]] or [[htmlbalance]] plugin is suggested, since +feeds can easily contain html problems, some of which these plugins can fix. + +## triggering aggregation 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 @@ -15,6 +19,11 @@ crontab entry: */15 * * * * ikiwiki --setup my.wiki --aggregate --refresh +The plugin updates a file `.ikiwiki/aggregatetime` with the unix time stamp +when the next aggregation run could occur. (The file may be empty, if no +aggregation is required.) This can be integrated into more complex cron +jobs or systems to trigger aggregation only when needed. + Alternatively, you can allow `ikiwiki.cgi` to trigger the aggregation. You should only need this if for some reason you cannot use cron, and instead want to use a service such as [WebCron](http://webcron.org). To enable -- cgit v1.2.3 From 4e9d62a2d75c79f3450781037e24b549dbd3eda6 Mon Sep 17 00:00:00 2001 From: "http://jeremiahfoster.com/" Date: Thu, 8 Jul 2010 16:09:32 +0000 Subject: --- doc/plugins/goodstuff/discussion.mdwn | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/plugins/goodstuff/discussion.mdwn (limited to 'doc/plugins') diff --git a/doc/plugins/goodstuff/discussion.mdwn b/doc/plugins/goodstuff/discussion.mdwn new file mode 100644 index 000000000..0ad95c00a --- /dev/null +++ b/doc/plugins/goodstuff/discussion.mdwn @@ -0,0 +1 @@ +What is the syntax for enabling plugins in the setup file? -- cgit v1.2.3 From 99f4056b989acfacf3590dbaec9a505a31420f88 Mon Sep 17 00:00:00 2001 From: "http://weakish.myopenid.com/" Date: Fri, 9 Jul 2010 11:44:59 +0000 Subject: minor markup syntax --- doc/plugins/rst/discussion.mdwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/rst/discussion.mdwn b/doc/plugins/rst/discussion.mdwn index 38fbed6d6..3c3b03275 100644 --- a/doc/plugins/rst/discussion.mdwn +++ b/doc/plugins/rst/discussion.mdwn @@ -61,8 +61,8 @@ but the backlinks don't show up. I converted one of my pages to rst: -Before: http://kaizer.se/wiki/kupfer-mdwn -After: http://kaizer.se/wiki/kupfer-rst +Before: +After: I need help on a couple of points -- cgit v1.2.3 From 293e12bc0e5347d815da559142bf64dcb60cd7ab Mon Sep 17 00:00:00 2001 From: "http://weakish.myopenid.com/" Date: Sat, 10 Jul 2010 09:20:36 +0000 Subject: link to repolist plugin --- doc/plugins/getsource/discussion.mdwn | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/plugins') diff --git a/doc/plugins/getsource/discussion.mdwn b/doc/plugins/getsource/discussion.mdwn index 45a1d62b5..3e985948b 100644 --- a/doc/plugins/getsource/discussion.mdwn +++ b/doc/plugins/getsource/discussion.mdwn @@ -1 +1,3 @@ It would be very cool if this plugin was enabled by default. One of the best ways to learn how to do various advanced things is to be able to "view source" on other wiki's which do things you like. -- [[AdamShand]] + +This plugin requires the cgi plugin. If you run a static site, you may check the [[repolist]] plugin. -- [[weakish]] -- cgit v1.2.3