``libraries/LIB.toml``.
Each piece in a library has an **item name**. Item names are unique
-within a library. Item names do not need to be unique within a game,
-but there are places where a piece is found *just* by the item name,
-so pieces should have the same item name (only) if they are in some
-sense equivalent. The item name is a string but may contain only
-ASCII alphanumerics, plain ASCII spaces, and the punctuation
-characters ``-._``.
+within a library. The item name is used within Otter to refer to the
+piece (for example, with ``otter library-add``).
+
+Item names do not need to be unique within a game, but there are
+places where a piece is found *just* by the item name, so pieces
+should have the same item name (only) if they are in some sense
+equivalent. The item name is a string but may contain only ASCII
+alphanumerics, plain ASCII spaces, and the punctuation characters
+``-._``.
Pieces in shape libraries cannot have "behaviours": they can't do
anything "special" like react to being moved or clicked on. Pieces
list of indvidual image files which should be processed according to
those parameters.
-For example:
-
-::
+For example::
[group.dried]
outline = "Circle"
files should be re-downloaded, you should re-run ``./media-scraper
library/LIB.toml``.)
-Examples
+Files entry
+-----------
+
+Each group has a table key ``files``. This is a string, which is
+treated as a series of lines (so it is best to use the TOML multi-line
+string syntax).
+
+Each line of which has (normally) three fields (the leading ones
+terminated by whitespace). ``#`` comment lines are supported and
+blank lines are ignored.
+
+Each non-empty non-comment line in ``files`` specifies a single piece,
+like this::
+
+ ITEM-SPEC SRC DESCRIPTION...
+
+The **item name** of the piece will be ``ITEM-SPEC`` sandwiched
+between the ``item_prefix`` and ``item_suffix`` parameters (see
+below).
+
+The **image filename** is derived from ``SRC`` or the item name, as
+follows: ``library/LIB/SRC.svg`` or ``.png``. (Builtin libraries
+support SVG only.) If ``SRC`` is ``-`` then the item name is used for
+``SRC``.
+
+``DESCRIPTION`` is the **description**, a string which will be used to
+describe the piece (eg in in-game log messages). In English, it
+should contain an article. Eg, ``the black queen``, ``a white pawn``.
+
+It is also possible to specify additional data for each piece by
+adding fields to each line in ``files``. This is done by adding a
+line at the start starting with ``:`` listing the extra fields, and
+then additng one additional whitespace separated value on each data
+line. Values given for unknown field are ignored.
+
+Currently the extra fields supported are:
+
+ * ``sort``: Specifies the sort key. See the ``sort`` group
+ definition property.
+
+The values for these extra fields come just before the
+``DWSCRIPTION``, after the other whitespace-delimited fields, in the
+same order as specified in the ``:`` heading line.
+
+Item names
+``````````
+
+Item names are conventionally structured using a hierarchical name
+with ``-`` between the components. Do not put ``/`` in item names use
+``_`` only as a word separator within ``-``-separated parts.
+
+See the existing examples to see what item names usually look like.
#[doc(hidden)] pub type LLE = shapelib::LibraryLoadError;
-/// Details for a group of pieces. See also [`GroupDetails`].
-///
-/// This is separate from `GroupDetails` only to make the
-/// implementation convenient (for complicated reasons). At the
-/// library TOML file level, there is no meaningful difference between
-/// the fields in this struct, and the ones in `GroupDetails`
-//
// At the implementation level, each loaded item contains an
// `Arc<GroupDetails>`, which is simply stored directly. The
// `GroupDefn` is processed.
#[derive(Debug,Deserialize)]
pub struct GroupDefn {
- /// `files` is a multi-line string, each line of which has
- /// (normally) three fields (the leading ones terminated by
- /// whitespace). The fields are those in [`FileData`]. `#`
- /// comments are supported.
- ///
- /// Each non-empty non-comment line in `files` specifies a single
- /// SVG to be made aavailable as a piece.
- ///
- /// The piece has am **item name** which is used within Otter to
- /// refer to the piece (for example, with `otter library-add`).
- /// The SVG filename is derived from the item name, as follows:
- /// `library/`_lib_`/`_itemname_`.svg`.
- ///
- /// The `itemname` is the `item_spec` from each entry in `files`
- /// (see [`FileData`] sandwiched between `item_prefix` and
- /// `item_suffix`
- ///
- /// Item names are conventionally structured using a hierarchical
- /// name with `-` between the components. Do not put `/` or `_` in
- /// item names.
- ///
- /// It is also possible to specify additional data for each item by
- /// adding fields to each line. This is done by adding a line at
- /// the start starting with `:` and then additing one additional
- /// whitespace separated value on each data line. Unknown
- /// `fieldname` values are ignored. Currently the extra fields
- /// supported are:
- ///
- /// * `sort`: Specifies the sort key. See the `sort` group
- /// definition property.
- ///
- /// The values for these extra fields come just before the
- /// dwscription, after the other whitespace-delimited fields, in the
- /// same order as specified in the `:` heading line.
pub files: FileList,
/// See the discussioin of the item name.