X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=Tagtools.pm;h=10a242be8da1b317d7f7d43cf5ef4768988f922d;hb=609819f3444e44f4ef96a15bdb479aeeba496a5a;hp=0fc2529b370505206b4bc99f3aed29aae1c49b09;hpb=b9d021d4af1018ac2c60640678c1b790251190e9;p=memories.git diff --git a/Tagtools.pm b/Tagtools.pm index 0fc2529..10a242b 100644 --- a/Tagtools.pm +++ b/Tagtools.pm @@ -1,9 +1,11 @@ package Tagtools; +use URI::Escape; use HTML::TagCloud; use Carp; use Cache::FileCache; use Storable qw(freeze); use MIME::Base64; use Calendar::Simple; +use Text::Balanced qw(extract_multiple extract_quotelike); sub import { my $whence = caller; my ($class) = @_; @@ -52,11 +54,19 @@ sub import { return \@month; }; for my $thing (qw(tagcloud calendar)) { - *{$whence."::$thing"} = sub { shift->do_cached($thing, @_) } + *{$whence."::$thing"} = sub { shift->do_cached(\&{$whence."::_".$thing}, @_) } } } +sub separate_tags { + map { s/^"|"$//g; $_} + extract_multiple( + lc $_[1], [ + \&extract_quotelike, + qr/([^\s,]+)/ + ], undef,1) +} # THIS IS A HACK