First commit of "advanced" MCI formatting via theme.hjson entries allowing mini-formatting langauge to apply

Example: {BN!styleFirstLower} in 'text' property
This commit is contained in:
Bryan Ashby
2022-10-05 21:46:13 -06:00
parent 1021226020
commit 065658f6b8
6 changed files with 38 additions and 57 deletions

View File

@@ -123,11 +123,9 @@ Some additional special case codes also exist:
| `XY` | A special code that may be utilized for placement identification when creating menus or to extend an otherwise empty space in an art file down the screen. |
> :information_source: More are added all
the time so also check out [core/predefined_mci.js](https://github.com/NuSkooler/enigma-bbs/blob/master/core/mci_view_factory.js)
for a full listing.
> :information_source: More are added all the time so also check out [core/predefined_mci.js](https://github.com/NuSkooler/enigma-bbs/blob/master/core/mci_view_factory.js) for a full listing.
:memo: Many codes attempt to pay homage to Oblivion/2, iNiQUiTY, etc.
> :memo: Many codes attempt to pay homage to Oblivion/2, iNiQUiTY, etc.
## Views
@@ -146,7 +144,6 @@ a Vertical Menu (`%VM`): Old-school BBSers may recognize this as a lightbar menu
| `FM` | Full Menu | A menu that can go both vertical and horizontal. | See [Full Menu](views/full_menu_view.md) |
| `SM` | Spinner Menu | A spinner input control | Select *one* from multiple options. See [Spinner Menu](views/spinner_menu_view.md) |
| `TM` | Toggle Menu | A toggle menu | Commonly used for Yes/No style input. See [Toggle Menu](views/toggle_menu_view.md)|
| `PL` | Predefined Label | Show environment information | See [Predefined Label](views/predefined_label_view.md)|
| `KE` | Key Entry | A *single* key input control | Think hotkeys |
> :information_source: Peek at [/core/mci_view_factory.js](https://github.com/NuSkooler/enigma-bbs/blob/master/core/mci_view_factory.js) to see additional information.
@@ -189,7 +186,7 @@ Predefined MCI codes and other Views can have properties set via `menu.hjson` an
| `height` | Sets the height of views such as menus that may be > 1 character in height |
| `width` | Sets the width of a view |
| `focus` | If set to `true`, establishes initial focus |
| `text` | (initial) text of a view |
| `text` | (initial) text of a view. See |
| `submit` | If set to `true` any `accept` action upon this view will submit the encompassing **form** |
| `itemFormat` | Sets the format for a list entry. See [Entry Formatting](#entry-formatting) below |
| `focusItemFormat` | Sets the format for a focused list entry. See [Entry Formatting](#entry-formatting) below |
@@ -219,6 +216,12 @@ Standard style types available for `textStyle` and `focusTextStyle`:
### Entry Formatting
Various strings can be formatted using a syntax that allows width & precision specifiers, text styling, etc. Depending on the context, various elements can be referenced by `{name}`. Additional text styles can be supplied as well. The syntax is largely modeled after Python's [string format mini language](https://docs.python.org/3/library/string.html#format-specification-mini-language).
#### MCI Formatting
For more advanced layouts, you may want to apply formatting to MCI codes. In this case, an alternative syntax is supported similar to standard [Entry Formatting](#entry-formatting). MCI codes can be surrounded by `{` and `}` in the `text` field of your `theme.hjson` for a Text Label (`%TL` aka [Text View](./views/text_view.md)). An example:
```
text: "|00|07{BN!stylel33t}" // render board name in "l33t" text
```
### Additional Text Styles
Some of the text styles mentioned above are also available in the mini format language: