Files
markup/README.md
Alek Ratzloff 0724e7c856 Add some documentation to the README
This is mostly about the language usage and available macros.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2022-09-22 10:27:46 -07:00

1.1 KiB

markup

A small, easy markup language for doing basic replacements in text.

Usage

If you want to use it inside of Python, you should be able to just drop in markup.py into your Python program.

If you want to use it on the command line, you can either call ./markup.py and pass your text to process through STDIN. Otherwise, you can pass in a (single) file as an argument, e.g. ./markup.py filename.txt

Language

This language attempts to be easy to use and extend. There are not many default macros available, they are added as-needed.

Examples

asdf asdf asdf => asdf asdf asdf

${random 6} => 4

${choose a b c d} => d

${round 6.4} => 6

Available macros

  • random [X [Y]] - chooses a random number. If no arguments are supplied, chooses a random number between 0.0 and 1.0, exclusive. If one argument, chooses a random integer between 1 and the number, inclusive. If two arguments, chooses a random integer between the two numbers, inclusive.
  • choose [X [Y [Z ...]]] - chooses a random item from the supplied list of items.
  • round X [Y] - rounds a number X to an optional Y digits.