Packages
macaw_format
0.1.0
Presentation for the Macaw family: d3-format numbers, strftime times and a measure's default writing in a locale, the unit symbols people type, and a quantity's display families, unit systems and label.
Current section
Files
Jump to
Current section
Files
macaw_format
README.md
README.md
<img src="brand/logo/macaw_scarlet.svg" alt="The Macaw logo, a scarlet macaw in flight" width="128">
# macaw_format
> **This software is a very early release, and not ready for general use.**
Public home: [github.com/dcoai/macaw_format](https://github.com/dcoai/macaw_format) · Docs: [hexdocs.pm](https://hexdocs.pm/macaw_format)
Presentation for the Macaw family: how a value, a time and a measure read to a person ([spec/00](https://github.com/dcoai/macaw_format/blob/main/spec/00-overview.md)). It depends on `macaw_units` and `macaw_base` only, so macaw_draw writes values without depending on macaw_data, and macaw_data depends on units, not on format (dco-tek/macaw/macaw#478).
| Module | What it is |
|---|---|
| `Macaw.Format` | a number's format, a d3-format specifier read once into data: `parse/2`, `number/2` ([spec/01 §1](https://github.com/dcoai/macaw_format/blob/main/spec/01-format.md#format-data), [§2](https://github.com/dcoai/macaw_format/blob/main/spec/01-format.md#format-notation), [§4](https://github.com/dcoai/macaw_format/blob/main/spec/01-format.md#format-cost)); a time's, a strftime pattern: `parse_time/2`, `time/2` ([§5](https://github.com/dcoai/macaw_format/blob/main/spec/01-format.md#format-time)); a field's default, from its measure: `for_measure/2`, `measure/2` ([§6](https://github.com/dcoai/macaw_format/blob/main/spec/01-format.md#format-default)); `format_error/1` |
| `Macaw.Format.Locale` | a d3-format locale definition as data: `english/0`, `new/1` ([spec/01 §3](https://github.com/dcoai/macaw_format/blob/main/spec/01-format.md#format-locale)) |
| `Macaw.Format.Time` | a strftime pattern compiled once into its parts ([spec/01 §5](https://github.com/dcoai/macaw_format/blob/main/spec/01-format.md#format-time)) |
| `Macaw.Format.Measure` | a field's default format, its unit's conversions resolved once ([spec/01 §6](https://github.com/dcoai/macaw_format/blob/main/spec/01-format.md#format-default)) |
| `Macaw.Format.Alias` | the symbols a person types, read as UCUM codes or refused naming their choices: `parse/1`, `format_error/1` ([spec/02 §1](https://github.com/dcoai/macaw_format/blob/main/spec/02-presentation.md#units-aliases)) |
| `Macaw.Format.Quantity` | a quantity's presentation: `family/2,3` ([spec/02 §2](https://github.com/dcoai/macaw_format/blob/main/spec/02-presentation.md#quantities-families)), `systems/0` ([§3](https://github.com/dcoai/macaw_format/blob/main/spec/02-presentation.md#quantities-systems)), `label/1` ([§5](https://github.com/dcoai/macaw_format/blob/main/spec/02-presentation.md#quantities-label)) |
| `Macaw.Format.Error` | what every `!` twin raises: its value twin's reason, worded by macaw_base's `Macaw.Base.Fault.sentence/2` with format's words ([spec/00 §3](https://github.com/dcoai/macaw_format/blob/main/spec/00-overview.md#format-errors)) |
Meaning is not here: a unit's code, dimension, conversion and symbol, and a quantity's list, base unit, kind, bounds and additivity, are macaw_units'.
## Installation
Two runtime dependencies, `macaw_units` and `macaw_base`. From Hex:
```elixir
{:macaw_format, "~> 0.1.0"}
```
Part of [Macaw](https://github.com/dcoai/macaw).
## License
MIT; see the LICENSE file.