Index: geshifilter.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/geshifilter/geshifilter.admin.inc,v
retrieving revision 1.20
diff -u -b -u -p -r1.20 geshifilter.admin.inc
--- geshifilter.admin.inc	27 Jun 2009 12:54:15 -0000	1.20
+++ geshifilter.admin.inc	29 Jun 2009 20:02:19 -0000
@@ -23,6 +23,7 @@ function _geshifilter_filter_settings($f
   if (geshifilter_use_format_specific_options()) {
     // tags and attributes
     $form['geshifilter']['general_tags'] = _geshifilter_general_highlight_tags_settings($format);
+    $form['#validate'][] = '_geshifilter_tag_styles_validate';
     // per language tags
     $form['geshifilter']['per_language_settings'] = array(
       '#type' => 'fieldset',
@@ -41,6 +42,22 @@ function _geshifilter_filter_settings($f
 }
 
 /**
+ * Validation handler for the tag styles form element.
+ * Covers usage in the general form of geshifilter_admin_general_settings()
+ * and the format specific (sub)form of _geshifilter_filter_settings().
+ */
+function _geshifilter_tag_styles_validate($form, &$form_state) {
+  // If we're coming from the _geshifilter_filter_settings (sub)form, we should
+  // take the input format into account.
+  $f = isset($form_state['values']['format']) ? '_'. $form_state['values']['format'] : '';
+
+  // Check that at least one tag style is selected.
+  if (0 == count(array_filter($form_state['values']["geshifilter_tag_styles{$f}"]))) {
+    form_set_error("geshifilter_tag_styles{$f}", t('At least one tag style should be selected.'));
+  }
+}
+
+/**
  * General settings form for the GeSHi filter.
  */
 function geshifilter_admin_general_settings(&$form_state) {
@@ -100,9 +117,10 @@ function geshifilter_admin_general_setti
       '#default_value' => geshifilter_use_format_specific_options(),
       '#description' => t('Enable seperate tag settings of the GeSHi filter for each <a href="!input_formats">input format</a> instead of global tag settings.', array('!input_formats' => url('admin/settings/filters'))),
     );
-    // generic tags
+    // Generic tags settings.
     if (!geshifilter_use_format_specific_options()) {
       $form['geshifilter_tag_options']['geshifilter_general_tags'] = _geshifilter_general_highlight_tags_settings();
+      $form['#validate'][] = '_geshifilter_tag_styles_validate';
     }
 
     // GeSHi filter highlighting options
@@ -358,19 +376,20 @@ function _geshifilter_general_highlight_
     '#default_value' => geshifilter_tags($format),
     '#description' => t('Tags that should activate the GeSHi syntax highlighting. Specify a space-separated list of tagnames.'),
   );
-  // tag style
-  $form["geshifilter_brackets$f"] = array(
-    '#type' => 'select',
-    '#title' => t('Tag style'),
+  // Container tag styles.
+  $form["geshifilter_tag_styles$f"] = array(
+    '#type' => 'checkboxes',
+    '#title' => t('Container tag style'),
     '#options' => array(
-      GESHIFILTER_BRACKETS_ANGLE => '<foo>',
-      GESHIFILTER_BRACKETS_SQUARE => '[foo]',
-      GESHIFILTER_BRACKETS_BOTH => t('!angle or !square', array('!angle' => '<foo>', '!square' => '[foo]')),
+      GESHIFILTER_BRACKETS_ANGLE => '<code>'. check_plain('<foo> ... </foo>') .'</code>',
+      GESHIFILTER_BRACKETS_SQUARE => '<code>'. check_plain('[foo] ... [/foo]') .'</code>',
+      GESHIFILTER_BRACKETS_DOUBLESQUARE => '<code>'. check_plain('[[foo]] ... [[/foo]]') .'</code>',
     ),
-    '#default_value' => _geshifilter_brackets($format),
-    '#description' => t('Select which brackets should be used for the source code container tags.'),
+    '#default_value' => _geshifilter_tag_styles($format),
+    '#description' => t('Select the container tag styles that should trigger GeSHi syntax highlighting.'),
   );
-  // PHP specific delimiters
+  // PHP specific delimiters.
+  // @todo: merge this option into geshifilter_tag_styles$f.
   $form['geshifilter']["geshifilter_enable_php_delimiters$f"] = array(
     '#type' => 'checkbox',
     '#title' => t('Also apply syntax highlighting to &lt;?php ... ?&gt; style PHP source code blocks.'),
Index: geshifilter.filtertips.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/geshifilter/geshifilter.filtertips.inc,v
retrieving revision 1.5
diff -u -b -u -p -r1.5 geshifilter.filtertips.inc
--- geshifilter.filtertips.inc	21 Jul 2008 17:44:23 -0000	1.5
+++ geshifilter.filtertips.inc	29 Jun 2009 20:02:19 -0000
@@ -12,6 +12,7 @@ require_once drupal_get_path('module', '
  * Implementation for geshifilter_filter_tips()
  */
 function _geshifilter_filter_tips($delta, $format, $long = FALSE) {
+  // @todo: replace this with _geshifilter_tag_styles() usage.
   if (_geshifilter_brackets($format) == GESHIFILTER_BRACKETS_SQUARE) {
     $bracket_open = '[';
     $bracket_close = ']';
@@ -76,6 +77,7 @@ function _geshifilter_filter_tips($delta
     // block versus inline
     $items[] = t('If the source code between the tags contains a newline (e.g. immediatly after the opening tag), the highlighted source code will be displayed as a code block. Otherwise it will be displayed inline.');
 
+    // @todo: replace this with the new system.
     if (_geshifilter_brackets($format) == GESHIFILTER_BRACKETS_BOTH) {
       $items[] = t('Beside the tag style "!angle" it is also possible to use "!bracket".' , array('!angle' => '<code>&lt;foo&gt;</code>', '!bracket' => '<code>[foo]</code>'));
     }
Index: geshifilter.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/geshifilter/geshifilter.inc,v
retrieving revision 1.5
diff -u -b -u -p -r1.5 geshifilter.inc
--- geshifilter.inc	21 Jul 2008 17:44:23 -0000	1.5
+++ geshifilter.inc	29 Jun 2009 20:02:19 -0000
@@ -179,6 +179,7 @@ function _geshifilter_php_delimeters($fo
   return variable_get("geshifilter_enable_php_delimiters_{$format}", _geshifilter_php_delimeters());
 }
 
+// @todo: remove this function.
 function _geshifilter_brackets($format = NULL) {
   if (!geshifilter_use_format_specific_options() || $format === NULL) {
     return variable_get('geshifilter_brackets', GESHIFILTER_BRACKETS_BOTH);
@@ -186,6 +187,16 @@ function _geshifilter_brackets($format =
   return variable_get("geshifilter_brackets_{$format}", _geshifilter_brackets());
 }
 
+function _geshifilter_tag_styles($format = NULL) {
+  if (!geshifilter_use_format_specific_options() || $format === NULL) {
+    return variable_get('geshifilter_tag_styles', array(
+      GESHIFILTER_BRACKETS_ANGLE => GESHIFILTER_BRACKETS_ANGLE,
+      GESHIFILTER_BRACKETS_SQUARE => GESHIFILTER_BRACKETS_SQUARE,
+    ));
+  }
+  return variable_get("geshifilter_tag_styles_{$format}", _geshifilter_tag_styles());
+}
+
 function geshifilter_language_tags($language, $format = NULL) {
   if (!geshifilter_use_format_specific_options() || $format === NULL)
     return variable_get("geshifilter_language_tags_{$language}", '');
Index: geshifilter.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/geshifilter/geshifilter.module,v
retrieving revision 1.45
diff -u -b -u -p -r1.45 geshifilter.module
--- geshifilter.module	27 Jun 2009 12:54:15 -0000	1.45
+++ geshifilter.module	29 Jun 2009 20:02:20 -0000
@@ -24,7 +24,8 @@ define('GESHIFILTER_ATTRIBUTE_FANCY_N', 
 
 define('GESHIFILTER_BRACKETS_ANGLE', 1);
 define('GESHIFILTER_BRACKETS_SQUARE', 2);
-define('GESHIFILTER_BRACKETS_BOTH', 3);
+define('GESHIFILTER_BRACKETS_DOUBLESQUARE', 4);
+define('GESHIFILTER_BRACKETS_BOTH', 3); //@todo: delete this line when ready.
 
 define('GESHIFILTER_LINE_NUMBERS_DEFAULT_NONE', 0);
 define('GESHIFILTER_LINE_NUMBERS_DEFAULT_NORMAL', 1);
Index: geshifilter.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/geshifilter/geshifilter.pages.inc,v
retrieving revision 1.10
diff -u -b -u -p -r1.10 geshifilter.pages.inc
--- geshifilter.pages.inc	4 Jan 2009 17:44:38 -0000	1.10
+++ geshifilter.pages.inc	29 Jun 2009 20:02:20 -0000
@@ -107,22 +107,25 @@ function _geshifilter_prepare($format, $
   // Also matches "<code>...$"  where "$" refers to end of string, not end of
   // line (because PCRE_MULTILINE (modifier 'm') is not enabled), so matching
   // still works when teaser view trims inside the source code.
-  switch (_geshifilter_brackets($format)) {
-    case GESHIFILTER_BRACKETS_ANGLE:
+
+  // Replace the code container tag brackets
+  // and prepare the container content (newline and angle bracket protection).
+  // @todo: make sure that these replacements can be done in serie.
+  $tag_styles = array_filter(_geshifilter_tag_styles($format));
+  if (in_array(GESHIFILTER_BRACKETS_ANGLE, $tag_styles)) {
       $pattern = '#(<)('. $tags_string .')((\s+[^>]*)*)(>)(.*?)(</\2\s*>|$)#s';
-      break;
-    case GESHIFILTER_BRACKETS_SQUARE:
-      $pattern = '#(\[)('. $tags_string .')((\s+[^\]]*)*)(\])(.*?)(\[/\2\s*\]|$)#s';
-      break;
-    case GESHIFILTER_BRACKETS_BOTH:
-      $pattern = '#([<\[])('. $tags_string .')((\s+[^>\]]*)*)([>\]])(.*?)(\1/\2\s*\5|$)#s';
-      break;
+    $text = preg_replace_callback($pattern, create_function('$match', "return _geshifilter_prepare_callback(\$match, $format);"), $text);
   }
-  // replace the code container tag brackets
-  // and prepare the container content (newline and angle bracket protection)
+  if (in_array(GESHIFILTER_BRACKETS_SQUARE, $tag_styles)) {
+    $pattern = '#((?<!\[)\[)('. $tags_string .')((\s+[^\]]*)*)(\](?!\[))(.*?)((?<!\[)\[/\2\s*\](?<!\[)|$)#s';
   $text = preg_replace_callback($pattern, create_function('$match', "return _geshifilter_prepare_callback(\$match, $format);"), $text);
+  }
+  if (in_array(GESHIFILTER_BRACKETS_DOUBLESQUARE, $tag_styles)) {
+    $pattern = '#(\[\[)('. $tags_string .')((\s+[^\]]*)*)(\]\])(.*?)(\[\[/\2\s*\]\]|$)#s';
+    $text = preg_replace_callback($pattern, create_function('$match', "return _geshifilter_prepare_callback(\$match, $format);"), $text);
+  }
+  // Prepare < ?php ... ? > blocks.
   if (_geshifilter_php_delimeters($format)) {
-    // prepare < ?php ... ? > blocks
     $text = preg_replace_callback('#[\[<](\?php|\?PHP|%)(.+?)((\?|%)[\]>]|$)#s', '_geshifilter_prepare_php_callback', $text);
   }
   return $text;
