class CoreMacros extends MacroSet

Basic macros for Latte.

  • {if ?} ... {elseif ?} ... {else} ... {/if}
  • {ifset ?} ... {elseifset ?} ... {/ifset}
  • {for ?} ... {/for}
  • {foreach ?} ... {/foreach}
  • {$variable} with escaping
  • {=expression} echo with escaping
  • {php expression} evaluate PHP statement
  • {_expression} echo translation with escaping
  • {capture ?} ... {/capture} capture block to parameter
  • {spaceless} ... {/spaceless} compress whitespaces
  • {var var => value} set template parameter
  • {default var => value} set default template parameter
  • {dump $var}
  • {debugbreak}
  • {contentType ...} HTTP Content-Type header
  • {l} {r} to display { }

Methods

static void
install(Compiler $compiler)

No description

void
initialize()

Initializes before template parsing.

array|null
finalize()

Finishes template parsing.

macroIf(MacroNode $node, PhpWriter $writer)

{if ...}

macroEndIf(MacroNode $node, PhpWriter $writer)

{/if ...}

macroElse(MacroNode $node, PhpWriter $writer)

{else}

macroIfContent(MacroNode $node, PhpWriter $writer)

n:ifcontent

macroEndIfContent(MacroNode $node, PhpWriter $writer)

n:ifcontent

macroTranslate(MacroNode $node, PhpWriter $writer)

{_$var |modifiers}

macroInclude(MacroNode $node, PhpWriter $writer)

{include "file" [,] [params]}

macroCapture(MacroNode $node, PhpWriter $writer)

{capture $variable}

macroCaptureEnd(MacroNode $node, PhpWriter $writer)

{/capture}

macroSpaceless(MacroNode $node, PhpWriter $writer)

{spaceless} ... {/spaceless}

macroWhile(MacroNode $node, PhpWriter $writer)

{while ...}

macroEndWhile(MacroNode $node, PhpWriter $writer)

{/while ...}

macroEndForeach(MacroNode $node, PhpWriter $writer)

{foreach ...}

macroBreakContinueIf(MacroNode $node, PhpWriter $writer)

{breakIf ...} {continueIf ...}

macroClass(MacroNode $node, PhpWriter $writer)

n:class="..."

macroAttr(MacroNode $node, PhpWriter $writer)

n:attr="..."

macroDump(MacroNode $node, PhpWriter $writer)

{dump ...}

macroDebugbreak(MacroNode $node, PhpWriter $writer)

{debugbreak ...}

macroVar(MacroNode $node, PhpWriter $writer)

{var ...} {default ...}

macroExpr(MacroNode $node, PhpWriter $writer)

{= ...} {php ...}

macroContentType(MacroNode $node, PhpWriter $writer)

{contentType ...}

Details

at line 46
static void install(Compiler $compiler)

No description

Parameters

Compiler $compiler

Return Value

void

at line 94
void initialize()

Initializes before template parsing.

Return Value

void

at line 104
array|null finalize()

Finishes template parsing.

Return Value

array|null

[prolog, epilog]

at line 125
macroIf(MacroNode $node, PhpWriter $writer)

{if ...}

Parameters

MacroNode $node
PhpWriter $writer

at line 143
macroEndIf(MacroNode $node, PhpWriter $writer)

{/if ...}

Parameters

MacroNode $node
PhpWriter $writer

at line 163
macroElse(MacroNode $node, PhpWriter $writer)

{else}

Parameters

MacroNode $node
PhpWriter $writer

at line 188
macroIfContent(MacroNode $node, PhpWriter $writer)

n:ifcontent

Parameters

MacroNode $node
PhpWriter $writer

at line 199
macroEndIfContent(MacroNode $node, PhpWriter $writer)

n:ifcontent

Parameters

MacroNode $node
PhpWriter $writer

at line 210
macroTranslate(MacroNode $node, PhpWriter $writer)

{_$var |modifiers}

Parameters

MacroNode $node
PhpWriter $writer

at line 232
macroInclude(MacroNode $node, PhpWriter $writer)

{include "file" [,] [params]}

Parameters

MacroNode $node
PhpWriter $writer

at line 255
macroCapture(MacroNode $node, PhpWriter $writer)

{capture $variable}

Parameters

MacroNode $node
PhpWriter $writer

at line 270
macroCaptureEnd(MacroNode $node, PhpWriter $writer)

{/capture}

Parameters

MacroNode $node
PhpWriter $writer

at line 282
macroSpaceless(MacroNode $node, PhpWriter $writer)

{spaceless} ... {/spaceless}

Parameters

MacroNode $node
PhpWriter $writer

at line 297
macroWhile(MacroNode $node, PhpWriter $writer)

{while ...}

Parameters

MacroNode $node
PhpWriter $writer

at line 312
macroEndWhile(MacroNode $node, PhpWriter $writer)

{/while ...}

Parameters

MacroNode $node
PhpWriter $writer

at line 327
macroEndForeach(MacroNode $node, PhpWriter $writer)

{foreach ...}

Parameters

MacroNode $node
PhpWriter $writer

at line 360
macroBreakContinueIf(MacroNode $node, PhpWriter $writer)

{breakIf ...} {continueIf ...}

Parameters

MacroNode $node
PhpWriter $writer

at line 376
macroClass(MacroNode $node, PhpWriter $writer)

n:class="..."

Parameters

MacroNode $node
PhpWriter $writer

at line 388
macroAttr(MacroNode $node, PhpWriter $writer)

n:attr="..."

Parameters

MacroNode $node
PhpWriter $writer

at line 397
macroDump(MacroNode $node, PhpWriter $writer)

{dump ...}

Parameters

MacroNode $node
PhpWriter $writer

at line 413
macroDebugbreak(MacroNode $node, PhpWriter $writer)

{debugbreak ...}

Parameters

MacroNode $node
PhpWriter $writer

at line 428
macroVar(MacroNode $node, PhpWriter $writer)

{var ...} {default ...}

Parameters

MacroNode $node
PhpWriter $writer

at line 481
macroExpr(MacroNode $node, PhpWriter $writer)

{= ...} {php ...}

Parameters

MacroNode $node
PhpWriter $writer

at line 494
macroContentType(MacroNode $node, PhpWriter $writer)

{contentType ...}

Parameters

MacroNode $node
PhpWriter $writer