All Projects → kaj → Ructe

kaj / Ructe

Rust Compiled Templates with static-file handling

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Ructe

Bladeone
The standalone version Blade Template Engine without Laravel in a single php file and without dependencies
Stars: ✭ 411 (+99.51%)
Mutual labels:  loop, template-engine
Gotemplatebenchmark
comparing the performance of different template engines
Stars: ✭ 180 (-12.62%)
Mutual labels:  template-engine
100 Lines Of Code Challenge Js
Write Everything in JavaScript under 100 Lines!!!😈
Stars: ✭ 157 (-23.79%)
Mutual labels:  template-engine
Dwoo
[UNMAINTAINED] php template engine
Stars: ✭ 164 (-20.39%)
Mutual labels:  template-engine
Shell Scripting Tutorial
A complete begineers guide to learn shell scripting from scratch which includes Videos, Practice scenarios and project idea.
Stars: ✭ 159 (-22.82%)
Mutual labels:  loop
Diamond
Diamond is a full-stack web-framework written in The D Programming Language using vibe.d
Stars: ✭ 173 (-16.02%)
Mutual labels:  template-engine
Pyicp Slam
Full-python LiDAR SLAM using ICP and Scan Context
Stars: ✭ 155 (-24.76%)
Mutual labels:  loop
Yarte
Yarte stands for Yet Another Rust Template Engine
Stars: ✭ 189 (-8.25%)
Mutual labels:  template-engine
Microconfig
Modern tool for microservice configuration management
Stars: ✭ 180 (-12.62%)
Mutual labels:  template-engine
Patches
Patches is a visual programming editor for building WebVR and WebGL experiences.
Stars: ✭ 164 (-20.39%)
Mutual labels:  loop
Spring Boot Email Tools
A set of services and tools for sending emails in a Spring Boot 1.5.x application using a Template Engine
Stars: ✭ 164 (-20.39%)
Mutual labels:  template-engine
Foil
PHP template engine for native PHP templates
Stars: ✭ 162 (-21.36%)
Mutual labels:  template-engine
Quicktemplate
Fast, powerful, yet easy to use template engine for Go. Optimized for speed, zero memory allocations in hot paths. Up to 20x faster than html/template
Stars: ✭ 2,287 (+1010.19%)
Mutual labels:  template-engine
Hsweb Expands
文件压缩解压、office文档读写、http,ftp请求模拟、shell执行、模板引擎
Stars: ✭ 160 (-22.33%)
Mutual labels:  template-engine
Thymeleaf
Thymeleaf is a modern server-side Java template engine for both web and standalone environments.
Stars: ✭ 2,251 (+992.72%)
Mutual labels:  template-engine
Phptal
PHP Template Attribute Language — template engine for XSS-proof well-formed XHTML and HTML5 pages
Stars: ✭ 155 (-24.76%)
Mutual labels:  template-engine
Windowstemplatestudio
Windows Template Studio quickly builds a UWP app, using a wizard-based UI to turn your needs into a foundation of Windows 10 patterns and best practices.
Stars: ✭ 2,089 (+914.08%)
Mutual labels:  template-engine
Craftsman
Craftsman is the workhorse behind the Wrapt framework and provides a suite of CLI commands for quickly scaffolding out new files and projects for your .NET Web APIs with simple CLI commands and configuration files.
Stars: ✭ 165 (-19.9%)
Mutual labels:  template-engine
React Ssr
React SSR as a view template engine
Stars: ✭ 200 (-2.91%)
Mutual labels:  template-engine
Elefant
Elefant, the refreshingly simple PHP CMS and web framework.
Stars: ✭ 188 (-8.74%)
Mutual labels:  template-engine

Rust Compiled Templates — ructe

This is my attempt at writing a HTML template system for Rust. Some inspiration comes from the scala template system used in play 2, as well as plain old jsp.

Crate docs CI

Design criteria

  • As many errors as possible should be caught at compile-time.
  • A compiled binary should include all the template code it needs, no need to read template files at runtime.
  • Compilation may take time, running should be fast.
  • Writing templates should be almost as easy as writing html.
  • The template language should be as expressive as possible.
  • It should be possible to write templates for any text-like format, not only html.
  • Any value that implements the Display trait should be outputable.
  • By default, all values should be html-escaped. There should be an easy but explicit way to output preformatted html.

Current status

Ructes is in a rather early stage, but does work; templates can be transpiled to rust functions, which are then compiled and can be called from rust code.

Template format

A template consists of three basic parts: First a preamble of use statements, each prepended by an @ sign. Secondly a declaration of the parameters the template takes. And third, the template body.

The full syntax is described in the documentation. Some examples can be seen in examples/simple/templates. A template may look something like this:

@use any::rust::Type;
@use super::statics::style_css;

@(name: &str, items: &[Type])

<html>
   <head>
     <title>@name</title>
     <link rel="stylesheet" href="/static/@style_css.name" type="text/css"/>
   </head>
   <body>
     <h1>@name</h1>
     <dl>
     @for item in items {
       <dt>@item.title()</dt>
       <dd>@item.description()</dd>
     }
     </dl>
   <body>
</html>

How to use ructe

Ructe compiles your templates to rust code that should be compiled with your other rust code, so it needs to be called before compiling, as described in the documentation. There are also examples, both for ructe itself and its futures and for using it with the web frameworks actix-web, gotham, iron. nickel, tide, and warp, There is also a separate example of using ructe with warp and diesel.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].