… | |
… | |
21 | push @{ $books[-1] }, $par; |
21 | push @{ $books[-1] }, $par; |
22 | } |
22 | } |
23 | } |
23 | } |
24 | |
24 | |
25 | @BOOKS = @books; |
25 | @BOOKS = @books; |
|
|
26 | |
|
|
27 | () |
26 | } |
28 | } |
27 | |
29 | |
28 | cf::sync_job { |
30 | cf::post_init { |
29 | reload; |
31 | $_[0] ? cf::async_ext { reload } : reload |
30 | }; |
32 | }; |
31 | |
33 | |
32 | sub make_book { |
34 | sub make_book { |
33 | my ($book, $level) = @_; |
35 | my ($book, $level) = @_; |
34 | |
36 | |
35 | return unless @BOOKS; |
37 | return unless @BOOKS; |
36 | |
38 | |
37 | my ($title, @body) = @{$BOOKS[rand @BOOKS]}; |
39 | my ($title, @body) = @{$BOOKS[rand @BOOKS]}; |
38 | |
40 | |
|
|
41 | # half-assed attempt to make it a single line text-only title |
39 | $title = cf::pod::as_text [$title]; |
42 | $title = cf::pod::as_cfpod [$title]; |
40 | $title =~ s/\n/ /g; |
43 | $title =~ s/\n/ /g; |
41 | $title =~ s/ +$//; |
44 | $title =~ s/ +$//; |
|
|
45 | $title =~ s/B<([^>]*)>/$1/g; |
42 | |
46 | |
43 | $book->name ($title); |
47 | $book->name ($title); |
44 | $book->name_pl ($title); |
48 | $book->name_pl ($title); |
45 | $book->title (undef); |
49 | $book->title (undef); |
46 | $book->msg (cf::pod::as_text \@body); |
50 | $book->msg (cf::pod::as_cfpod \@body); |
47 | } |
51 | } |
48 | |
52 | |