Skip to content

Commit

Permalink
Add replete formatting docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kg583 committed Nov 17, 2024
1 parent 6d49688 commit 2600097
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,34 @@ Functions to decode and encode strings into tokens can be found in `tivars.token

## Documentation

### API

Library documentation can be found on [GitHub Pages](https://ti-toolkit.github.io/tivars_lib_py/).

The var file format(s) and data sections can be found in a readable format on the [repository wiki](https://github.com/TI-Toolkit/tivars_lib_py/wiki). Much of the information is copied from the [TI-83 Link Guide](http://merthsoft.com/linkguide/ti83+/vars.html), though has been updated to account for color models.

> [!NOTE]
> The wiki is still a work-in-progress. Why not [contribute a page](https://github.com/TI-Toolkit/tivars_lib_py/wiki)?
### Formatting

All entry types support string formatting using Python's f-strings.

- All entries support hex formatting of their data: `{sep}{width}x`
- `sep`: a single character to separate groups of hex digits *(default: none)*
- `width`: how many digits to group together *(default: no groups)*
- Tokenized entries support formatting of their tokens into readable lines: `{line_spec}{sep}{type}{lang}`
- `line_spec`: format specifier for line numbers *(default: no line numbers)*
- `sep`: a string to separate lines and line numbers *(default: none)*
- `type`: how to format each token
- `a`: use accessible names
- `d`: use display names *(default)*
- `lang`: language code of the desired translation language *(default: en)*
- Numerical entries support float-style formatting, whose complete details can be found [in the Python docs](https://docs.python.org/3/library/string.html#formatspecv).
- Lists and matrices support float-style formatting, applied to their elements.

Additionally, the `t` type is supported for types which can be made from tokens, composing the object out of typeable (accessible) token names. For example, `-2 + 5i` is presented as `~2+5[i]`.

## Examples

You can find more sample code in `examples` that details common operations on each of the entry types. There are also examples for interfacing with popular external libraries (e.g. NumPy, PIL). Contributions welcome!

0 comments on commit 2600097

Please sign in to comment.