Top 1K Features Creators Events Podcasts Books Extensions Interviews Blog Explorer CSV

Embedded Crystal

< >

Embedded Crystal is a template language created in 2016.

#101on PLDB 8Years Old 287Repos
Download source code:
git clone https://github.com/crystal-lang/crystal/
Homepage · Source Code

Embedded Crystal (ECR) is a template language for embedding Crystal code into other text, that includes but is not limited to HTML. The template is read and transformed at compile time and then embedded into the binary.


Example from the web:
# greeting.ecr <%- if @name -%> Greeting, <%= @name %>! <%- else -%> Greeting! <%- end -%> Greeting.new(nil).to_s #=> Greeting!
Example from Linguist:
<% if @name %> Greeting, <%= @name %>! <% else %> Greeting! <% end %>

Language features

Feature Supported Example Token
Comments ✓ # A comment
Line Comments ✓ # A comment #
Semantic Indentation X

- Build the next great programming language · Add · Issues · About · Search · Keywords · Livestreams · Labs · Resources · Acknowledgements

Built with Scroll v154.3.0