* external: Add getargv and setargv methods to allow access to ikiwiki's
@ARGV.master
parent
5a7a89ffc5
commit
ba480baa9e
|
@ -153,6 +153,18 @@ sub setstate ($$$$;@) { #{{{
|
||||||
return $IkiWiki::pagestate{$page}{$id}{$key}=@_;
|
return $IkiWiki::pagestate{$page}{$id}{$key}=@_;
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
||||||
|
sub getargv ($) { #{{{
|
||||||
|
my $plugin=shift;
|
||||||
|
|
||||||
|
return @ARGV;
|
||||||
|
} #}}}
|
||||||
|
|
||||||
|
sub setargv ($@) { #{{{
|
||||||
|
my $plugin=shift;
|
||||||
|
|
||||||
|
@ARGV=@_;
|
||||||
|
} #}}}
|
||||||
|
|
||||||
sub inject ($@) { #{{{
|
sub inject ($@) { #{{{
|
||||||
# Bind a given perl function name to a particular RPC request.
|
# Bind a given perl function name to a particular RPC request.
|
||||||
my $plugin=shift;
|
my $plugin=shift;
|
||||||
|
|
|
@ -42,6 +42,8 @@ ikiwiki (2.41) UNRELEASED; urgency=low
|
||||||
* French translation update. Closes: #471010
|
* French translation update. Closes: #471010
|
||||||
* external: Fix support of XML::RPC::fault.
|
* external: Fix support of XML::RPC::fault.
|
||||||
* htmltidy: Pass --markup yes, in case tidy's config file disabled it.
|
* htmltidy: Pass --markup yes, in case tidy's config file disabled it.
|
||||||
|
* external: Add getargv and setargv methods to allow access to ikiwiki's
|
||||||
|
@ARGV.
|
||||||
|
|
||||||
-- martin f. krafft <madduck@debian.org> Sun, 02 Mar 2008 17:46:38 +0100
|
-- martin f. krafft <madduck@debian.org> Sun, 02 Mar 2008 17:46:38 +0100
|
||||||
|
|
||||||
|
|
|
@ -1 +1,14 @@
|
||||||
The `getopt` hook expects plugins to modify `@ARGV`. This is not exported via xml-rpc and thus external plugins cannot do anything. --[[madduck]]
|
The `getopt` hook expects plugins to modify `@ARGV`. This is not exported via xml-rpc and thus external plugins cannot do anything. --[[madduck]]
|
||||||
|
|
||||||
|
> I can think of two interfaces to handle this.
|
||||||
|
>
|
||||||
|
> 1. Pass @ARGV to the hook, and remove any values the hook returns from @ARGV.
|
||||||
|
> 2. Provide an XML-RPC interface for setting and getting ikiwiki's @ARGV.
|
||||||
|
>
|
||||||
|
> The first is simpler, but requires keeping track of which options to
|
||||||
|
> remove, which could be a pain, and probably precludes using regular
|
||||||
|
> getopt libraries to process options. It also could theoretically cause
|
||||||
|
> problems for existing perl getopt hooks.
|
||||||
|
>
|
||||||
|
> The second should allow using regular getopt libraries, but does bloat
|
||||||
|
> the RPC interface. Oh well, guess that's ok. [[done]] --[[Joey]]
|
||||||
|
|
|
@ -53,6 +53,9 @@ it, external plugins can use the `getstate` and `setstate` RPCs. To access
|
||||||
stored state, call `getstate("page", "id", "key")`, and to store state,
|
stored state, call `getstate("page", "id", "key")`, and to store state,
|
||||||
call `setstate("page", "id", "key", "value")`.
|
call `setstate("page", "id", "key", "value")`.
|
||||||
|
|
||||||
|
To access ikiwiki's ARGV, call `getargv()`. To change its ARGV, call
|
||||||
|
`setargv(value)`.
|
||||||
|
|
||||||
## Notes on function parameters
|
## Notes on function parameters
|
||||||
|
|
||||||
The [[plugin_interface_documentation|write]] talks about functions that take
|
The [[plugin_interface_documentation|write]] talks about functions that take
|
||||||
|
@ -99,9 +102,6 @@ with functions that take or return such references. That means you can't
|
||||||
FormBuilder perl objects), or use it to call `template()` (which returns a
|
FormBuilder perl objects), or use it to call `template()` (which returns a
|
||||||
perl HTML::Template object).
|
perl HTML::Template object).
|
||||||
|
|
||||||
Also. the `getopt` hook doesn't work, as ARGV is not available to the external
|
|
||||||
plugin.
|
|
||||||
|
|
||||||
## Performance issues
|
## Performance issues
|
||||||
|
|
||||||
Since each external plugin is a separate process, when ikiwiki is
|
Since each external plugin is a separate process, when ikiwiki is
|
||||||
|
|
Loading…
Reference in New Issue