Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/onionhammer/nim-templates
A simple string templating library for Nim
https://github.com/onionhammer/nim-templates
css html nim template
Last synced: 2 months ago
JSON representation
A simple string templating library for Nim
- Host: GitHub
- URL: https://github.com/onionhammer/nim-templates
- Owner: onionhammer
- License: bsd-3-clause
- Created: 2014-05-25T23:07:53.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2019-10-20T14:42:58.000Z (over 5 years ago)
- Last Synced: 2024-10-29T03:32:21.067Z (3 months ago)
- Topics: css, html, nim, template
- Language: Nim
- Homepage:
- Size: 23.4 KB
- Stars: 93
- Watchers: 3
- Forks: 9
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nim - templates - A simple string templating library for Nim. (Web / Template Engines)
README
nim-templates
=============A simple string templating library for Nim
Usage
-----
Import the 'templates' library at the top of your nim module, and use the syntax:```nim
import templatesproc testPage (name: string): string = tmpli html"""
Hello $name!
"""echo testPage("Charlie")
```Syntax
------
The templates syntax supports $for and $while loops, $if/$elif/$else, multi-line statements, $case statements, procedure calls, etc. Look at the tests.nim file for more examples.Supported Syntaxes
------------------
Realistically any well-structured syntax can be used as a template, but the NimLime SublimeText plugin supports syntax highlighting for the following template types;- HTML / XML
- CSS
- Javascript
- GLSL
- RST
- MarkdownThese can be invoked as follows:
```nim
tmpli xml""" ... """
tmpli css""" ... """
# etc
```