-
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
Question: Best way to handle a [raw][/raw]
shortcode?
#31
Comments
Use |
So it should be this:
??? That inner stuff is not processed at all? |
There are several possible solutions:
I really hope to get that events subsystem done in the near future as it's definitely the way to go here. You may of course ask "why don't you just have |
Hmm, I appreciate your thoughts and solutions, but I don't agree. I really think that having a method in the library to specifically not process shortcodes is a better solution IMHO. It's like a shortcode needs to be there per say, but a method making it simple for users of the lbrary to create a shortcode such as All your solutions really feel like workarounds that complicate things and really this is something that every shortcode library should be able to do without much work. |
I also appreciate the whole discussion we have over all the reported issues. Let me just speak my mind below, I need some time to think about all possible ways of solving that. My position on this topic is that not processing shortcode is just one of the ways of processing them, that's why you won't find anything directly related to implementing usual BTW I'm sorry, I didn't see the code you posted above - yes, |
Yes, I tested it and it does continue to process the shortcodes in between the I don't think you should include any default shortcodes in the library, and that goes also for I just feel this is something that would make the library more useful and simpler to use, and isn't that the point of a library such as this in the first place? :) I just know from real-world experience there will definitely be situations where the parsers are going to choke, and probably on stuff that is not related to shortcodes at all (for example this JS code that triggered this whole thing). I just feel there needs to be some mechanism in place to skip problematic content, and it needs to be something that doesn't require a huge amount of jumping through hoops. Your library is really nice, but without this, it's going to be very risky to actually use it in a CMS where you can't say for certain that every bit of content is going to be shortcode-safe. Having a mechanism to disable processing for a bit of troublesome content is a solution everyone is familiar with: eg: https://css-tricks.com/snippets/wordpress/disable-automatic-formatting-using-a-shortcode/ |
@rhukster I just merged the events subsystem PR #32. You asked about the example how to use those events, I think the test for In the meantime I worked on the better documentation in README, it's available in a Gist. Could you please read it and give me some insights - whether it is understandable, maybe some parts should be expanded, maybe something needs better explanation, and so on? BTW Before tagging |
@rhukster Have you had the chance to review those changes? BTW If those changes solved your problem, can you say so in comments, close this issue and open new one for new discussions? |
Ah sorry, not had chance to review/test the events handler yet. i have been refactoring some other area of Grav over the weekend that i discovered had some bugs (after writing some in depth unit tests!). I should finish up my other work this morning, and ill test the events this afternoon. Thanks! |
Ok, had chance to test this, and yes it does work fine now! My raw handler function looks like this:
So pretty clean and works great! Thanks. |
I'm trying to find the best way to write a
[raw][/raw]
shortcode that stops the Shortcode library from processing anything between these raw tags. My current implementation fakes it by taking setting the 'text' back to the original unmodified text. However, this doesn't stop Shortcode from processing that inner stuff first.This raised it's head when I ran into the
[0]
bug in some javascript example code on my page. While a fix was quickly found, a situation could come up where a fix is impossible or not practical. Turning off shortcodes processing in parts of a page is therefore an important function to have. What is the better way of doing this?Cheers!
The text was updated successfully, but these errors were encountered: