All Projects → jirutka → esh

jirutka / esh

Licence: MIT license
Simple templating engine based on shell.

Programming Languages

shell
77523 projects
Makefile
30231 projects

Projects that are alternatives of or similar to esh

CodegenCS
C# Toolkit for Code Generation (T4 alternative!)
Stars: ✭ 119 (-27.88%)
Mutual labels:  template-engine
express-edge
🔤  Use Edge templating engine with Express
Stars: ✭ 45 (-72.73%)
Mutual labels:  template-engine
nornj
More exciting JS/JSX based on Template Engine, support control flow tags, custom directives, two-way binding, filters and custom operators.
Stars: ✭ 97 (-41.21%)
Mutual labels:  template-engine
html-contextual-autoescaper-java
Prevents XSS by figuring out how to escape untrusted values in templates
Stars: ✭ 15 (-90.91%)
Mutual labels:  template-engine
vpl
Vuejs-syntax like template-engine for Go
Stars: ✭ 19 (-88.48%)
Mutual labels:  template-engine
escapevelocity
A subset reimplementation of Apache Velocity with a much simpler API.
Stars: ✭ 28 (-83.03%)
Mutual labels:  template-engine
Kvantum
An intellectual (HTTP/HTTPS) web server with support for server side templating (Crush, Apache Velocity and JTwig)
Stars: ✭ 17 (-89.7%)
Mutual labels:  template-engine
HTML-templating-with-Google-Apps-Script
Use data from your spreadsheets to build a webpage or a client-side app ✨
Stars: ✭ 55 (-66.67%)
Mutual labels:  template-engine
micro-template.js
A template engine on JavaScript which like embed js
Stars: ✭ 49 (-70.3%)
Mutual labels:  template-engine
liquid.cr
Kind of liquid template engine for Crystal [WIP]
Stars: ✭ 64 (-61.21%)
Mutual labels:  template-engine
jinja.dart
Jinja2 template engine port for Dart.
Stars: ✭ 38 (-76.97%)
Mutual labels:  template-engine
shinit
Basic Init Daemon in POSIX sh
Stars: ✭ 17 (-89.7%)
Mutual labels:  posix-sh
ultron-ele
The world’s fastest LMS engine based on Gatsby -- Deliver knowledge with fun!
Stars: ✭ 27 (-83.64%)
Mutual labels:  template-engine
tale-pug
Tale Pug is the popular JavaScript Template Engine Pug, formerly Jade, for PHP!
Stars: ✭ 32 (-80.61%)
Mutual labels:  template-engine
zapish
zapish - Zabbix API SHell binding
Stars: ✭ 28 (-83.03%)
Mutual labels:  posix-sh
htmldoom
An intuitive, high performance HTML rendering framework
Stars: ✭ 36 (-78.18%)
Mutual labels:  template-engine
velvet
A sweet velvety templating package
Stars: ✭ 72 (-56.36%)
Mutual labels:  template-engine
modulor-html
Missing template engine for Web Components
Stars: ✭ 36 (-78.18%)
Mutual labels:  template-engine
Context
WordPress package to build a "context" (based on a query object) suiteable to be bassed to templates..
Stars: ✭ 18 (-89.09%)
Mutual labels:  template-engine
jquery-smarty
jQuery Smarty Plugin (jQSmarty) is a port of the Smarty Templating Engine to Javascript/jQuery, offering a familiar client-side templating solution
Stars: ✭ 18 (-89.09%)
Mutual labels:  template-engine

ESH – Embedded SHell

Build Status

esh (embedded shell) is a templating engine for evaluating shell commands embedded in arbitrary templates. It’s like ERB (Embedded RuBy) for shell, intended to be used for templating configuration files. Unlike ERB it provides support for including one ESH template into another (since version 0.2.0).

The template processing consists of two phases: conversion to a shell script and evaluation of that script. You can even run just the conversion phase: esh -d will dump a shell script that you can execute directly by a shell (even on a system without esh installed). However, in that case, you will not get error messages source-mapped to point to the locations in the template file.

esh is implemented in ~290 lines (LoC) of shell and awk.

Requirements

  • POSIX-sh compatible shell (e.g. Busybox ash, dash, ZSH, bash, …)

  • common Unix userland with awk and sed (e.g. from Busybox, GNU, …)

  • (Asciidoctor to build a man page)

Installation

Packaging status

Alpine Linux

Install package esh from the Alpine’s community repository:

apk add esh

Fedora

dnf install esh

Void Linux

xbps-install esh

On CI

You can add esh as a submodule into your repository or download it on demand, e.g.:

wget https://raw.githubusercontent.com/jirutka/esh/v0.3.2/esh \
    && echo '9084e3e8e70e4ea81c40cd1cf85559196c0fa2cc  esh' | sha1sum -c \
    || exit 1

Manually

  1. Download and unpack release tarball:

    wget https://github.com/jirutka/esh/archive/v0.3.2/esh-0.3.2.tar.gz
    tar -xzf esh-0.3.2.tar.gz
    cd esh-0.3.2
  2. Run tests:

    make test
  3. Build a man page and install esh:

    make install prefix=/usr/local DESTDIR=/

    or just copy esh whether you want, it’s a plain shell script.

Usage

Read man page esh(1).

Examples

http {
    access_log <%= $logs_dir/access.log %> main;

    resolver <%= $(sed -En 's/^nameserver ([^#]+)/\1/p' /etc/resolv.conf) %>;

    <% if nginx -V 2>&1 | grep -q lua-nginx-module; then -%>
    lua_package_path '<%= $(pkg-config --variable=INSTALL_LMOD lua) %>/?.lua';
    <% fi -%>

    <%+ ./http-common.esh %>

    <%# The rest of the config is omitted %>
}

Credits

ESH template syntax is based on ERB (Embedded Ruby).

Tests and some concepts are inspired by shellcat.

License

This project is licensed under MIT License. For the full text of the license, see the LICENSE file.

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].