]> git.decadent.org.uk Git - memories.git/blobdiff - Tagtools.pm
Separate tags with commas, split off tag parsing code to Tagtools to make it easier...
[memories.git] / Tagtools.pm
index 0fc2529b370505206b4bc99f3aed29aae1c49b09..292e6e517a33c821e5f53bffd6efa2e3faea6a71 100644 (file)
@@ -4,6 +4,7 @@ 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) = @_;
@@ -57,6 +58,14 @@ sub import {
 
 }
 
+sub separate_tags {
+    map { s/^"|"$//g; $_} 
+    extract_multiple(
+        lc $_[1], [ 
+            \&extract_quotelike, 
+            qr/([^\s,]+)/ 
+        ], undef,1)
+}
 
 # THIS IS A HACK