… | |
… | |
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 |
… | |
… | |
81 | my $text = $link =~ s/^(.*)\|// ? $1 : $link; |
82 | my $text = $link =~ s/^(.*)\|// ? $1 : $link; |
82 | |
83 | |
83 | if ($link =~ /http:/) { |
84 | if ($link =~ /http:/) { |
84 | "U<" . (aspod $link) . ">" |
85 | "U<" . (aspod $link) . ">" |
85 | } else { |
86 | } else { |
86 | () |
87 | aspod $text |
87 | } |
88 | } |
88 | } |
89 | } |
89 | |
90 | |
90 | sub view_item { |
91 | sub view_item { |
91 | push @result, { |
92 | push @result, { |
… | |
… | |
195 | package cf::pod; |
196 | package cf::pod; |
196 | |
197 | |
197 | sub pom_as_paragraphs_ng($) { |
198 | sub pom_as_paragraphs_ng($) { |
198 | my ($pom) = @_; |
199 | my ($pom) = @_; |
199 | |
200 | |
|
|
201 | # we suckers use global variables, unfortunately. |
200 | local $indent = 0; |
202 | local $indent = 0; |
201 | local $level = 1; |
203 | local $level = 1; |
202 | local @result = ( { } ); |
204 | local @result = ( { } ); |
203 | |
205 | |
204 | $pom->present ("cf::pod::AsParagraphs"); |
206 | $pom->present ("cf::pod::AsParagraphs"); |
… | |
… | |
207 | } |
209 | } |
208 | |
210 | |
209 | sub pom_as_paragraphs($) { |
211 | sub pom_as_paragraphs($) { |
210 | my ($pom) = @_; |
212 | my ($pom) = @_; |
211 | |
213 | |
212 | # we suckers use global variables, unfortunately. |
|
|
213 | my $guard = cf::lock_acquire "cf::pod::as_paragraphs"; |
214 | my $guard = cf::lock_acquire "cf::pod::as_paragraphs"; |
214 | |
215 | |
215 | $pom->pom_as_paragraphs_ng |
216 | $pom->pom_as_paragraphs_ng |
216 | } |
217 | } |
217 | |
218 | |
218 | sub load_pod($) { |
219 | sub load_pod($) { |
219 | my ($path) = @_; |
220 | my ($path) = @_; |
220 | |
221 | |
221 | Coro::Storable::thaw cf::cache "cf::pod::as_paragraphs/$path" => [$path], |
222 | Coro::Storable::thaw cf::cache "cf::pod::as_paragraphs/$path" => [$path], |
222 | 8 => sub { |
223 | 9 => sub { |
223 | my ($src) = @_; |
224 | my ($src) = @_; |
224 | |
225 | |
225 | cf::fork_call { |
226 | cf::fork_call { |
226 | Coro::Storable::blocking_nfreeze |
227 | Coro::Storable::blocking_nfreeze |
227 | pom_as_paragraphs_ng |
228 | pom_as_paragraphs_ng |