edouard@2883: // widget_custom.ysl2
edouard@2883: //
edouard@2883: // widget entierely defined from JS code in Inkscape description field
Edouard@2779: 
edouard@2883: // TODO
Edouard@2792: 
edouard@2883: // a preliminary implementation was initially attempted but disabled
edouard@2883: // code collected around before code refactoring
Edouard@2792: 
Edouard@2790: 
edouard@2909: /*const "mark" > =HMI=\n*/
edouard@2909: 
Edouard@2792: 
Edouard@2792:         /* TODO re-enable
Edouard@2792:         ||
Edouard@2792:         function evaluate_js_from_descriptions() {
Edouard@2792:             var Page;
Edouard@2792:             var Input;
Edouard@2792:             var Display;
Edouard@2792:             var res = [];
Edouard@2792:         ||
Edouard@2792:         const "midmark" > \n«$mark»
Edouard@2792:         apply """//*[contains(child::svg:desc, $midmark) or \
Edouard@2792:                      starts-with(child::svg:desc, $mark)]""",2 
Edouard@2792:               mode="code_from_descs";
Edouard@2792:         ||
Edouard@2792:             return res;
Edouard@2792:         }
Edouard@2792:         ||
Edouard@2792:         */
Edouard@2792: 
Edouard@2810:     // template "*", mode="code_from_descs" {
Edouard@2810:     //     ||
Edouard@2810:     //     {
Edouard@2810:     //         var path, role, name, priv;
Edouard@2810:     //         var id = "«@id»";
Edouard@2810:     //     ||
Edouard@2810: 
Edouard@2810:     //     /* if label is used, use it as default name */
Edouard@2810:     //     if "@inkscape:label"
Edouard@2810:     //         |> name = "«@inkscape:label»";
Edouard@2810: 
Edouard@2810:     //     | /* -------------- */
Edouard@2810: 
Edouard@2810:     //     // this breaks indent, but fixing indent could break string literals
Edouard@2810:     //     value "substring-after(svg:desc, $mark)";
Edouard@2810:     //     // nobody reads generated code anyhow...
Edouard@2810: 
Edouard@2810:     //     ||
Edouard@2810: 
Edouard@2810:     //         /* -------------- */
Edouard@2810:     //         res.push({
Edouard@2810:     //             path:path,
Edouard@2810:     //             role:role,
Edouard@2810:     //             name:name,
Edouard@2810:     //             priv:priv
Edouard@2810:     //         })
Edouard@2810:     //     }
Edouard@2810:     //     ||
Edouard@2810:     // }
Edouard@2810: 
Edouard@2810: