… | |
… | |
66 | *view_seq_T = sub { "T<$_[1]>" }; |
66 | *view_seq_T = sub { "T<$_[1]>" }; |
67 | *view_seq_G = sub { "G<$_[1]>" }; |
67 | *view_seq_G = sub { "G<$_[1]>" }; |
68 | *view_seq_zero = sub { "Z<>" }; |
68 | *view_seq_zero = sub { "Z<>" }; |
69 | *view_seq_space = sub { my $text = $_[1]; $text =~ s/ /\xa0/g; $text }; |
69 | *view_seq_space = sub { my $text = $_[1]; $text =~ s/ /\xa0/g; $text }; |
70 | *view_seq_index = sub { push @{ $result[-1]{index} }, $_[1]; "" }; |
70 | *view_seq_index = sub { push @{ $result[-1]{index} }, $_[1]; "" }; |
|
|
71 | #view_seq_entity |
71 | |
72 | |
72 | sub view_seq_text { |
73 | sub view_seq_text { |
73 | my $text = $_[1]; |
74 | my $text = $_[1]; |
74 | $text =~ s/\s+/ /g; |
75 | $text =~ s/\s+/ /g; |
75 | aspod $text |
76 | aspod $text |
… | |
… | |
192 | |
193 | |
193 | ############################################################################# |
194 | ############################################################################# |
194 | |
195 | |
195 | package cf::pod; |
196 | package cf::pod; |
196 | |
197 | |
197 | sub pom_as_paragraphs($) { |
198 | sub pom_as_paragraphs_ng($) { |
198 | my ($pom) = @_; |
199 | my ($pom) = @_; |
199 | |
|
|
200 | # we suckers use global variables, unfortunately. |
|
|
201 | my $guard = cf::lock_acquire "cf::pod::as_paragraphs"; |
|
|
202 | |
200 | |
203 | local $indent = 0; |
201 | local $indent = 0; |
204 | local $level = 1; |
202 | local $level = 1; |
205 | local @result = ( { } ); |
203 | local @result = ( { } ); |
206 | |
204 | |
207 | $pom->present ("cf::pod::AsParagraphs"); |
205 | $pom->present ("cf::pod::AsParagraphs"); |
208 | |
206 | |
209 | [grep $_->{index} || exists $_->{markup}, @result] |
207 | [grep $_->{index} || exists $_->{markup}, @result] |
210 | } |
208 | } |
211 | |
209 | |
|
|
210 | sub pom_as_paragraphs($) { |
|
|
211 | my ($pom) = @_; |
|
|
212 | |
|
|
213 | # we suckers use global variables, unfortunately. |
|
|
214 | my $guard = cf::lock_acquire "cf::pod::as_paragraphs"; |
|
|
215 | |
|
|
216 | $pom->pom_as_paragraphs_ng |
|
|
217 | } |
|
|
218 | |
212 | sub load_pod($) { |
219 | sub load_pod($) { |
213 | my ($path) = @_; |
220 | my ($path) = @_; |
214 | |
221 | |
215 | Coro::Storable::thaw cf::cache "cf::pod::as_paragraphs/$path" => [$path], |
222 | Coro::Storable::thaw cf::cache "cf::pod::as_paragraphs/$path" => [$path], |
216 | 8 => sub { |
223 | 8 => sub { |
217 | my ($src) = @_; |
224 | my ($src) = @_; |
218 | |
225 | |
219 | cf::fork_call { |
226 | cf::fork_call { |
220 | Coro::Storable::blocking_nfreeze |
227 | Coro::Storable::blocking_nfreeze |
221 | pom_as_paragraphs |
228 | pom_as_paragraphs_ng |
222 | +(Pod::POM->new->parse_text ($src->[0])) |
229 | +(Pod::POM->new->parse_text ($src->[0])) |
223 | } |
230 | } |
224 | }; |
231 | }; |
225 | } |
232 | } |
226 | |
233 | |