1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (https://nette.org)
5: * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
6: * @package Nette\Latte
7: */
8:
9:
10:
11: /**
12: * Macro element node.
13: *
14: * @author David Grudl
15: * @package Nette\Latte
16: */
17: class NMacroNode extends NObject
18: {
19: const PREFIX_INNER = 'inner',
20: PREFIX_TAG = 'tag';
21:
22: /** @var IMacro */
23: public $macro;
24:
25: /** @var string */
26: public $name;
27:
28: /** @var bool */
29: public $isEmpty = FALSE;
30:
31: /** @var string raw arguments */
32: public $args;
33:
34: /** @var string raw modifier */
35: public $modifiers;
36:
37: /** @var bool */
38: public $closing = FALSE;
39:
40: /** @var NMacroTokenizer */
41: public $tokenizer;
42:
43: /** @var NMacroNode */
44: public $parentNode;
45:
46: /** @var string */
47: public $openingCode;
48:
49: /** @var string */
50: public $closingCode;
51:
52: /** @var string */
53: public $attrCode;
54:
55: /** @var string */
56: public $content;
57:
58: /** @var \stdClass user data */
59: public $data;
60:
61: /** @var NHtmlNode for n:attr macros */
62: public $htmlNode;
63:
64: /** @var string for n:attr macros (NULL, PREFIX_INNER, PREFIX_TAG) */
65: public $prefix;
66:
67: public $saved;
68:
69:
70: public function __construct(IMacro $macro, $name, $args = NULL, $modifiers = NULL, NMacroNode $parentNode = NULL, NHtmlNode $htmlNode = NULL, $prefix = NULL)
71: {
72: $this->macro = $macro;
73: $this->name = (string) $name;
74: $this->modifiers = (string) $modifiers;
75: $this->parentNode = $parentNode;
76: $this->htmlNode = $htmlNode;
77: $this->prefix = $prefix;
78: $this->tokenizer = new NMacroTokenizer($this->args);
79: $this->data = new stdClass;
80: $this->setArgs($args);
81: }
82:
83:
84: public function setArgs($args)
85: {
86: $this->args = (string) $args;
87: $this->tokenizer->tokenize($this->args);
88: }
89:
90: }
91: