Custom Macros and HAML filter not working together

Notice: This thread is very old.
Elfoslav
Member | 15
+
0
-

Hi, I want to use HAML filter and custom macros.
I have installed custom macro “id” https://latte.nette.org/en/develop#… and it worked.
Then I added HAML filter https://componette.org/search/?… and added HAML tag in my latte file but this exception has been thrown:

Nette\Latte\CompileException

Unknown macro-attribute n:id

I have tried it in sandbox 2.0.10 and 2.1

Where is the catch?

enumag
Member | 2118
+
0
-

Does the macro n:id work for you without HAML filter?

Elfoslav
Member | 15
+
0
-

Yes, when I comment templatePrepareFilters and delete cache, the macro n:id works.

abstract class BasePresenter extends Nette\Application\UI\Presenter
{
	//public function templatePrepareFilters($template)
	//{
	//	$template->registerFilter(new Nette\Templating\Filters\Haml);
	//	$template->registerFilter(new Nette\Latte\Engine);
	//}
}
enumag
Member | 2118
+
0
-

Try this.

abstract class BasePresenter extends Nette\Application\UI\Presenter
{
	public function templatePrepareFilters($template)
	{
		$template->registerFilter(new Nette\Templating\Filters\Haml);
		$template->registerFilter($this->context->createNette__latte());
	}
}
Elfoslav
Member | 15
+
0
-

Many many thanks

This also works:

abstract class BasePresenter extends Nette\Application\UI\Presenter
{
	public function templatePrepareFilters($template)
    {
		$template->registerFilter(new Nette\Templating\Filters\Haml);
		parent::templatePrepareFilters($template);
    }
}
enumag
Member | 2118
+
0
-

Yeah, your solution is better. :-)