All Projects → tevelee → Tuxedo

tevelee / Tuxedo

Licence: apache-2.0
Tuxedo is a template language for Swift.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Tuxedo

Pongo2
Django-syntax like template-engine for Go
Stars: ✭ 2,111 (+2538.75%)
Mutual labels:  template, template-engine, template-language
karkas
A tiny template engine based on TypeScript
Stars: ✭ 14 (-82.5%)
Mutual labels:  template-engine, template-language
gender-render
Template-system and proof-of-concept for rendering gender-neutral text-, email- and RPG-text-templates with the correct pronouns of all people involved.
Stars: ✭ 21 (-73.75%)
Mutual labels:  template-engine, template-language
Mikado
Mikado is the webs fastest template library for building user interfaces.
Stars: ✭ 323 (+303.75%)
Mutual labels:  template, template-engine
Sodajs
Light weight but powerful template engine for JavaScript
Stars: ✭ 240 (+200%)
Mutual labels:  template, template-engine
Jade
Jade.go - pug template engine for Go (golang)
Stars: ✭ 251 (+213.75%)
Mutual labels:  template, template-engine
Email Templates
📫 Create, preview, and send custom email templates for Node.js. Highly configurable and supports automatic inline CSS, stylesheets, embedded images and fonts, and much more!
Stars: ✭ 3,291 (+4013.75%)
Mutual labels:  template, template-engine
Westwind.razorhosting
Hosting the Razor Runtime outside of ASP.NET/MVC for use in non-Web .NET applications.
Stars: ✭ 136 (+70%)
Mutual labels:  template, template-engine
Twirl
Twirl is Play's default template engine
Stars: ✭ 498 (+522.5%)
Mutual labels:  template-engine, template-language
Inja
A Template Engine for Modern C++
Stars: ✭ 715 (+793.75%)
Mutual labels:  template, template-engine
Bars
Bars is a lightweight high performance HTML aware templating engine. Bars emits DOM rather than DOM-strings, this means the DOM state is preserved even if data updates happen.
Stars: ✭ 5 (-93.75%)
Mutual labels:  template-engine, template-language
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 (+2511.25%)
Mutual labels:  template, template-engine
Liquor
Liquor is a safe sandboxing compiling template language for Ruby
Stars: ✭ 57 (-28.75%)
Mutual labels:  template, template-engine
escapevelocity
A subset reimplementation of Apache Velocity with a much simpler API.
Stars: ✭ 28 (-65%)
Mutual labels:  template-engine, template-language
Eval
Eval is a lightweight interpreter framework written in Swift, evaluating expressions at runtime
Stars: ✭ 157 (+96.25%)
Mutual labels:  template, template-language
bart
A compile time templating language for Rust inspired by Mustache
Stars: ✭ 29 (-63.75%)
Mutual labels:  template-engine, template-language
Phptal
PHP Template Attribute Language — template engine for XSS-proof well-formed XHTML and HTML5 pages
Stars: ✭ 155 (+93.75%)
Mutual labels:  template-engine, template-language
String template
A template engine for Rails, focusing on speed, using Ruby's String interpolation syntax
Stars: ✭ 122 (+52.5%)
Mutual labels:  template, template-engine
Pug
Pug template engine for PHP
Stars: ✭ 341 (+326.25%)
Mutual labels:  template, template-engine
Phug
Phug - The Pug Template Engine for PHP
Stars: ✭ 43 (-46.25%)
Mutual labels:  template, template-engine

Tuxedo

Travis CI status Framework version Swift version Code Test Coverage Platforms Lincese

Dependency Managers

CocoaPods compatible Swift Package Manager compatible Carthage compatible


👨🏻‍💻 About

Tuxedo is a template language for Swift. It allows you to separate the UI and rendering layer of your application from the business logic. Smart templates working with raw data allow the frontend to be handled and developed separately from other parts of the application, so processing, layouting and formatting your output can be defined in very simple template formats.

Why the name? It dresses up your static output with elegant dynamic templates, using control statements, and high level operators.

The project was built upon my lightweight interpreter framework, Eval, and served as an example application of what is possible using this evaluator.

Soon, the template language example turned out to be a really useful project on its own, so I extracted it to live as a separate library and be used by as many projects as possible. I see the possibility of applications most valuable especially in server-side Swift projects, but there are a lot of other areas where template parsing fits well.

The project - though most of its featureset is already available - is still having its early days, there is a lot of work needed to be done around open-sourcing activities, such as CI, contribution guidelines and extensive documentation. At this stage, if you're interested in what is already possible using Tuxedo, I encourage you to check out the unit tests and see the use-cases there until the documentation gets ready, or see some of the examples below. Please stay tuned for updates!

The inspiration was the excellent PHP template engine, Twig, and the fact that there is no existing, comprehensive-enough templating library available for the Swift language and platform.

👀 Getting Started

You can evaluate basic expressions ...

let result = Tuxedo().evaluate("Hello {{ name }}!", variables: ["name": "Tuxedo"]) // Hello Tuxedo!

... or even complex ones ...

let result = Tuxedo().evaluate("""
The results are: 
	{% for item in results.sort.reverse %}
		{% if item is not first %}, {% endif %}
		{% if item is last %} and {% endif %}
		{{ item * 2 }}
	{% endfor %}
""", variables: ["results": [3, 1, 2]]) // The results are: 6, 4 and 2

... define macros ...

let templateEngine = Tuxedo()
let _ = templateEngine.evaluate("{% macro concat(a, b) %}a + b{% endmacro %}")
let result = templateEngine.evaluate("{{ concat('Hello ', 'World!') }}") // Hello World!

... or blocks ...

let templateEngine = Tuxedo()
let result = templateEngine.evaluate("""
<html>
	<head>
		<title>
			{% block title %}Website{% endblock %}
		</title>
	</head>
	<body>
		{% block body %}{% endblock %}
	</body>
</html>
""")

... and override them later ...

{% block title %} {{ parent() }} - Subpage {% endblock %}
{% block body %} Content {% endblock %}

Tuxedo handles all kinds of expressions you can imagine. It works with numeric types, strings, booleans, dates, arrays and dictionaries.

You can perform all sorts of operations with functions and operators, such as numeric and logical operations, string manupulation, date formatting, higher level array and dictionary operations, and so on.

It works with hard-coded string inputs and also template files written from disk.

🙋 Contribution

Anyone is more than welcomed to contribute to this great project! Just fire up an issue or pull request to get the conversation started!

👤 Author

I am Laszlo Teveli, software engineer, iOS evangelist. In my free time I like to work on my hobby projects and open sourcing them 😉

Feel free to reach out to me anytime via tevelee [at] gmail [dot] com, or @tevelee on Twitter.

⚖️ License

Tuxedo is available under the Apache 2.0 licensing rules. See the LICENSE file for more information.

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