-
Notifications
You must be signed in to change notification settings - Fork 20
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
Returns wrong shortcode content #25
Comments
Hi @dimayakovlev, I created the Shortcode library used here in Grav. From my initial investigation, it turns out that it's indeed an issue, but only when you're using I'd appreciate if you could create an issue in my repository so that I can check if it's a limitation or an actual bug that can be solved. Meanwhile, @rhukster, could you please change default parser configuration value to |
hey @thunderer, thanks for the comment. I'm sure you remember I posted some performance issues on your repo a while back. I found the I know the |
@dimayakovlev I identified the issue as an incompatibility with WordPress inside @rhukster I remember the excellent discussion we had in thunderer/Shortcode#27 and other issues. Did you evaluate |
@thunderer thank you for your work! |
I updated to I tried the Interestingly I have a couple of broken shortcodes when I use Thanks! |
Ok this is weird, i'm not sure what's happening.. I have this code for fontawesome shortcode:
And these examples:
With |
Hi @rhukster, thanks for additional test data, can you share your test document so that I can run my own benchmark against it? It would greatly help me investigate these performance drops. I already have some assumptions about what is going on under the PHP's hood, but I need to verify them. As for the invalid Again, your examples greatly help me find and solve all the problems with Shortcode. I am very thankful for the amount of the information I get from you. |
Thanks @thunderer, I tested with your PR and it works fine with the syntax I have above. Now regarding the test cases.. It's a little tricky because everything i'm doing is based on a couple of plugins that we have for Grav which extend your core Shortcode library. The simplest way is to setup a Grav instance (just Apache + PHP) - MAMP will do. https://github.com/getgrav/grav/releases/download/1.1.9/grav-v1.1.9.zip Then turn off caching (to get a better idea of how the processing is working) in Then install
Once you have that, you can replace the core This contains my sample page with some images. This page uses most of the shortcodes defined in core and ui plugins. it's really easier than it sounds! :) |
BTW, if you have any questions or issues, ping me and i can walk you through getting it up and running in a few mins. |
Hi @rhukster, I merged thunderer/Shortcode#44 and released Thanks for the ZIP archive, I extracted the <?php
declare(strict_types=1);
namespace X;
use Thunder\Shortcode\EventContainer\EventContainer;
use Thunder\Shortcode\HandlerContainer\HandlerContainer;
use Thunder\Shortcode\Parser\RegexParser;
use Thunder\Shortcode\Parser\RegularParser;
use Thunder\Shortcode\Processor\Processor;
require __DIR__.'/vendor/autoload.php';
$text = file_get_contents(__DIR__.'/default.md');
$handlers = new HandlerContainer();
$events = new EventContainer();
$time = microtime(true);
$processor = new Processor(new RegexParser(), $handlers);
$processor = $processor->withEventContainer($events);
$processor->process($text);
echo ((microtime(true) - $time) * 1000).'ms'."\n";
$time = microtime(true);
$processor = new Processor(new RegularParser(), $handlers);
$processor = $processor->withEventContainer($events);
$processor->process($text);
echo ((microtime(true) - $time) * 1000).'ms'."\n"; |
Nice! I'll check this out shortly. |
@thunderer I just tested with shortcode 0.6.5, and that |
@rhukster that's strange, I have a test for that and the only parser that does not support such syntax is |
Yes, its this code i pasted above: #25 (comment) |
@rhukster please use |
Done, and released. Thanks. |
If shortcode content is
0
(zero), then$sc->getContent();
returnNULL
.The text was updated successfully, but these errors were encountered: