Index: columns_filter.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/columns_filter/columns_filter.module,v
retrieving revision 1.1
diff -u -p -r1.1 columns_filter.module
--- columns_filter.module	22 Jun 2009 16:39:00 -0000	1.1
+++ columns_filter.module	17 Aug 2009 14:36:55 -0000
@@ -63,28 +63,56 @@ function _columns_filter_process($text =
   $pieces = explode($column_marker, $text);
   $columns = count($pieces);
 
-  // Do nothing if only one column.
+  // Only one column.
   if ($columns < 2) {
-    return $text;
+    return theme('columns_filter_single_column', $text);
   }
+  
+  return theme('columns_filter_columns', $pieces);
+}
+
+
+/**
+ * Implementation of hook_filter_tips().
+ */
+function columns_filter_filter_tips($delta, $format, $long = false) {
+  return t("&lt;!--column--> creates a column break.");
+}
+
+/**
+ * Implementation of hook_theme().
+ */
+function columns_filter_theme($existing, $type, $theme, $path) {
+  return array(
+    'columns_filter_single_column' => array(
+      'arguments' => array('text' => '')),
+    'columns_filter_columns' => array(
+      'arguments' => array('cols' => array())),
+  );
+}
+
+/**
+ * Return HTML for single column.
+ */
+function theme_columns_filter_single_column($text) {
+  return $text;
+}
 
+/**
+ * Return HTML for multiple columns.
+ */
+function theme_columns_filter_columns($cols) {
   // We're only providing CSS for up to 4 columns. You're on your own beyond that.
   // And you probably should do stuff in your theme CSS anyway with gutters.
+  $columns = count($cols);
+
   $attributes = array(
     'class' => "content-column content-column-$columns",
   );
 
-  foreach ($pieces as $piece) {
-    $processed_text .= '<div' . drupal_attributes($attributes) . '>' . trim($piece) . "</div>";
+  foreach ($cols as $col) {
+    $processed_text .= '<div' . drupal_attributes($attributes) . '>' . trim($col) . "</div>";
   }
 
   return $processed_text;
-}
-
-
-/**
- * Implementation of hook_filter_tips().
- */
-function columns_filter_filter_tips($delta, $format, $long = false) {
-  return t("&lt;!--column--> creates a column break.");
-}
+}
\ No newline at end of file
