Mercurial > repos > cpt > cpt_psm_recombine
comparison lib/CPT/Report/Pandoc.pm @ 1:97ef96676b48 draft
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
author | cpt |
---|---|
date | Mon, 05 Jun 2023 02:51:26 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:b18e8268bf4e | 1:97ef96676b48 |
---|---|
1 package CPT::Report::Pandoc; | |
2 no warnings; | |
3 use Moose; | |
4 with 'CPT::Report'; | |
5 use Carp; | |
6 | |
7 sub header { | |
8 my ($self) = @_; | |
9 return sprintf "%% %s\n%% %s\n%% %s\n\n", $self->{title}, $self->{date}, $self->{author}; | |
10 } | |
11 | |
12 sub footer{ | |
13 my ($self) = @_; | |
14 return ''; | |
15 } | |
16 | |
17 sub h1{ | |
18 my ($self, $addition) = @_; | |
19 $self->a(sprintf("\n\n# %s\n\n", $addition)); | |
20 } | |
21 sub h2{ | |
22 my ($self, $addition) = @_; | |
23 $self->a(sprintf("\n\n## %s\n\n", $addition)); | |
24 } | |
25 sub h3{ | |
26 my ($self, $addition) = @_; | |
27 $self->a(sprintf("\n\n### %s\n\n", $addition)); | |
28 } | |
29 sub h4{ | |
30 my ($self, $addition) = @_; | |
31 $self->a(sprintf("\n\n#### %s\n\n", $addition)); | |
32 } | |
33 sub h5{ | |
34 my ($self, $addition) = @_; | |
35 $self->a(sprintf("\n\n##### %s\n\n", $addition)); | |
36 } | |
37 sub h6{ | |
38 my ($self, $addition) = @_; | |
39 $self->a(sprintf("\n\n##### %s\n\n", $addition)); | |
40 } | |
41 | |
42 sub p{ | |
43 my ($self, $addition) = @_; | |
44 $self->a(sprintf("\n%s\n", $addition)); | |
45 } | |
46 | |
47 sub list_start { | |
48 my ($self, $type) = @_; | |
49 if($type ne 'number' && $type ne 'bullet'){ | |
50 carp 'Must use number or bullet as list type'; | |
51 } | |
52 $self->_list_type($type); | |
53 } | |
54 | |
55 sub list_end { | |
56 my ($self) = @_; | |
57 } | |
58 | |
59 sub list_element { | |
60 my ($self, $element_text) = @_; | |
61 my $preceeding_char; | |
62 if($self->_list_type() eq 'number'){ | |
63 $preceeding_char = '#'; | |
64 }else{ | |
65 $preceeding_char = '*'; | |
66 } | |
67 $self->a(sprintf('%s %s', $preceeding_char, $element_text)); | |
68 } | |
69 | |
70 no Moose; | |
71 1; | |
72 | |
73 __END__ | |
74 | |
75 =pod | |
76 | |
77 =encoding UTF-8 | |
78 | |
79 =head1 NAME | |
80 | |
81 CPT::Report::Pandoc | |
82 | |
83 =head1 VERSION | |
84 | |
85 version 1.99.4 | |
86 | |
87 =head1 AUTHOR | |
88 | |
89 Eric Rasche <rasche.eric@yandex.ru> | |
90 | |
91 =head1 COPYRIGHT AND LICENSE | |
92 | |
93 This software is Copyright (c) 2014 by Eric Rasche. | |
94 | |
95 This is free software, licensed under: | |
96 | |
97 The GNU General Public License, Version 3, June 2007 | |
98 | |
99 =cut |