svghmi/widget_textlist.ysl2
author Edouard Tisserant
Thu, 11 Aug 2022 12:11:35 +0200
changeset 3579 c5070b6973ba
parent 3556 5d73bed497de
permissions -rw-r--r--
SVGHMI: add support for multiline widget declaration using svg:desc.

Declaration started in inkscape:label and interupted by a '\' can be continued in the description field.
After an empty line, the rest of the description field is left for description text.
// widget_textlist.ysl2

widget_desc("TextList") {
    longdesc
    ||
    TextList widget is a svg:group, list items are labeled elements
    in that group.

    To use a TextList, clone (svg:use) one of the items inside the widget 
    that expects a TextList.

    In this list, (translated) text content is what matters. Nevertheless
    text style of the cloned item will be applied in client widget.
    ||

    shortdesc > A named list of ordered texts 

    arg name="listname"
}

widget_defs("TextList") {
    |     texts: [
    foreach "func:refered_elements($hmi_element/*[@inkscape:label])[self::svg:text]" {
    |         id("«@id»"),
    }
    // could find a proper way in xpath to reverse()
    |     ].reverse(),
}

widget_class("TextList");