--- taxonomy_menu_pathauto.inc	2009-02-12 00:41:39.000000000 +0100
+++ taxonomy_menu_pathauto.inc.mine	2009-06-18 00:13:39.000000000 +0200
@@ -50,7 +50,7 @@
   $count = 0;
   foreach (taxonomy_get_vocabularies() as $category) { 
     // The Base Vocabulary path
-    $path =  variable_get('taxonomy_menu_display_page', 'category') . $category->vid;
+    $path =  variable_get('taxonomy_menu_display_page', 'category') . "/" . $category->vid;
   
     $tree = taxonomy_get_tree($category->vid);
     $old_depth = -1;
@@ -105,6 +105,38 @@
       $values['vocab-raw'] = $vocabulary->name;
       $values['cat-raw'] = $category->name;
 
+      $label = 'term';
+          if (isset($category->tid)) {
+            $separator = variable_get('pathauto_separator', '-');
+            $parents = taxonomy_get_parents_all($category->tid);
+            array_shift($parents);
+            $catpath = '';
+            $catpath_raw = '';
+            foreach ($parents as $parent) {
+              // Replace any / characters in individual terms which might create confusing URLs
+              $catpath = pathauto_cleanstring(check_plain(preg_replace('/\//', '', $parent->name))) .'/'. $catpath;
+              $catpath_raw = pathauto_cleanstring(preg_replace('/\//', '', $parent->name)) .'/'. $catpath_raw;
+            }
+            $values[$label .'path'] = $catpath .'/'. check_plain($category->name);
+            $values[$label .'path-raw'] = $catpath_raw .'/'. $category->name;
+
+            // We only do this for taxonomy because token already provides the [term] value but has problem with [cat] TODO: fix that?
+            if ($type == 'taxonomy') {
+              $values[$label] = check_plain($category->name);
+              $values[$label .'-raw'] = $category->name;
+            }
+
+            $values[$label .'alias'] = drupal_get_path_alias('taxonomy/term/'. $category->tid);
+            if (!strncasecmp($values[$label .'alias'], 'taxonomy', 8)) {
+              $values[$label .'alias'] = $values[$label];
+            }
+          }
+          else { // Provide some defaults if they aren't set.
+            $values[$label .'path'] = '';
+            $values[$label .'path-raw'] = '';
+            $values[$label .'alias'] = '';
+          }
+
       break;
   }
   return $values;
@@ -122,7 +154,10 @@
     $tokens['taxonomy_menu']['tid'] = t('The id number of the category.');
     $tokens['taxonomy_menu']['vocab-raw'] = t("The unfiltered vocabulary that the page's first category belongs to. WARNING - raw user input.");
     $tokens['taxonomy_menu']['cat-raw'] = t('The unfiltered name of the category. WARNING - raw user input.');
-
+//pentike
+      $tokens['taxonomy_menu']['termpath'] = t("As [term], but including its supercategories separated by /.");
+      $tokens['taxonomy_menu']['termpath-raw'] = t("As [term-raw], but including its supercategories separated by /. WARNING - raw user input.");
+//pentike
     return $tokens;
   }
 }
