--- deliantra/server/lib/cf/pod.pm 2011/04/23 04:56:52 1.25 +++ deliantra/server/lib/cf/pod.pm 2012/11/21 12:47:04 1.31 @@ -1,22 +1,22 @@ # # This file is part of Deliantra, the Roguelike Realtime MMORPG. -# -# Copyright (©) 2005,2006,2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team -# +# +# Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann / Robin Redeker / the Deliantra team +# # Deliantra is free software: you can redistribute it and/or modify it under # the terms of the Affero GNU General Public License as published by the # Free Software Foundation, either version 3 of the License, or (at your # option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the Affero GNU General Public License # and the GNU General Public License along with this program. If not, see # . -# +# # The authors can be reached via e-mail to # @@ -68,6 +68,7 @@ *view_seq_zero = sub { "Z<>" }; *view_seq_space = sub { my $text = $_[1]; $text =~ s/ /\xa0/g; $text }; *view_seq_index = sub { push @{ $result[-1]{index} }, $_[1]; "" }; +#view_seq_entity sub view_seq_text { my $text = $_[1]; @@ -83,7 +84,7 @@ if ($link =~ /http:/) { "U<" . (aspod $link) . ">" } else { - () + aspod $text } } @@ -194,12 +195,10 @@ package cf::pod; -sub pom_as_paragraphs($) { +sub pom_as_paragraphs_ng($) { my ($pom) = @_; # we suckers use global variables, unfortunately. - my $guard = cf::lock_acquire "cf::pod::as_paragraphs"; - local $indent = 0; local $level = 1; local @result = ( { } ); @@ -209,16 +208,24 @@ [grep $_->{index} || exists $_->{markup}, @result] } +sub pom_as_paragraphs($) { + my ($pom) = @_; + + my $guard = cf::lock_acquire "cf::pod::as_paragraphs"; + + $pom->pom_as_paragraphs_ng +} + sub load_pod($) { my ($path) = @_; Coro::Storable::thaw cf::cache "cf::pod::as_paragraphs/$path" => [$path], - 8 => sub { + 9 => sub { my ($src) = @_; cf::fork_call { Coro::Storable::blocking_nfreeze - pom_as_paragraphs + pom_as_paragraphs_ng +(Pod::POM->new->parse_text ($src->[0])) } };