[
](https://github.com/dr-montasir/cans)[
](https://crates.io/crates/cans)[
](https://docs.rs/cans)[
](https://choosealicense.com/licenses/apache-2.0)
CANS
An elegant and lightweight Rust-based literal template engine for managing web content, enhanced with a world module for streamlined regional and city information, as well as robust MIME type management.
## Table of Contents
- [Overview](#overview)
- [Changelog](#changelog)
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [Documentation](#documentation)
- [License](#license)
- [Contributing](#contributing)
- [Donations](#donations)
- [Author](#author)
## Overview
The **CANS** templating engine is an elegant and efficient solution developed in Rust, designed for developers who prioritize simplicity and type safety. This crate allows you to create dynamic web pages and applications with minimal boilerplate code, ensuring that your templates are easy to read and maintain.
While **CANS** is optimized for seamless integration with the [GetPost](https://crates.io/crates/getpost) framework, it also provides the flexibility to work with any framework or content type, making it a versatile choice for a wide range of projects.
## Changelog
[![github](https://img.shields.io/badge/github-%20changelog-8da0cb?style=for-the-badge&labelColor=555555&logo=github)](https://github.com/dr-montasir/cans/blob/main/CHANGELOG.md)
## Features
- **Simplicity**: Easy-to-read syntax that minimizes boilerplate.
- **Type Safety**: Leverages Rust's type system for safe template rendering.
- **Dynamic Content**: Supports dynamic insertion of values, loops, and conditionals.
- **Integration**: Works seamlessly with various web frameworks.
## Installation
Run the following Cargo command in your project directory:
```shell
cargo add cans
```
or add `cans` to your `Cargo.toml` file:
```toml
[dependencies]
cans = "MAJOR.MINOR.PATCH" # Replace with the latest version
```
## Usage
### Template
CANS provides robust support for templating, including support for handling HTML, looping through collections, and rendering text. Below are some examples demonstrating how to use the `do_html` macro, the `do_forloop` macro, and the `do_text` function.
### Example: Using the do_html Macro
```rust
use cans::html::{do_html, do_text};
pub const HEAD: &str = r#"