-
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
69 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the Latte (https://latte.nette.org) | ||
* Copyright (c) 2008 David Grudl (https://davidgrudl.com) | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Latte\Compiler\Nodes; | ||
|
||
use Latte\Compiler\PrintContext; | ||
|
||
|
||
class UrlNode extends AreaNode | ||
{ | ||
public function __construct( | ||
public AreaNode $value, | ||
) { | ||
$this->position = $value->position; | ||
} | ||
|
||
|
||
public function print(PrintContext $context): string | ||
{ | ||
$escaper = $context->beginEscape(); | ||
$escaper->enterSubType($escaper::Url); | ||
$res = ''; | ||
if ($this->value instanceof FragmentNode) { | ||
foreach ($this->value->children as $child) { | ||
$res .= $child->print($context); | ||
$escaper->enterSubType(''); | ||
} | ||
} else { | ||
$res .= $this->value->print($context); | ||
} | ||
$context->restoreEscape(); | ||
return $res; | ||
} | ||
|
||
|
||
public function &getIterator(): \Generator | ||
{ | ||
yield $this->value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters