Added an output filter to remove blank lines from generated HTML
This commit is contained in:
@@ -74,6 +74,7 @@ class SmartyParser extends Smarty implements ParserInterface
|
|||||||
$this->status = 200;
|
$this->status = 200;
|
||||||
|
|
||||||
$this->registerFilter('pre', array($this, "preThelia"));
|
$this->registerFilter('pre', array($this, "preThelia"));
|
||||||
|
$this->registerFilter('output', array($this, "removeBlankLines"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function preThelia($tpl_source, \Smarty_Internal_Template $template)
|
public function preThelia($tpl_source, \Smarty_Internal_Template $template)
|
||||||
@@ -84,6 +85,11 @@ class SmartyParser extends Smarty implements ParserInterface
|
|||||||
return $new_source;
|
return $new_source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function removeBlankLines($tpl_source, \Smarty_Internal_Template $template)
|
||||||
|
{
|
||||||
|
return preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $tpl_source);
|
||||||
|
}
|
||||||
|
|
||||||
public function setTemplate($template_path_from_template_base)
|
public function setTemplate($template_path_from_template_base)
|
||||||
{
|
{
|
||||||
$this->template = $template_path_from_template_base;
|
$this->template = $template_path_from_template_base;
|
||||||
|
|||||||
Reference in New Issue
Block a user