/** * Handles the current line in the given parser. * * This is used instead of the parser appending to the tree itself in order to deal with * potential multiline statements. */ public static function handle() { if (!static::$filter_namespace) { static::$filter_namespace = Library::namespace_from_class(get_class(static::$parser)) . '\\filters'; } if (static::$parser->context_locked() === false) { $node = nodes\Filter::new_from_parser(static::$parser); $node->filter = static::$filter_namespace . '\\' . Library::class_name_from_file_name(substr($node->content, 1) . '.php'); if (!class_exists($node->filter)) { $node->exception("Load Error: could not load filter {$node->content}"); } $node->content = array(); static::$indent_level = static::$parser->indent_level(); static::$parser->lock_context(); } else { $indent_level = static::$parser->indent_level() - static::$indent_level - 1; $indent = str_repeat(static::$parser->indent_string(), $indent_level < 0 ? 0 : $indent_level); static::$parser->context()->last_child()->content[] = $indent . static::$parser->content(); } static::$parser->force_handler(get_called_class()); }
<?php namespace phphaml\test; use Exception, StdClass, phphaml\haml\Parser; require '../library.php'; require 'diff.php'; \phphaml\Library::autoload(); $options = array('4' => array('format' => 'xhtml')); $tpl_header = <<<'END' <div class="heading"> <span class="success">%1$d</span> / <span class="failure">%2$d</span> ( <span class="percent">%3$d%</span> ) </div> END; $tpl_container = <<<'END' <h4 class="test_heading %1$s" onclick="toggle(test_%2$d);">%2$d) %3$s (%4$s) %5$s</h4> <div class="container %1$s" id="test_%2$d"> %6$s %7$s </div> END; $tpl_test = <<<'END' <div class="left"> <pre>%1$s</pre> </div> <div class="right">