Silki/Role/Controller/PagePreview.pm untested

filter: Statementstmt 0.0% 0 / 24 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 33 CC 2 SCAR 11.5
CC
2
Cov
0%
_send_preview_html
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.1
1 package Silki::Role::Controller::PagePreview;
2 {
3 $Silki::Role::Controller::PagePreview::VERSION = '0.29';
4 }
5  
6 use strict;
7 use warnings;
8 use namespace::autoclean;
9  
10 use Silki::Formatter::WikiToHTML;
11  
12 use Moose::Role;
13  
14 sub _send_preview_html {
15 my $self = shift;
16 my $c = shift;
17  
18 $self->_require_permission_for_wiki( $c, $c->stash()->{wiki}, 'Read' );
19  
20 my $formatter = Silki::Formatter::WikiToHTML->new(
21 ( $c->stash()->{page} ? ( page => $c->stash()->{page} ) : () ),
22 user => $c->user(),
23 wiki => $c->stash()->{wiki},
24 include_toc => 1,
25 );
26  
27 my $html = $formatter->wiki_to_html( $c->request()->params()->{content} );
28  
29 $self->status_ok(
30 $c,
31 entity => { html => $html },
32 );
33 }
34  
35 1;