Simple and lightweight text variation/formatting language written in pure Python.
Project description
Clem
Simple and lightweight text variation/formatting language written in pure Python.
Installation
pip install clem
Usage
Example .clem file
# Sections are optional, and contained within parenthesis
greeting (
# [indicator] | [content]
# The indicator is used to find the line in your Python program. It's referenced as 'section.indicator'.
# You can add decisions by putting choices inside angle-brackets. Clem will select one at random.
casual | How's it <hanging / going>, <bro/dude/dog/man>?
# You can also nest decisions. (If a decision only contains one choice, it will be treated as an optional.)
casual | I <<sincerely> hope / think> you will <have fun during / enjoy / <forever> remember> your stay.
# You can set a choice's odds by prefixing it with '[number]:'. If ommitted this will default to 1.
casual | <Sup / What's up>, my <2: dog / cat>? <Welcome to {location}.>
# Remember you can make as many different indicators as you want.
formal | Greetings, my <dear> <man / friend>. I <sincerely> hope you enjoy your <time/stay> here in {location}.
)
Using Clem in Python
from clem import Clem
clem = Clem()
# Load in lines
clem.load_file("example.clem")
# Add a new one at runtime
clem.add("casual | hi there! my name is <Jack <Black / White> \
/ Selena <Gomez>>.", "greeting")
# Print out line
print("Casual: ", clem.render("greeting.casual", location="Boston"))
print("Formal: ", clem.render("greeting.formal", location="Covington"))
History
Origin
Clem was originally developed for [Fallout Simulator 2] (https://github.com/jakeledoux/fsim2) and based on the primitive templating system of its predecessor, [Fallout Simulator] (https://jakeledoux.itch.io/falloutsim). You can read the original format specification here. This version of Clem, originally titled Clem2, was adapted from the game's code to better structure the logic and to remove dependencies so that it could run independent of the game.
Name
The Clem language is named after a user by the name of 'qclem', who contributed to the content and localisation of the templates for the original Fallout Simulator.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file clem-0.1.0.tar.gz
.
File metadata
- Download URL: clem-0.1.0.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ab74545b4eaa591a96826dc1739bf8462cf19c0b0e740fe872b7a1606e962b8 |
|
MD5 | 78833bcdac67045c60d7bd108cb54b37 |
|
BLAKE2b-256 | 673749792905043cc0c866242ad98b420673c7b34be024b106db7e88b31bff57 |
File details
Details for the file clem-0.1.0-py3.9.egg
.
File metadata
- Download URL: clem-0.1.0-py3.9.egg
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6474216068cf602628755f197d64447cea9d027db59b92758d49928cd3ebdf64 |
|
MD5 | fc5751b7f86fb02723fcb5a50663c3e4 |
|
BLAKE2b-256 | c17127e9c0dedae843d1a80cfc82785e685ff25aeb323f7576f3d01b04d91c9d |
File details
Details for the file clem-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: clem-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e10655c92423012316fd99ada87344a2e0e589f2362eee862eaad6040d7c319 |
|
MD5 | 92988207a49c370e1b1f26e7208033d4 |
|
BLAKE2b-256 | ef7682cba264066ff2c0144b14388966ebd7f1e9832f9c7ad9b664c6c31ea10a |