So, I've never been familiar with the 'trim' (trim_wspace in the database) parameter of bbcodes.
The Noisen codebase automatically trims whitespace before and after quotes, because I hate it when people don't insert any whitespace and we end up with quotes touching the rest of the text, so I trimmed everything out and added extra margins to compensate.
Now, with Wedge I didn't add this code because I'm trying to stay away from 'hacks'... After discussing with Pete, it seemed like the obvious answer was to change the trim_wspace value of quote tags from 'none' to 'outside' (meaning, 'trim any whitespace outside the tag').
So, I did that... And it still didn't work. Which brings us to 2 bugs.
1/
I managed to find out that whitespace was just ignored, because Aeva Embedding is active, which adds noae tags around quotes right when they're being processed. So it will see another tag around it, and will consider there are no extra spaces, which is wrong. Possible fixes:
a) account for being possibly there in the regex. This is what I'm doing for now. It seems to be working just fine, but I'm a bit worried it might make the regex slower. So, I added a ^ right before the noae test, so that it only does once, and ignores it if it fails. This should now make the regex actually faster than in SMF... Much faster, even, because it looks like the SMF code is actually looking for the entire rest of the string...?! Heck, this can't be possible, because that would be an awful bug. I just realized I'm not that well versed into BBC parsing these days. Used to be... But I forgot most of it.
b) Right when adding the noae tags, do the trimming at this instant. Because we know that a quote has to be trimmed, we can do that. However, if an admin decides that they don't want trimming, it'll still occur even if disabled in the BBC DB table... Hmm.
2/
Okay, I checked and double-checked, and can't seem to find the code that will trim outside spaces BEFORE the quote... There are two such tests, but it seems they both account for whitespace AFTER the tag... WTF?! If that's the case, then isn't it a bug, too...?
Also, I figured that it would also make sense to apply outside trimming to other 'special' block tags like code, and possibly media. What do you reckon[1]?
The Noisen codebase automatically trims whitespace before and after quotes, because I hate it when people don't insert any whitespace and we end up with quotes touching the rest of the text, so I trimmed everything out and added extra margins to compensate.
Now, with Wedge I didn't add this code because I'm trying to stay away from 'hacks'... After discussing with Pete, it seemed like the obvious answer was to change the trim_wspace value of quote tags from 'none' to 'outside' (meaning, 'trim any whitespace outside the tag').
So, I did that... And it still didn't work. Which brings us to 2 bugs.
1/
I managed to find out that whitespace was just ignored, because Aeva Embedding is active, which adds noae tags around quotes right when they're being processed. So it will see another tag around it, and will consider there are no extra spaces, which is wrong. Possible fixes:
a) account for being possibly there in the regex. This is what I'm doing for now. It seems to be working just fine, but I'm a bit worried it might make the regex slower. So, I added a ^ right before the noae test, so that it only does once, and ignores it if it fails. This should now make the regex actually faster than in SMF... Much faster, even, because it looks like the SMF code is actually looking for the entire rest of the string...?! Heck, this can't be possible, because that would be an awful bug. I just realized I'm not that well versed into BBC parsing these days. Used to be... But I forgot most of it.
b) Right when adding the noae tags, do the trimming at this instant. Because we know that a quote has to be trimmed, we can do that. However, if an admin decides that they don't want trimming, it'll still occur even if disabled in the BBC DB table... Hmm.
2/
Okay, I checked and double-checked, and can't seem to find the code that will trim outside spaces BEFORE the quote... There are two such tests, but it seems they both account for whitespace AFTER the tag... WTF?! If that's the case, then isn't it a bug, too...?
Also, I figured that it would also make sense to apply outside trimming to other 'special' block tags like code, and possibly media. What do you reckon[1]?
1. | I love this word. It's close to the French for "recognize", meaning that for years I misunderstood it... I think the first time I realized my mistake was when watching a Harry Potter movie with French subtitles and being surprised at the translation for the word. |