Closed spuxx1701 closed 1 year ago
It appears that removing the whitespace matcher \s
rom the tags
regex seems to fix the issue for me without introducing any side effects. What's the purpose of that matcher? The tags
regex would then look like this: /(\[[^\]^]+])/g
I've provided a small PR that could offer a potential fix, although i'm not entirely sure about side effects. https://github.com/nodecraft/ya-bbcode/pull/163
Thanks for the issue! What HTML would you expect that to produce?
<blockquote author="123,456,"Some User""><strong> ... </strong></blockquote>
Something like that doesn't feel like valid HTML to me. Should the quotes inside the attribute be escaped? Is that valid? What do you think? Can you add a test in the test.js
file for the expected behaviour with your PR?
In my case I needed to write a custom parser, but since ya-bbcode didn't recognize the tag in the first place, I needed to solve that first. As you can see here, I needed to parse quotes into some more complex HTML consisting of several elements (including an tag and the actual blockquote).
I think the default quote
parser is fine as is, only the \s
matcher in the regex prevented me from doing what I wanted to do with a custom parser.
Ah I see, thank you. If you could add a test to the PR so it reflects the behaviour you're expecting, that would be great.
Fixed in #163. New version will be released later today 🎉 Thank you!
Hi there!
It appears that the
tags
regex fails to recognize a tag when that tag has whitespaces within its attributes.Example:
Results in a
Array(3) [ "[b]", "[/b]", "[/quote]" ]
tags array. Replacing the whitespace with e.g. an_
fixes the behavior. I have a usecase where I'm trying to parse BBCodes quotes where the author names can contain whitespaces. I'm not the best with regexes, but maybe you would know how to fix this @Cherry? :)