From: Ian Jackson Date: Sun, 23 May 2021 00:19:45 +0000 (+0100) Subject: docs: wip document shapelibs, move from shapelib-toml X-Git-Tag: otter-0.6.0~43 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=17814ac961258fba49c95a1e83a2ac6ba44978dd;p=otter.git docs: wip document shapelibs, move from shapelib-toml Signed-off-by: Ian Jackson --- diff --git a/docs/shapelibs.rst b/docs/shapelibs.rst index 65b56d03..c175b2ba 100644 --- a/docs/shapelibs.rst +++ b/docs/shapelibs.rst @@ -113,13 +113,15 @@ 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``. +follows: ``library/LIB/SRC.svg`` or ``.png``. If ``SRC`` is ``-`` +then the item name is used for ``SRC``. (Builtin libraries: these +support SVG only; and the ``SRC`` is not used at runtime, or when +loading shapes --- rather, only when scraping or building.) ``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 will be HTML-escaped, so it should be plain text, not HTML. 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 diff --git a/src/shapelib-toml.rs b/src/shapelib-toml.rs index d41f98a0..2c1ca998 100644 --- a/src/shapelib-toml.rs +++ b/src/shapelib-toml.rs @@ -148,31 +148,11 @@ pub struct RecolourData { #[serde(try_from="String")] pub struct FileList(pub Vec); -/// Contents of each line in [`files`](GroupDefn::files) -/// -/// This is not a key value list. The leading fields are found by -/// splitting on whitespace, and the final field is the rest of the -/// line. #[derive(Deserialize,Debug)] pub struct FileData { - /// The core of the item name. See `GroupDefn`. pub item_spec: String, - - /// The core of the remote file name, for pieces which are scraped. - /// - /// In bundles, is the source file name if it isn't `-`. - /// In builtin libs, - /// not used by Otter during runtime or when loading. - /// - /// When [`scraper.method`](LibraryTomlFile::scraper) is `"none"`, - /// this field is not used and is conventionally set to "`-`". pub src_file_spec: String, - - /// Extra fields, normally not present. pub extra_fields: HashMap, - - /// Desscription. (Shown hn the game log, for example.) - /// Will be HTML-escaped. pub desc: String, }