[wellwell-devel] [SCM] Interchange wellwell catalog branch, master, updated. 32f341029e4e5bfd83a3f4b9bd17d28c646a6070
Stefan Hornburg
racke at rt.icdevgroup.org
Thu Feb 11 18:51:58 UTC 2010
via 32f341029e4e5bfd83a3f4b9bd17d28c646a6070 (commit)
from ef1484ef1a0ac0afd7937ce28c4eb66ee34f0455 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 32f341029e4e5bfd83a3f4b9bd17d28c646a6070
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date: Thu Feb 11 19:51:38 2010 +0100
support Wiki::Toolkit plugins
-----------------------------------------------------------------------
Summary of changes and diff:
lib/Vend/Wiki.pm | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 50 insertions(+), 1 deletions(-)
diff --git a/lib/Vend/Wiki.pm b/lib/Vend/Wiki.pm
index abf2fc0..629796a 100644
--- a/lib/Vend/Wiki.pm
+++ b/lib/Vend/Wiki.pm
@@ -99,7 +99,18 @@ sub new {
# create Wiki::Toolkit object
$self->{object} = new Wiki::Toolkit(store => $self->{store},
formatter => $self->{formatter_object});
-
+
+ # register plugins
+ my (@plugins, $plugin);
+
+ @plugins = @{$self->{plugin}->{array}};
+
+ for (@plugins) {
+ $plugin = $self->{plugin}->{hash}->{$_};
+ $self->load_plugin($plugin);
+ $self->{object}->register_plugin(plugin => $plugin->{object});
+ }
+
return $self;
}
@@ -418,6 +429,24 @@ sub load_formatter {
return $fmt->{object};
}
+# load plugin
+sub load_plugin {
+ my ($self, $fmt) = @_;
+
+ eval "require $fmt->{class}";
+ if ($@) {
+ die "Failed to load $fmt->{class}: $@\n";
+ }
+ eval {
+ $fmt->{object} = $fmt->{class}->new ();
+ };
+ if ($@) {
+ die "Failed to instantiate $fmt->{class}: $@\n";
+ }
+
+ return $fmt->{object};
+}
+
# default ActionMap for wiki
sub action {
my ($path) = @_;
@@ -496,6 +525,26 @@ sub parse_wiki {
$C->{$item}->{$name}->{$param}->{hash}->{$value} = {class => $class};
}
+ elsif ($param eq 'plugin') {
+ # add to our list of plugins
+ my $class;
+
+ if ($value =~ /::/) {
+ # plugin with different namespace, breakout name
+ $class = $value;
+ my @frags = split(/::/, $value);
+ $value = pop(@frags);
+ }
+ else {
+ $class = "Wiki::Toolkit::Plugin::$value";
+ }
+
+ unless (exists $C->{$item}->{$name}->{$param}->{hash}->{$value}) {
+ push(@{$C->{$item}->{$name}->{$param}->{array}}, $value);
+ }
+
+ $C->{$item}->{$name}->{$param}->{hash}->{$value} = {class => $class};
+ }
elsif ($param eq 'metadata') {
if (exists $metadata_reserved{$value}) {
config_error('Metadata name %s is reserved for %s', $value, $metadata_reserved{$value});
hooks/post-receive
--
Interchange wellwell catalog
More information about the wellwell-devel
mailing list