| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | #  You may distribute under the terms of either the GNU General Public License | 
| 2 |  |  |  |  |  |  | #  or the Artistic License (the same terms as Perl itself) | 
| 3 |  |  |  |  |  |  | # | 
| 4 |  |  |  |  |  |  | #  (C) Paul Evans, 2021-2022 -- leonerd@leonerd.org.uk | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 4 |  |  | 4 |  | 52 | use v5.26; | 
|  | 4 |  |  |  |  | 12 |  | 
| 7 | 4 |  |  | 4 |  | 23 | use warnings; | 
|  | 4 |  |  |  |  | 8 |  | 
|  | 4 |  |  |  |  | 130 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 4 |  |  | 4 |  | 22 | use Object::Pad 0.800; | 
|  | 4 |  |  |  |  | 24 |  | 
|  | 4 |  |  |  |  | 156 |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | package App::sdview::Output 0.12; | 
| 12 |  |  |  |  |  |  | role App::sdview::Output; | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | field $_content; | 
| 15 |  |  |  |  |  |  |  | 
| 16 | 113 |  |  | 113 | 0 | 4252 | method say ( @s ) { $_content .= join "", @s, "\n"; } | 
|  | 113 |  |  | 113 | 0 | 143 |  | 
|  | 113 |  |  | 0 | 0 | 179 |  | 
|  | 113 |  |  | 0 | 0 | 141 |  | 
|  | 113 |  |  |  |  | 457 |  | 
| 17 |  |  |  |  |  |  |  | 
| 18 | 25 | 100 |  | 25 | 0 | 50 | method maybe_blank { $_content .= "\n" if length $_content; } | 
|  | 25 |  |  | 25 | 0 | 82 |  | 
|  |  |  |  | 0 | 0 |  |  | 
|  |  |  |  | 0 | 0 |  |  | 
| 19 |  |  |  |  |  |  |  | 
| 20 | 17 |  |  |  |  | 22 | method generate ( @paragraphs ) | 
|  | 17 |  |  |  |  | 35 |  | 
|  | 17 |  |  |  |  | 21 |  | 
| 21 | 17 |  |  | 17 | 0 | 82 | { | 
|  |  |  |  | 17 | 0 |  |  | 
|  |  |  |  | 0 | 0 |  |  | 
|  |  |  |  | 0 | 0 |  |  | 
| 22 | 17 |  |  |  |  | 32 | $_content = ""; | 
| 23 |  |  |  |  |  |  |  | 
| 24 | 17 |  |  |  |  | 44 | while ( @paragraphs ) { | 
| 25 | 35 |  |  |  |  | 64 | my $para = shift @paragraphs; | 
| 26 |  |  |  |  |  |  |  | 
| 27 | 35 | 50 |  |  |  | 120 | if( my $code = $self->can( "output_" . ( $para->type =~ s/-/_/gr ) ) ) { | 
| 28 | 35 |  |  |  |  | 117 | $self->$code( $para ); | 
| 29 |  |  |  |  |  |  | } | 
| 30 |  |  |  |  |  |  | else { | 
| 31 | 0 |  |  |  |  | 0 | die "Unhandled paragraph type " . $para->type; | 
| 32 |  |  |  |  |  |  | } | 
| 33 |  |  |  |  |  |  | } | 
| 34 |  |  |  |  |  |  |  | 
| 35 | 17 |  |  |  |  | 52 | return $_content; | 
| 36 |  |  |  |  |  |  | } | 
| 37 |  |  |  |  |  |  |  | 
| 38 | 0 |  |  |  |  |  | method output ( @paragraphs ) | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 39 | 0 |  |  | 0 | 0 |  | { | 
|  |  |  |  | 0 | 0 |  |  | 
|  |  |  |  | 0 | 0 |  |  | 
|  |  |  |  | 0 | 0 |  |  | 
| 40 | 0 |  |  |  |  |  | say $self->generate( @paragraphs ); | 
| 41 |  |  |  |  |  |  | } | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | 0x55AA; |