emerald

an HTML templating engine for Nim

Project Status

This was my very first Nim project, the goal was to test the versatility of Nim's macro system. It worked quite well.

Since I never went on to actually do something with it, this is now just code I myself do not really know anymore. I also don't have the time to maintain the project, so it is unmaintained. Use at your own risk.

About

emerald is a Nim library for writing HTML 5 templates. It is implemented as a domain-specific language that can be used directly in your Nim source code via macros. Features include:

  • HTML validation : emerald validates your HTML structure when it compiles your template. This validation checks for unknown, ill-placed and missing HTML tags and attributes, but does not implement the whole HTML 5 spec. It is a tool for you to discover errors early.
  • Mixins : You can re-use parts of your template code by placing it in mixins and calling the mixin from the template. emerald is able to check the whole resulting HTML structure.
  • Filtering : By default, emerald converts special HTML characters in the content it outputs to their corresponding entities, but you can customize the whole filter chain and also write your own filters.
  • Inheritance : Templates can inherit from other templates. You can define your base structure in a master template, and add content with child templates. emerald is still able to check the whole resulting HTML structure.

To get started with emerald, have a look at the tutorial or learn it the hard way by reading the documentation.

Authors & License

emerald has been created by Felix Krause, is licensed under the Do What the Fuck You Want to Public License and can be forked on Github.

Fork me on GitHub