Index: chessboard.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/chessboard/chessboard.module,v
retrieving revision 1.5.2.3
diff -u -p -r1.5.2.3 chessboard.module
--- chessboard.module	23 Jul 2008 06:21:14 -0000	1.5.2.3
+++ chessboard.module	11 Apr 2010 13:14:00 -0000
@@ -125,9 +125,6 @@ function chessboard_filter($op, $delta=0
       return t('Renders chessboard diagrams.');
 
     case 'process':
-      require_once 'chessboard_render.php';
-      chessboard_image_path(base_path() . drupal_get_path('module', 'chessboard') .'/default/');
-      // ????? chessboard_image_path('/main/modules/chessboard/default/');
       return preg_replace_callback('@\[chessboard\](.*?)\[/chessboard\]@si',
                                    '_chessboard_filter_callback',
                                    $text);
@@ -137,6 +134,21 @@ function chessboard_filter($op, $delta=0
   }
 }
 
+/**
+ * Formats Chessboard Renderer notation syntax in HTML.
+ *
+ * @param $variables
+ *    An associative array containing:
+ *    - notation: The Chessboard Renderer notation string that is being formatted.
+ *
+ * @ingroup themable
+ */
+function theme_chessboard($variables) {
+  require_once 'chessboard_render.php';
+  chessboard_image_path(base_path() . drupal_get_path('module', 'chessboard') .'/default/');
+  // ????? chessboard_image_path('/main/modules/chessboard/default/');
+  return '<div class="chessboard">'. chessboard_render($variables['notation']) .'</div>';
+}
 
 /**
  * Returns the replacement text.  Called as a callback from
@@ -150,8 +162,7 @@ function chessboard_filter($op, $delta=0
  *   A <code>string</code> containing the replacement text.
  */
 function _chessboard_filter_callback($matches) {
-  return '<div class="chessboard">'. chessboard_render($matches[1])
-    .'</div>';
+  return theme('chessboard', array('notation' => $matches[1]));
 }
 
 
@@ -218,9 +229,7 @@ function chessboard_field_formatter($fie
   
   switch ($formatter) {
     default:
-      require_once 'chessboard_render.php';
-      chessboard_image_path(base_path() . drupal_get_path('module', 'chessboard') .'/default/');
-      return '<div class="chessboard">' . chessboard_render($item['value']) . '</div>';
+      return theme('chessboard', array('notation' => $item['value']));
   }
 }
 
