Open dzpt opened 7 years ago
Yes, because 'http://google.com'
isn't a valid url.
You can build a custom InputValidator
based on the internal one that removes the '
characters.
Then create a new url definition and add it to the parser:
$urlValidator = new \My\Own\UrlValidator();
/* [url] link tag */
$builder = new \JBBCode\CodeDefinitionBuilder('url', '<a href="{param}">{param}</a>');
$builder->setParseContent(false)->setBodyValidator($urlValidator);
// Place the CodeDefinition into the parser
$parser->addCodeDefinition($builder->build());
I've tried your way but didn't work.
Actually, it recognize 'http://google.com'
as URL, then the link becomes http://domain.com/'http://google.com'
, validation rules doesn't help to strip quote and return correct value? 'http://google.com'
-> http://google.com
validation rules doesn't help to strip quote and return correct value?
Sorry, you are right. You have to build a custom CodeDefinition
It works with url bbcode like :
[url=http://google.com]abc[/url]
But failed to work with[url='http://google.com']abc[/url]