So I'm trying to add spoiler support in Wakaba, and I'm having a lot of trouble that I think is stemming from regex. I'm new to perl, so this is a bit hard for me. I'm adding the following to sub do_wakabamark($;$$) to accomplish this:
>>135-141
So I FINALLY got spoilers working properly. I don't remember who told me, but the only way to get this to work without completely rewriting wakabamark was to hold off on the spoiler function until AFTER all wakabamark related things were completed. Anyways, I went ahead and put my code right after:
>>7
I use Kareha so it is probably not useful to me, but I am thankful that you came back to share the code with other Wakaba users.
Don't fucking parse BBCode with regex!
I actually wasn't aware that this was doing this until I read this post. After changing some code around (thanks to your example) I have fixed the problem with my bbcodes that I didn't even know was a problem until now.
>>9
It's just one BBCode tag and it creates SPAN tags. You should take your meme-spewing elsewhere.
Bump, hopefully someone has gotten spoiler tags in Kareha.
I found a 2006 post:
# do <span class="spoiler">
$line=~s{ (?<![0-9a-zA-Z\*_\x80-\x9f\xe0-\xfc]) (~~) (?![<>\s\*_]) ([^<>]+?) (?<![<>\s\*_\x80-\x9f\xe0-\xfc]) \1 (?![0-9a-zA-Z\*_]) }{<span class="spoiler">$2</span>}gx;
Please, use %%spoiler%% instead of BB-like tags.
Percent symbols feel better.
>>14
But then how would you do nested spoilers? They are fun.
Now you have two problems.