n:macro always behaving as “inner”

Notice: This thread is very old.
amik
Member | 118
+
+1
-

Hi, is it possible to write an n:macro always wrapping inner content of the element like this?

<div class="foo bar" n:upper>
	upper
</div>

should compile into

<div class="foo bar">
	<?php ob_start(); ?>
	upper
	<?php echo strtoupper(ob_get_clean()); ?>
</div>

I don't want to write n:inner-upper always, and I don't want to allow tag- and default variants.

Note: I'm not really building a macro for uppering content, I'm building a macro to replace element's inner content with user-editable content, I've written this example just to simply explain stuff.

Last edited by amik (2015-10-05 14:55)

David Grudl
Nette Core | 8082
+
0
-

Currently it is not possible. n:snippet works this way, but it is done as hack.

amik
Member | 118
+
+1
-

@DavidGrudl would it be useful if I implement and pullrequest it, or it is not possible intentionally?

David Grudl
Nette Core | 8082
+
+1
-

Yes, it would be useful.

amik
Member | 118
+
0
-

OK, my proposed solution: https://github.com/…atte/pull/85