Files
markup/README.md
2022-09-22 10:29:30 -07:00

40 lines
1.2 KiB
Markdown

# 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`
`${random 90 100} bottles of beer on the wall` => `96 bottles of beer on the wall`
`${choose heads tails}` => `heads`
`${round 6.4}` => `6`
`${round ${random}}` => `0`
## 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.