Crates.io | jango |
lib.rs | jango |
version | 0.2.4 |
source | src |
created_at | 2024-04-04 22:32:46.87381 |
updated_at | 2024-06-20 15:38:04.771591 |
description | A CLI program to populate your templates |
homepage | |
repository | https://github.com/DavoReds/jango |
max_upload_size | |
id | 1196860 |
size | 104,532 |
A CLI application to populate your templates.
content
field that can be populated with the command line.curl --proto '=https' --tlsv1.2 -LsSf https://github.com/DavoReds/jango/releases/download/v0.2.4/jango-installer.sh | sh
This works for both Linux & MacOS.
powershell -c "irm https://github.com/DavoReds/jango/releases/download/v0.2.4/jango-installer.ps1 | iex"
You can also download the prebuild binaries manually from the releases page.
If you have Rust installed, you can build Jango from source using the crates.io registry.
cargo install jango
Or download a prebuilt binary with cargo-binstall.
cargo binstall jango
This mode allows for a template containing any of Tera's builtins and a variable called content
that corresponds to the command line argument of the same name.
The template could look something like this:
---
date: {{ now() | date(format="%F") }}
---
# This is a title
{{ content }}
And you would populate it with this command:
jango args template.md output.md -c "Hello, **world\!**"
Which would result in this file:
---
date: 2024-04-05
---
# This is a title
Hello, **world!**
If you are manipulating HTML, you can use the --escape
flag if you wish to escape the input given to the command.
When dealing with more complex templates, you can use a Markdown file with a TOML frontmatter to pass any arbitrary variables beyond the file's content
.
The template can look something like this:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>{{ title }}</title>
</head>
<body>
{{ content | indent }}
</body>
</html>
You can write a Markdown file like this:
+++
title = "This is a title"
+++
# This is a heading
This is a paragraph.
Then execute a command like this:
jango markdown template.html markdown.md output.html
Which would result in this file:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>This is a title</title>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
Contributions are always welcome!
You're going to need to have Rust installed. I also recommend having Bacon (to handle recompilation) and cargo-nextest (for a nicer interface when running tests) installed.
We also try to conventional commit conventions when contributing to the repo.