baryshev / ect

Fastest JavaScript template engine with embedded CoffeeScript syntax

Home Page:http://ectjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Code inside of comments is evaluated if within opening and closing tags

paulyoung opened this issue · comments

I'm attempting to document some functions using Codo and my example code within comments is being evaluated.

The following is the beginning of a file called _partials/helpers.html which is a partial that I include elsewhere.

{{
  # Create an alias.
  #
  # @example Create a selector alias for a single element.
  #
  #   <!-- template.html -->
  #   {{ sectionId = @createAlias 'section' }}
  #   <section id="{{-sectionId}}"></section>

This causes the following: Fatal error: sectionId is not defined in helpers on line 8

This is just one example that could be generalized in a test as:

{{
  # {{- foo }}
}}

Obviously, I'm using {{ and }} for opening and closing tags.

My current workaround is this:

{{
  # Create an alias.
  #
  # @example Create a selector alias for a single element.
  #
  #   <!-- template.html -->
  #   <% sectionId = @createAlias 'section' %>
  #   <section id="<%- sectionId %>"></section>