-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Underscores in tag names not matched #35
Comments
Hi, I recently fixed inconsistent behavior between |
Just to clarify - I can add support for underscores back in |
Sorry, my mistake, the wordpress parser was failing on something else to do with the body of text I was processing.. When I took it out to a simple string the WordpressParser does work correctly. So, would be nice eventually to have underscore support in the main parser, but for now I can use the Wordpress parser. thanks |
Can you tell me what was the problem? Is it something I can fix on my side? I took a note to add the underscore BTW In general you should use |
@thunderer no, it was my fault, I think it was caused by the shortcode being right next to a CDATA section which came from the WXR file, once I pulled it out as plain text properly the Wordpress parser picked it up. Because the underscore wasn't picked up on the standard parser I had assumed it was the same problem but it wasn't. |
Yeah, XML may be conflicting with shortcode syntax as I think I may get what is going on here. WordPress' regex catches only shortcodes with registered handlers, not the generic name pattern. To do that it gets the names from the global |
I added optional |
Sorry, my previous comment was too hasty, I changed the constructor to named constructors |
@rossriley Underscores are back in the allowed characters in 5265cb5 (I hope to tag release soon), I also standardized their validation so that they will be changed simultaneously in the future to avoid accidental differences. Would you like me to do anything more or can this issue be closed? Yes, I know that I reopened it, but still, thanks for letting me know. :) |
@thunderer No, that's great. Thanks for doing that so quickly. |
Wasn't sure if this was a deliberate decision but in parsing tags containing underscores aren't matched.
eg:
[testtag]
works but[test_tag]
does not.Both the regular parser here:
https://github.com/thunderer/Shortcode/blob/master/src/Parser/RegularParser.php#L81
and the Wordpress parser here:
https://github.com/thunderer/Shortcode/blob/master/src/Parser/WordpressParser.php#L27
use a slightly different match syntax but neither contain the
_
character.Reason I ask is because I'm trying to use this library to make a content importer from Wordpress and Wordpress does seem to parse them correctly.
The text was updated successfully, but these errors were encountered: