svghmi/gen_index_xhtml.ysl2
branchsvghmi
changeset 2904 92d115d8828d
parent 2883 8e3d130399b0
child 2911 211d6a185e31
equal deleted inserted replaced
2903:881d0248b3ce 2904:92d115d8828d
    15 };
    15 };
    16 
    16 
    17 in xsl decl svgtmpl(match, xmlns="http://www.w3.org/2000/svg") alias template;
    17 in xsl decl svgtmpl(match, xmlns="http://www.w3.org/2000/svg") alias template;
    18 in xsl decl svgfunc(name, xmlns="http://www.w3.org/2000/svg") alias template;
    18 in xsl decl svgfunc(name, xmlns="http://www.w3.org/2000/svg") alias template;
    19 
    19 
    20 !!
       
    21 debug_output_calls = []
       
    22 def gen_debug_calls():
       
    23     # '&bug' is a workaround for pyPEG that choke on
       
    24     # yml2 python results not parsing down into a single yml2 call
       
    25     return ("&bug {"+
       
    26         "\n".join(["""
       
    27             comment {
       
    28                 |
       
    29                 | %s:
       
    30                 call "%s";
       
    31                 | 
       
    32             }"""%(n,n) for n in debug_output_calls])+
       
    33         "}")
       
    34 !!
       
    35 
       
    36 istylesheet
    20 istylesheet
    37             /* From Inkscape */
    21             /* From Inkscape */
    38             xmlns:dc="http://purl.org/dc/elements/1.1/"
    22             xmlns:dc="http://purl.org/dc/elements/1.1/"
    39             xmlns:cc="http://creativecommons.org/ns#"
    23             xmlns:cc="http://creativecommons.org/ns#"
    40             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    24             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    41             xmlns:svg="http://www.w3.org/2000/svg"
    25             xmlns:svg="http://www.w3.org/2000/svg"
    42             xmlns:xlink="http://www.w3.org/1999/xlink"
    26             xmlns:xlink="http://www.w3.org/1999/xlink"
    43             xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
    27             xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
    44             xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
    28             xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
    45             xmlns:xhtml="http://www.w3.org/1999/xhtml"
    29             xmlns:xhtml="http://www.w3.org/1999/xhtml"
       
    30             xmlns:reflect="reflect"
    46 
    31 
    47             /* Our namespace to invoke python code */
    32             /* Our namespace to invoke python code */
    48             xmlns:ns="beremiz"
    33             xmlns:ns="beremiz"
    49             extension-element-prefixes="ns func exsl regexp str dyn"
    34             extension-element-prefixes="ns func exsl regexp str dyn"
    50             exclude-result-prefixes="ns str regexp exsl func dyn" {
    35             exclude-result-prefixes="ns str regexp exsl func dyn reflect" {
    51 
    36 
    52 
    37 
    53     const "hmi_elements", "//svg:*[starts-with(@inkscape:label, 'HMI:')]";
    38     const "hmi_elements", "//svg:*[starts-with(@inkscape:label, 'HMI:')]";
    54 
    39 
    55     include hmi_tree.ysl2
    40     include hmi_tree.ysl2
    62 
    47 
    63     include widgets_common.ysl2
    48     include widgets_common.ysl2
    64 
    49 
    65     include widget_*.ysl2
    50     include widget_*.ysl2
    66 
    51 
       
    52     template "*[namespace-uri()='reflect']", mode="debug_as_comment" {
       
    53         comment {
       
    54             | «local-name()» :
       
    55             apply ".", mode="debug";
       
    56         }
       
    57     }
       
    58 
    67     template "/" {
    59     template "/" {
    68         comment > Made with SVGHMI. https://beremiz.org
    60         comment > Made with SVGHMI. https://beremiz.org
    69 
    61 
    70         // use python to call all debug output from included definitions
    62         // all debug output from included definitions, as comments
    71         python gen_debug_calls;
    63         // apply "document('')/*/reflect:*", mode="debug_as_comment";
    72 
    64 
    73         html xmlns="http://www.w3.org/1999/xhtml"
    65         html xmlns="http://www.w3.org/1999/xhtml"
    74              xmlns:svg="http://www.w3.org/2000/svg"
    66              xmlns:svg="http://www.w3.org/2000/svg"
    75              xmlns:xlink="http://www.w3.org/1999/xlink" {
    67              xmlns:xlink="http://www.w3.org/1999/xlink" {
    76             head;
    68             head;