Skip to content

Commit

Permalink
Texts now only strip the first whitespace, everything else will be pr…
Browse files Browse the repository at this point in the history
…eserved
  • Loading branch information
Torben Köhn committed May 20, 2016
1 parent f8e765f commit 6097a6f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Lexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -947,9 +947,9 @@ protected function scanNewLine()
protected function scanText($escaped = false)
{

foreach ($this->scanToken('text', "([^\n]*)?") as $token) {
foreach ($this->scanToken('text', "[ ]?([^\n]*)?") as $token) {

$value = trim($this->getMatch(1));
$value = trim($this->getMatch(1), "\t");

$token['value'] = $value;
$token['escaped'] = $escaped;
Expand Down
5 changes: 5 additions & 0 deletions Test/IssueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,10 @@ public function testIssue88()
$this->assertEquals('<some-tag></some-tag><some-other-tag></some-other-tag>', $this->renderer->compile("some-tag\t\nsome-other-tag"));
$this->assertEquals('<some-tag></some-tag><some-other-tag></some-other-tag>', $this->renderer->compile("some-tag \nsome-other-tag"));
$this->assertEquals('<some-tag></some-tag><some-other-tag></some-other-tag>', $this->renderer->compile("some-tag \t \nsome-other-tag"));

$this->assertEquals('<i class="fa fa-fw fa-gear">Some text</i>', $this->renderer->compile('i.fa.fa-fw.fa-gear Some text'));
$this->assertEquals('<i class="fa fa-fw fa-gear"> Some text</i>', $this->renderer->compile('i.fa.fa-fw.fa-gear Some text'));
$this->assertEquals('<i class="fa fa-fw fa-gear">Some text</i>', $this->renderer->compile("i.fa.fa-fw.fa-gear\n\t| Some text"));
$this->assertEquals('<i class="fa fa-fw fa-gear"> Some text</i>', $this->renderer->compile("i.fa.fa-fw.fa-gear\n\t| Some text"));
}
}

0 comments on commit 6097a6f

Please sign in to comment.