Photos
Blog
Projects
vanrenterghem.biz
projects
/
git.ikiwiki.info.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' into debian-jessie-backports
[git.ikiwiki.info.git]
/
IkiWiki
/
Plugin
/
external.pm
diff --git
a/IkiWiki/Plugin/external.pm
b/IkiWiki/Plugin/external.pm
index 2d540143f6471fa46ffd61f4563138ead5ee0b9f..a4cc1dd3ce32bade13d9477efcba68fdc4a50e1a 100644
(file)
--- a/
IkiWiki/Plugin/external.pm
+++ b/
IkiWiki/Plugin/external.pm
@@
-6,9
+6,8
@@
package IkiWiki::Plugin::external;
use warnings;
use strict;
use warnings;
use strict;
-use IkiWiki
2
.00;
+use IkiWiki
3
.00;
use RPC::XML;
use RPC::XML;
-use RPC::XML::Parser;
use IPC::Open2;
use IO::Handle;
use IPC::Open2;
use IO::Handle;
@@
-29,7
+28,9
@@
sub import {
$plugins{$plugin}={in => $plugin_read, out => $plugin_write, pid => $pid,
accum => ""};
$plugins{$plugin}={in => $plugin_read, out => $plugin_write, pid => $pid,
accum => ""};
+
$RPC::XML::ENCODING="utf-8";
$RPC::XML::ENCODING="utf-8";
+ $RPC::XML::FORCE_STRING_ENCODING="true";
rpc_call($plugins{$plugin}, "import");
}
rpc_call($plugins{$plugin}, "import");
}
@@
-55,7
+56,19
@@
sub rpc_call ($$;@) {
$plugin->{accum}.=$_;
while ($plugin->{accum} =~ /^\s*(<\?xml\s.*?<\/(?:methodCall|methodResponse)>)\n(.*)/s) {
$plugin->{accum}=$2;
$plugin->{accum}.=$_;
while ($plugin->{accum} =~ /^\s*(<\?xml\s.*?<\/(?:methodCall|methodResponse)>)\n(.*)/s) {
$plugin->{accum}=$2;
- my $r = RPC::XML::Parser->new->parse($1);
+ my $parser;
+ eval q{
+ use RPC::XML::ParserFactory;
+ $parser = RPC::XML::ParserFactory->new;
+ };
+ if ($@) {
+ # old interface
+ eval q{
+ use RPC::XML::Parser;
+ $parser = RPC::XML::Parser->new;
+ };
+ }
+ my $r=$parser->parse($1);
error("XML RPC parser failure: $r") unless ref $r;
if ($r->isa('RPC::XML::response')) {
my $value=$r->value;
error("XML RPC parser failure: $r") unless ref $r;
if ($r->isa('RPC::XML::response')) {
my $value=$r->value;
@@
-72,9
+85,9
@@
sub rpc_call ($$;@) {
# XML-RPC v1 does not allow for
# nil/null/None/undef values to be
# XML-RPC v1 does not allow for
# nil/null/None/undef values to be
- # transmitted
, so until
- #
XML::RPC::Parser honours v2
- #
(<nil/>),
external plugins send
+ # transmitted
. The <nil/> extension
+ #
is the right fix, but for
+ #
back-compat, let
external plugins send
# a hash with one key "null" pointing
# to an empty string.
if (exists $hash{null} &&
# a hash with one key "null" pointing
# to an empty string.
if (exists $hash{null} &&
@@
-230,10
+243,13
@@
sub hook ($@) {
}
sub pagespec_match ($@) {
}
sub pagespec_match ($@) {
- # convert
pagespec_match's
return object into a XML RPC boolean
+ # convert return object into a XML RPC boolean
my $plugin=shift;
my $plugin=shift;
+ my $page=shift;
+ my $spec=shift;
- return RPC::XML::boolean->new(0 + IkiWiki::pagespec_march(@_));
+ return RPC::XML::boolean->new(0 + IkiWiki::pagespec_match(
+ $page, $spec, @_));
}
1
}
1