identifyUl override not working
soullivaneuh opened this issue · comments
Sullivan S. commented
I am implementing on option for Slack support on my own parser.
Slack does not support lists and tables, so I override related identify*(
methods to just return false
for ol
, ul
, and table
:
class MarkdownParser extends GithubMarkdown implements MarkdownParserInterface
{
protected $slack = true;
protected function identifyOl($line)
{
if (true === $this->slack) {
return false;
}
return parent::identifyOl($line);
}
protected function identifyUl($line)
{
if (true === $this->slack) {
return false;
}
return parent::identifyUl($line);
}
protected function identifyTable($line, $lines, $current)
{
if (true === $this->slack) {
return false;
}
return parent::identifyTable($line, $lines, $current);
}
}
This works great for ol
and table
which are not converted, but ul
is still identified and converted.
Carsten Brandt commented
this is because the function name is changed when importing the trait:
Line 25 in e449935
You have to override identifyBUl
instead.
Sullivan S. commented
Actually, you have to override both of them:
/**
* {@inheritdoc}
*/
protected function identifyUl($line)
{
if (true === $this->slack) {
return false;
}
return parent::identifyUl($line);
}
/**
* {@inheritdoc}
*/
protected function identifyBUl($line)
{
if (true === $this->slack) {
return false;
}
return parent::identifyBUl($line);
}
Thanks for your help.