| 1 | package Kwiki::PageInclude; | ||
| 2 | 0 | ▶ | use Kwiki::Plugin -Base; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 3 | our $VERSION = '0.02'; | ||
| 4 | |||
| 5 | const class_id => 'page_include'; | ||
| 6 | const class_title => 'Include Other Page'; | ||
| 7 | |||
| 8 | sub register { | ||
| 9 | my $reg = shift; | ||
| 10 | $reg->add(wafl => include => 'Kwiki::PageInclude::WaflPhrase'); | ||
| 11 | } | ||
| 12 | |||
| 13 | package Kwiki::PageInclude::WaflPhrase; | ||
| 14 | use base 'Spoon::Formatter::WaflPhrase'; | ||
| 15 | |||
| 16 | sub to_html { | ||
| 17 | my @args = split(/[\s,]+/,$self->arguments); | ||
| 18 | my $ret; | ||
| 19 | for(@args) { | ||
| 20 | my $page = $self->hub->pages->new_from_name($_); | ||
| 21 | $ret .= $self->hub->formatter->text_to_html($page->content); | ||
| 22 | } | ||
| 23 | return $ret; | ||
| 24 | } | ||
| 25 | |||
| 26 | __END__ | ||