summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2011-09-22 14:02:22 +0200
committerKevin Chabowski <kevin@kch42.de>2011-09-22 14:02:22 +0200
commitbc0ea34989618d8747076c322c14d0cd6af591b2 (patch)
tree3f39e78162124acc75ecf8f0226dc79aee783af8
parente503aff5ae41c16b2c0598203b1fed4082ab519d (diff)
downloadste-bc0ea34989618d8747076c322c14d0cd6af591b2.tar.gz
ste-bc0ea34989618d8747076c322c14d0cd6af591b2.tar.bz2
ste-bc0ea34989618d8747076c322c14d0cd6af591b2.zip
Newlines are now treated more XML/HTML-alike.
Newlines and following whitespaces at the beginning of a TextNode will be ignored now.
-rw-r--r--stupid_template_engine.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/stupid_template_engine.php b/stupid_template_engine.php
index c6b48bc..d36352d 100644
--- a/stupid_template_engine.php
+++ b/stupid_template_engine.php
@@ -94,7 +94,7 @@ function tokenize_text($text)
if(preg_match("/(?:(?<!\\\\)\\$)/s", $text, $match, PREG_OFFSET_CAPTURE) == 0)
{
$node = new TextNode();
- $node->text = unescape_text($text);
+ $node->text = preg_replace("/^\\n\\s*/s", "", unescape_text($text));
return (strlen($node->text) == 0) ? array() : array($node);
}