Skip to content
This repository has been archived by the owner on Jun 22, 2021. It is now read-only.

iNamik/iNamik-Template-Engine

Repository files navigation

iNamik Template Engine

Template Engine in Java

FEATURES

  • Style

    The templating style is similar to PHP's Smarty Templates.

    The Engine supports the following tag identifiers:

    • Single-Brace (smarty default):

      { $foo }

    • Double-Brace (javascript friendly):

      {{ $foo }}

    • Angle-Percent (asp-like):

      <% $foo %>

  • Suitable for rending any textual content

    • XML
    • HTML
    • Plain Text
  • Encourages well-formatted templates

    • Works very hard to remove extra whitespace introduced by template tags

    • When consistent indentation is used, it is preserved

      For example, this template snippet

      {* indentations due to well-formatted block tags will be removed *}
      {capture id='body'}
      	{set $list=['one', 'two', 'three']}
      	{foreach id=item in=$list loop=loop}
      		{if $loop.first}
      			# Start List
      		{/if}
      			{* This tab preserved *}
      			[{$loop.iteration}] {$item}
      		{if $loop.last}
      			# End List
      		{/if}
      	{/}
      {/capture}
      {$body}
      

      Renders this well-formatted output

      # Start List
      	[1] one
      	[2] two
      	[3] three
      # End List
      
  • Caching

    The Engine supports EHCache hi-performance cache for storage of tokenized templates.

    If you decide not to use the EHCache, the Engine will employ a temporary cache using a hashtable of weak references. This is used to ensure that included templates are only tokenized once when processing the main template.

  • Macros

    You can capture a template (or portion of) in tokenized form and render it multiple times.

      {macro id='macro'}
      	Hello, {$name}
      {/macro}
      {set name='foo'}
      {$macro}
      {set name='bar'}
      {$macro}
    

LEARN MORE

REQUIREMENTS

  • Jars needed to build & run the Engine

    • Activation (1.1.1)

    • ANTLR (2.7.7)

    • Commons BeanUtils (1.8.3) Collections

    • Commons Beanutils (1.8.3) Core

    • Commons Logging (1.1.1)

    • EHCache (2.2.0) Core

    • JAXB API (2.2.1 20100511)

    • JAXB IMPL (2.2.1 20100511)

      NOTE: When building from source, these jars should be placed into a folder named

      / path / to / distribution / lib /

  • Jars needed just for building

    • JAXB XJC (2.2.1 20100511)

      NOTE: When building from source, this jar should be placed into a folder named

      / path / to / distribution / lib-build /

DOWNLOAD

AUTHORS

  • David Farrell

Releases

No releases published

Packages

No packages published

Languages