Index: chessboard.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/chessboard/chessboard.module,v
retrieving revision 1.5.2.3
diff -u -r1.5.2.3 chessboard.module
--- chessboard.module	23 Jul 2008 06:21:14 -0000	1.5.2.3
+++ chessboard.module	10 Apr 2010 23:22:03 -0000
@@ -125,9 +125,6 @@
       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,26 @@
   }
 }
 
+/**
+ * Theme chessboard_notation render element.
+ *
+ * @param $variables
+ *    An associative array containing:
+ *   - element: An associative array containing the properties of the element.
+ *     Properties used: #notation.
+ *
+ * @return
+ *   A themed HTML string representing the render element.
+ *
+ * @ingroup themable
+ */
+function theme_chessboard_notation($variables) {
+  $element = $variables['element'];
+  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($element['#notation']) .'</div>';
+}
 
 /**
  * Returns the replacement text.  Called as a callback from
@@ -150,8 +167,7 @@
  *   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_notation', array('element' => array('#notation' => $matches[1])));
 }
 
 
@@ -218,9 +234,7 @@
   
   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_notation', array('element' => array('#notation' => $item['value'])));
   }
 }
 

