Skip to content

Instantly share code, notes, and snippets.

@hedgehog1029
Last active September 11, 2016 20:20
Show Gist options
  • Save hedgehog1029/f6784634a4ef52c11ad203e1debdae2b to your computer and use it in GitHub Desktop.
Save hedgehog1029/f6784634a4ef52c11ad203e1debdae2b to your computer and use it in GitHub Desktop.
Juggle draft spec

juggle - a tiny language designed for text documents

Juggle's syntax is designed to be minimally invasive, simply by taking up only 1 line and a small amount of space. Juggle works by looking for two-character actions at the start of a line. These actions are:

#@ - denotes a global command
#? - denotes a boolean
## - denotes a comment (will be removed from final output)
#! - denotes a bang, a command which modifies the next line

For example, here's a text file using Juggle:

#?Unavailable

#!Upper
Lorem ipsum...

We call parse(input, options) on this with an input object as so:

{
  "upper": function(line) {
    return line.toUpperCase()
  }
}

Parsing would then return an object with the following structure:

{
  "result": "\nLOREM IPSUM...",
  "bools": {
    "unavailable": true
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment