Hello. Thanks for the great module! I'm in the process of migrating our SMF forum over to Drupal / Advanced Forum, and needed this filter. I'm starting to add additional tags, and the spoiler tag is the first one I thought I'd put in as it's used a lot on our site :)

Comments

torgospizza’s picture

StatusFileSize
new7.04 KB

Attached is a patch that adds the pattern and replacement for [spoiler][/spoiler]. All it does right now is wrap it in a div - it might be good to create an additional CSS class (and a relevant patch) to set the background-color and font color to be all black by default, just so that spoilers appear hidden out of the box. (Alternatively we could do some kind of jQuery.toggle, which might be better for most cases.)

(Note: It looks like this patch also addresses some whitespace issues, which wasn't my intent; but if you examine it you'll see that all of the additional changes are that and nothing more; the line being added is the same as the line being deleted.)

As an FYI, my addition is on lines 73-75 of the patch:

+    // Spoiler tags
+    '#\[spoiler(?::\w+)?\]#'                                   => '<div class="bb-spoiler">',
+    '#\[/spoiler(?::\w+)?\]#si'                                => '</div>',
StudioARE’s picture

I'm just using the spoiler module :)

http://drupal.org/project/spoiler

torgospizza’s picture

I found that too, but didn't want to install yet another module when the change only requires a few more lines of code. I've also found the spoiler module doesn't work in all instances (my patch probably doesn't either)... so it probably could use some work :)

Wooster’s picture

Status: Needs review » Patch (to be ported)
StatusFileSize
new19.65 KB

I'm sorry that I don't know how to use the patch file format. But I've created working spoiler tags that hide stuff.

I've marked anywhere I've edited anything with:

// Wooster

There are three of them, and all correspond to where the 'quote' tag lies.

You may be picky about my div classes and format, but I've provided the difficult part, and it suits my needs.