svghmi/gen_index_xhtml.ysl2
branchsvghmi
changeset 2783 5ee6967f721d
parent 2782 723e420dfe72
child 2788 2ed9ff826d03
equal deleted inserted replaced
2782:723e420dfe72 2783:5ee6967f721d
    48                       apply "$hmitree", mode="testtree";
    48                       apply "$hmitree", mode="testtree";
    49                   }
    49                   }
    50                   apply "@* | node()";
    50                   apply "@* | node()";
    51               }
    51               }
    52               script{
    52               script{
       
    53                   ||
       
    54                   function evaluate_js_from_descriptions() {
       
    55                       var Page;
       
    56                       var Input;
       
    57                       var Display;
       
    58                       var res = [];
       
    59                   ||
    53                   variable "midmark" > \n«$mark»
    60                   variable "midmark" > \n«$mark»
    54                   apply """//*[contains(child::svg:desc, $midmark) or \
    61                   apply """//*[contains(child::svg:desc, $midmark) or \
    55                                starts-with(child::svg:desc, $mark)]""", 
    62                                starts-with(child::svg:desc, $mark)]""",2 
    56                         mode="code_from_descs";
    63                         mode="code_from_descs";
    57                   |
    64                   ||
       
    65                       return res;
       
    66                   }
       
    67                   ||
    58 
    68 
    59                   /*TODO add :
    69                   /*TODO add :
    60                     - pages content
    70                     - pages content
    61                       + with ref to elt ?
    71                       + with ref to elt ?
    62                     - widgets parameters
    72                     - widgets parameters
    66               }
    76               }
    67           }
    77           }
    68     }
    78     }
    69 
    79 
    70     template "*", mode="code_from_descs" {
    80     template "*", mode="code_from_descs" {
    71         | function js_«@id»() {
    81         ||
    72         | var path, role, path, priv;
    82         {
    73         | 
    83             var path, role, name, priv;
       
    84             var id = "«@id»";
       
    85         ||
       
    86 
       
    87         /* if label is used, use it as default name */
       
    88         if "«@inkscape:label»"
       
    89             |> name = "«@inkscape:label»";
       
    90 
       
    91         | /* -------------- */
       
    92 
       
    93         // this breaks indent, but fixing indent could break string literals
    74         value "substring-after(svg:desc, $mark)";
    94         value "substring-after(svg:desc, $mark)";
    75         | 
    95         // nobody reads generated code anyhow...
    76         | }
    96 
    77         |
    97         ||
       
    98 
       
    99             /* -------------- */
       
   100             res.push({
       
   101                 path:path,
       
   102                 role:role,
       
   103                 name:name,
       
   104                 priv:priv
       
   105             })
       
   106         }
       
   107         ||
    78     }
   108     }
    79 
   109 
    80 
   110 
    81     template "bbox", mode="testgeo"{
   111     template "bbox", mode="testgeo"{
    82         | ID: «@Id» x: «@x» y: «@y» w: «@w» h: «@h»
   112         | ID: «@Id» x: «@x» y: «@y» w: «@w» h: «@h»