]> git.decadent.org.uk Git - memories.git/blobdiff - Tagtools.pm
Just looks a bit smarter.
[memories.git] / Tagtools.pm
index 0fc2529b370505206b4bc99f3aed29aae1c49b09..10a242be8da1b317d7f7d43cf5ef4768988f922d 100644 (file)
@@ -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