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