-
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
Method getParameter returns value with quotes #76
Comments
Hi @drmzio, you're using I recommend you to try the latest library version |
@drmzio By the way, I tested all parsers with the latest version of the library using PHP 7.2, and none of them result in the reported behavior. Could you please tell me what is the output of this code in your environment? <?php
declare(strict_types=1);
namespace X;
use Thunder\Shortcode\HandlerContainer\HandlerContainer;
use Thunder\Shortcode\Parser\RegexParser;
use Thunder\Shortcode\Parser\RegularParser;
use Thunder\Shortcode\Parser\WordpressParser;
use Thunder\Shortcode\Processor\Processor;
use Thunder\Shortcode\Shortcode\ShortcodeInterface;
require __DIR__.'/vendor/autoload.php';
$handlers = new HandlerContainer();
$handlers->add('hello', function (ShortcodeInterface $s) {
return sprintf('Hello, %s', $s->getParameter('name'));
});
$input = '[hello name="Daniel"] [hello name=John]';
echo (new Processor(new RegexParser(), $handlers))->process($input)."\n";
echo (new Processor(new RegularParser(), $handlers))->process($input)."\n";
echo (new Processor(new WordpressParser(), $handlers))->process($input)."\n"; |
@thunderer Trying out the code above outputs: Hello, Daniel Hello, John
Hello, Daniel Hello, John
Hello, Daniel Hello, John So after further inspection, found out that the Markdown editor was the one escaping quotes. Since this issue isn't related to Shortcode itself, I'm closing this. Thanks for the help! |
No problem, I'm happy that it works for you, @drmzio! |
Parameter values using double quotes get passed back with double quotes when using
getParameter
. Maybe there's a way to modify this configuration to strip double quotes?Environment
This example shows two of the same shortcodes: one with double quotes for the parameter value and one without.
The text was updated successfully, but these errors were encountered: