Simple Inline Markup Language and Logging
Project description
Simple Inline Markup Language and Logging (saimll)
SAIML
This allows the user to customize strings and prettyprint different information to stdout.
Includes:
- parse -> returns formatted strings
- print -> parse SAIML markup strings and display them to stdout
Syntax:
Brackets []
indicate a macro. Macros can do 1 of three things; Assign a foreground/background color,
create a hyperlink, and call a builtin function. All macros will ignore extra whitespace and focus on the identifiers; @
, ~
, and ^
.
-
Colors
- Colors start with a leading identifier
@
. To indicate foreground or background use the specifierF
andB
respectively. Following the@
and the specifier you can then enter the color.- This can be a predifined color such as; black, red, green, yellow, blue, magenta, cyan, white.
[@F black]
. - It can be a hex code
#ead1a8
.[@F #ead1a8]
. - It can be a XTerm code 0-256.
[@F 9]
. - Lastely, it can be an rgb color where the 3 numbers can be seperated by a
,
or a;
.[@F 114;12,212]
.
- This can be a predifined color such as; black, red, green, yellow, blue, magenta, cyan, white.
- Colors can be reset with
[@F]
or[@B]
to reset foreground or background respectively or[@]
can be use to reset both. - Foreground and background can be specified in the same macro
[@F 1 @B 2], but they can not be reset in the same macro
[@F @B], use
[@]` instead. - While the macro will ignore white space and you can do something like
[@F#ead1a8@B3]
it is preferred to use whitespace for readability[@F #ead1a8 @B 3]
.
- Colors start with a leading identifier
-
Hyperlinks
- Hyperlinks start with a leading identifier
~
. - Hyperlinks will surround plain text blocks.
[~https://example.com]Example
->Example
.- Links end on the next macro with the simpl
~
or at the end of the string[~https://example.com]Example[~] Not part of the link
→ ``ExampleNot part of the link
[~https://example.com]Link1 [~https://example.com]Link2
→Link1
link2``
- Links end on the next macro with the simpl
- Hyperlinks start with a leading identifier
-
Builtin functions
- Builtin functions start with the identifier
^
. The text block following the function will have it's string value passed as a parameter. - You can also specify your own function or override the provided ones by calling SAIML.define("Macro Name", Callable)
- The custom function needs to take a string and return a string. If it does not return a string it will not have an affect.
- Example:
def hello_world(string: str) → str: return "Hello World" SAIML.define("hw", hello_world) SAIML.print("[^hw]Cat goes moo")
- The above example lets SAIML know about the function hello_world and says it can be called with
hw
- Then all that needs to happen is to call it with
[^hw]
- Example:
- Example:
[^rainbow]Rainbow Text
will return the string with a rainbow foreground color. SAIML also follows some inspiration from markdown where*
means toggle bold and_
means to toggle underline. To reset all attributes, color and formatting, use the empty brackets[]
.
- Builtin functions start with the identifier
Check out this example for how SAIML can be used
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
saimll-0.5.0.tar.gz
(24.8 kB
view details)
Built Distribution
saimll-0.5.0-py3-none-any.whl
(27.7 kB
view details)
File details
Details for the file saimll-0.5.0.tar.gz
.
File metadata
- Download URL: saimll-0.5.0.tar.gz
- Upload date:
- Size: 24.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e822987424a51f03bdeae2e32ba63695251b4a0d619a69ff05e070da87392c97 |
|
MD5 | 8a25d09bd2e344978d6e1fd60c76d8eb |
|
BLAKE2b-256 | ad607f7bcc4543db87b197862bc8ec71b0ad016fca058bd63be22a4b3a4df659 |
File details
Details for the file saimll-0.5.0-py3-none-any.whl
.
File metadata
- Download URL: saimll-0.5.0-py3-none-any.whl
- Upload date:
- Size: 27.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ccf98d6c724cb9322e4783a6f20155f7177ae760cef839cef8e4ad82b78e686 |
|
MD5 | 03160285700cec19be6c55938b0ae437 |
|
BLAKE2b-256 | fc840eebf2fba31d3a358ab96bd231b22abebaa6386cef9c2e5d120d747cdcf1 |