Skip to content

Latest commit

 

History

History
98 lines (63 loc) · 1.84 KB

README.md

File metadata and controls

98 lines (63 loc) · 1.84 KB

!!BANG!!

A text processor / static website generator.

💥 Put holes through text files 💥

Preview

Bang comprises of a minimal markup language, and a short python script. For processing text replacements in modular files.

Language: Python, Bang markup

Licence: MIT

Learn more:

Requires

  • python 3
  • bash

Quickstart

# Process example files and open in web browser
./run.sh

Bang markup syntax

keyword definitions

Assignment Operators:

!    - for assigning a word or line of text to a !!keyword!!
!!   - for assigning file contents to a !!keyword!!
!!!  - for assigning the return value of a shell commmand to a !!keyword!!

keyword replacement

Keywords are enclosed in exclamation marks !!, a.k.a double bangs

!!keyword!!

This allows us to replace text with variables:

/* style.css */

* {
  background-color: !!bg_colour!!;
  colour: !!color!!;
  font-family: !!font!!;
}

And for text files to be modular:

<!-- index.html -->
!!html_start!!
!!head!!
!!body!!
!!html_end!!

Process individual files

Process a text file:

./bang.sh markup.bang in/example.txt > out/example.txt

Process a webpage:

./bang.sh markup.bang in/index.html > out/index.html

Process multiple files

You can chain standard bash utilities for processing multiple files.

See run.sh

Extra notes

This version, v2.0.0, is a much simplified re-implementation. You can still access v1.0.0 here

"broken glass 2" by Nesster is licensed under CC BY 2.0