| 1 | package Pod::Simple::Vim; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 2 | ▶ | use Text::Wrap; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 2 | our $VERSION = '0.02'; | |||||||||
| 9 | |||||||||||
| 10 | 2 | ▶ | use base 'Pod::Simple::Methody'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 2 | my $list_indent_level = 0; | |||||||||
| 13 | 2 | my $text_indent_level = 0; | |||||||||
| 14 | 2 | my $initial_tab; | |||||||||
| 15 | my $text_bin; | ||||||||||
| 16 | 2 | my $wrap = 0; | |||||||||
| 17 | 2 | my $wrap_text_item = 0; | |||||||||
| 18 | 2 | my $first_item; | |||||||||
| 19 | |||||||||||
| 20 | |||||||||||
| 21 | #--------------------------------------------------------------------------- | ||||||||||
| 22 | # HANDLE VARIOUS TYPES OF TEXT | ||||||||||
| 23 | #--------------------------------------------------------------------------- | ||||||||||
| 24 | |||||||||||
| 25 | #GENERAL TEXT HANDLER | ||||||||||
| 26 | sub handle_text | ||||||||||
| 27 | 13 | ▶ | { | ||||||||
|
Subroutine
handle_text: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 28 | 13 | my($self, $text) = @_; | |||||||||
| 29 | 13 | ▶ | if ($wrap) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | { | ||||||||||
| 31 | 6 | $text_bin .= $text; | |||||||||
| 32 | } else { | ||||||||||
| 33 | 7 | print OUTFH $text; | |||||||||
| 34 | } | ||||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | #ORDINARY TEXT | ||||||||||
| 38 | sub start_Para | ||||||||||
| 39 | 1 | ▶ | { | ||||||||
|
Subroutine
start_Para: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||
| 40 | 1 | $wrap = 1; | |||||||||
| 41 | 1 | ▶ | print OUTFH "\n" unless $first_item; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | 1 | undef $first_item; | |||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | sub end_Para | ||||||||||
| 46 | 1 | ▶ | { | ||||||||
|
Subroutine
end_Para: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||
| 47 | 1 | $wrap = 0; | |||||||||
| 48 | 1 | ▶ | $initial_tab = "\040\040\040\040"x$list_indent_level if $list_indent_level; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | 1 | local $Text::Wrap::unexpand = 0; | |||||||||
| 50 | #local $Text::Wrap::columns = 78; | ||||||||||
| 51 | 1 | print OUTFH wrap($initial_tab, $initial_tab, $text_bin); | |||||||||
| 52 | 1 | print OUTFH "\n"; | |||||||||
| 53 | 1 | undef $text_bin; | |||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | #VERBATIM | ||||||||||
| 57 | sub start_Verbatim | ||||||||||
| 58 | 1 | ▶ | { | ||||||||
|
Subroutine
start_Verbatim: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 59 | 1 | my($self, $attrs) = @_; | |||||||||
| 60 | 1 | print OUTFH ">\n"; | |||||||||
| 61 | 1 | $wrap = 1; | |||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | sub end_Verbatim | ||||||||||
| 65 | 1 | ▶ | { | ||||||||
|
Subroutine
end_Verbatim: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 66 | 1 | my ($self, $attrs) = @_; | |||||||||
| 67 | 1 | $initial_tab = ""; | |||||||||
| 68 | 1 | ▶ | $initial_tab = "\040\040\040\040"x$list_indent_level if $list_indent_level; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 69 | 1 | my @lines = split /\n/, $text_bin; | |||||||||
| 70 | 1 | print OUTFH $initial_tab, $_, "\n" for @lines; | |||||||||
| 71 | 1 | undef $wrap; | |||||||||
| 72 | 1 | undef $text_bin; | |||||||||
| 73 | 1 | print OUTFH "<"; | |||||||||
| 74 | } | ||||||||||
| 75 | |||||||||||
| 76 | #--------------------------------------------------------------------------- | ||||||||||
| 77 | # HANDLE HEADINGS | ||||||||||
| 78 | #--------------------------------------------------------------------------- | ||||||||||
| 79 | |||||||||||
| 80 | #HEAD1 | ||||||||||
| 81 | 1 | ▶ | sub start_head1 { | ||||||||
|
Subroutine
start_head1: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||
| 82 | 1 | my($self, $attrs) = @_; | |||||||||
| 83 | 1 | ▶ | print OUTFH "\n" unless $first_item; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 84 | 1 | undef $first_item; | |||||||||
| 85 | } | ||||||||||
| 86 | |||||||||||
| 87 | 1 | ▶ | sub end_head1 { | ||||||||
|
Subroutine
end_head1: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 88 | 1 | my($self) = @_; | |||||||||
| 89 | 1 | print OUTFH " ~\n"; | |||||||||
| 90 | } | ||||||||||
| 91 | |||||||||||
| 92 | #HEAD2 | ||||||||||
| 93 | 1 | ▶ | sub start_head2 { | ||||||||
|
Subroutine
start_head2: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||
| 94 | 1 | my($self, $attrs) = @_; | |||||||||
| 95 | 1 | ▶ | print OUTFH "\n" unless $first_item; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 96 | 1 | undef $first_item; | |||||||||
| 97 | } | ||||||||||
| 98 | |||||||||||
| 99 | 1 | ▶ | sub end_head2 { | ||||||||
|
Subroutine
end_head2: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 100 | 1 | my($self) = @_; | |||||||||
| 101 | 1 | print OUTFH " ~\n"; | |||||||||
| 102 | } | ||||||||||
| 103 | |||||||||||
| 104 | #HEAD3 | ||||||||||
| 105 | 3 | ▶ | sub start_head3 { | ||||||||
|
Subroutine
start_head3: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||
| 106 | 3 | my($self, $attrs) = @_; | |||||||||
| 107 | 3 | ▶ | print OUTFH "\n" unless $first_item; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 108 | 3 | print OUTFH " "; | |||||||||
| 109 | 3 | undef $first_item; | |||||||||
| 110 | } | ||||||||||
| 111 | |||||||||||
| 112 | 3 | ▶ | sub end_head3 { | ||||||||
|
Subroutine
end_head3: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 113 | 3 | my($self) = @_; | |||||||||
| 114 | 3 | print OUTFH " ~\n"; | |||||||||
| 115 | } | ||||||||||
| 116 | |||||||||||
| 117 | #HEAD4 | ||||||||||
| 118 | 0 | ▶ | sub start_head4 { | ||||||||
|
Subroutine
start_head4: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 119 | 0 | my($self, $attrs) = @_; | |||||||||
| 120 | 0 | ▶ | print OUTFH "\n" unless $first_item; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 121 | 0 | print OUTFH " "; | |||||||||
| 122 | 0 | undef $first_item; | |||||||||
| 123 | } | ||||||||||
| 124 | |||||||||||
| 125 | 0 | ▶ | sub end_head4 { | ||||||||
|
Subroutine
end_head4: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 126 | 0 | my($self) = @_; | |||||||||
| 127 | 0 | print OUTFH " ~\n"; | |||||||||
| 128 | } | ||||||||||
| 129 | |||||||||||
| 130 | #--------------------------------------------------------------------------- | ||||||||||
| 131 | # HANDLE LISTS | ||||||||||
| 132 | #--------------------------------------------------------------------------- | ||||||||||
| 133 | |||||||||||
| 134 | #TEXT | ||||||||||
| 135 | 1 | ▶ | sub start_over_text { | ||||||||
|
Subroutine
start_over_text: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 136 | 1 | my($self, $attrs) = @_; | |||||||||
| 137 | 1 | $list_indent_level++; | |||||||||
| 138 | } | ||||||||||
| 139 | |||||||||||
| 140 | 1 | ▶ | sub end_over_text { | ||||||||
|
Subroutine
end_over_text: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 141 | 1 | my($self) = @_; | |||||||||
| 142 | 1 | $list_indent_level--; | |||||||||
| 143 | } | ||||||||||
| 144 | |||||||||||
| 145 | 2 | ▶ | sub start_item_text { | ||||||||
|
Subroutine
start_item_text: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||
| 146 | 2 | my($self, $attrs) = @_; | |||||||||
| 147 | 2 | ▶ | print OUTFH "\n" unless $first_item; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 148 | 2 | undef $first_item; | |||||||||
| 149 | 2 | print OUTFH "\t"x$list_indent_level; | |||||||||
| 150 | } | ||||||||||
| 151 | |||||||||||
| 152 | 2 | ▶ | sub end_item_text { | ||||||||
|
Subroutine
end_item_text: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 153 | 2 | my($self) = @_; | |||||||||
| 154 | 2 | print OUTFH "\n"; | |||||||||
| 155 | } | ||||||||||
| 156 | |||||||||||
| 157 | #BULLET | ||||||||||
| 158 | 1 | ▶ | sub start_over_bullet { | ||||||||
|
Subroutine
start_over_bullet: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 159 | 1 | my($self, $attrs) = @_; | |||||||||
| 160 | 1 | $list_indent_level++; | |||||||||
| 161 | } | ||||||||||
| 162 | |||||||||||
| 163 | 1 | ▶ | sub end_over_bullet { | ||||||||
|
Subroutine
end_over_bullet: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 164 | 1 | my($self) = @_; | |||||||||
| 165 | 1 | $list_indent_level--; | |||||||||
| 166 | } | ||||||||||
| 167 | |||||||||||
| 168 | 2 | ▶ | sub start_item_bullet { | ||||||||
|
Subroutine
start_item_bullet: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||
| 169 | 2 | my($self, $attrs) = @_; | |||||||||
| 170 | 2 | ▶ | print OUTFH "\n" unless $first_item; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 171 | 2 | undef $first_item; | |||||||||
| 172 | 2 | ▶ | print OUTFH "\t"x($list_indent_level-1) if $list_indent_level; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 173 | 2 | print OUTFH " * "; | |||||||||
| 174 | #$in_bullet++; | ||||||||||
| 175 | 2 | $wrap = 1; | |||||||||
| 176 | } | ||||||||||
| 177 | |||||||||||
| 178 | 2 | ▶ | sub end_item_bullet { | ||||||||
|
Subroutine
end_item_bullet: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||
| 179 | 2 | my($self) = @_; | |||||||||
| 180 | 2 | ▶ | $initial_tab = "\040\040\040\040"x$list_indent_level if $list_indent_level; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 181 | 2 | local $Text::Wrap::unexpand = 0; | |||||||||
| 182 | 2 | print OUTFH wrap("", $initial_tab, $text_bin); | |||||||||
| 183 | 2 | print OUTFH "\n"; | |||||||||
| 184 | 2 | undef $text_bin; | |||||||||
| 185 | 2 | undef $wrap; | |||||||||
| 186 | } | ||||||||||
| 187 | |||||||||||
| 188 | #NUMBER | ||||||||||
| 189 | 1 | ▶ | sub start_over_number { | ||||||||
|
Subroutine
start_over_number: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 190 | 1 | my($self, $attrs) = @_; | |||||||||
| 191 | 1 | $list_indent_level++; | |||||||||
| 192 | } | ||||||||||
| 193 | |||||||||||
| 194 | 1 | ▶ | sub end_over_number { | ||||||||
|
Subroutine
end_over_number: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 195 | 1 | my($self) = @_; | |||||||||
| 196 | 1 | $list_indent_level--; | |||||||||
| 197 | } | ||||||||||
| 198 | |||||||||||
| 199 | 2 | ▶ | sub start_item_number { | ||||||||
|
Subroutine
start_item_number: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||
| 200 | 2 | my($self, $attrs) = @_; | |||||||||
| 201 | 2 | ▶ | print OUTFH "\n" unless $first_item; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 202 | 2 | undef $first_item; | |||||||||
| 203 | 2 | ▶ | print OUTFH "\t"x($list_indent_level-1) if $list_indent_level; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 204 | 2 | print OUTFH " " . $attrs->{'number'} . ". "; | |||||||||
| 205 | #$in_bullet++; | ||||||||||
| 206 | 2 | $wrap = 1; | |||||||||
| 207 | } | ||||||||||
| 208 | |||||||||||
| 209 | 2 | ▶ | sub end_item_number { | ||||||||
|
Subroutine
end_item_number: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||
| 210 | 2 | my($self) = @_; | |||||||||
| 211 | 2 | ▶ | $initial_tab = "\040\040\040\040"x$list_indent_level if $list_indent_level; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 212 | 2 | local $Text::Wrap::unexpand = 0; | |||||||||
| 213 | 2 | print OUTFH wrap("", $initial_tab, $text_bin); | |||||||||
| 214 | 2 | print OUTFH "\n"; | |||||||||
| 215 | 2 | undef $text_bin; | |||||||||
| 216 | 2 | undef $wrap; | |||||||||
| 217 | } | ||||||||||
| 218 | |||||||||||
| 219 | #--------------------------------------------------------------------------- | ||||||||||
| 220 | # VIM MODELINE | ||||||||||
| 221 | #--------------------------------------------------------------------------- | ||||||||||
| 222 | |||||||||||
| 223 | sub start_Document | ||||||||||
| 224 | 1 | ▶ | { | ||||||||
|
Subroutine
start_Document: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 225 | 1 | my $self = shift; | |||||||||
| 226 | 1 | $first_item = 1; | |||||||||
| 227 | 1 | *OUTFH = $self->output_fh(); | |||||||||
| 228 | } | ||||||||||
| 229 | |||||||||||
| 230 | sub end_Document | ||||||||||
| 231 | 1 | ▶ | { | ||||||||
|
Subroutine
end_Document: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 232 | 1 | print OUTFH "\n\nvim:nonu:ts=4:syn=perldoc:noet:lbr:bt=nofile:noma:bh=delete:noswf"; | |||||||||
| 233 | } | ||||||||||
| 234 | |||||||||||
| 235 | 2 | 1; | |||||||||
| 236 | |||||||||||
| 237 | __END__ | ||||||||||