Home - ntbuzz/Pawmoo GitHub Wiki

SECTION Template Format

This page is being edited.

Section Statement Syntax BNF(?)

section:
    token

token:
    tag-token           have array or scalar
    command-token       habe array or scalar
    set-variable        have array or scalar
    text                numeric-key scalar

set-variable:
    $name => value
    $name => [
        value
        ...
    ]

tag-token:
    tag_identifier => value
    tag_identifier => [
    	attr-name:attr-value		scalar value in ':' separated
        attr-name => value          scalar-value
        attr-name => [              array value list
            value
            ....
        ]
        innerText                   scalar value without ARRAY-KEY
        [ section ]                 array value without ARRAY-KEY
        section                     for sub-section
    ]

attr-name:
    Alphabet Only character string.

tag-identifier:
    tag.name#name:digit[name](value){element}    Only 'tag' must be last char will priod(.)

command-token:                      Elements are interpreted differently for each command.
    command-identifier => value
    command-identifier => [
        value
        identifier => value
        identifier => [
            value
            ...
        ]
        section                     for sub-section
    ]

command-identifier:
    <       HTML tag direct
    *       Comment
    @       Template file import
    &       Helper method call
    -       single-repeat tag (for <meta>,etc...)
    %       Hyper-Link
    ?       Switch SECTION
    +       Built-In command

Switch SECTION:
    ?"Judgment-value" => [  
        ''   => [ Section ]            // Execute when empty value
        '*'  => [ Section ]            // Execute when contains some value
        Compare-String => [ Section ]  // Execute when equal to
    ]
    ?&Helper-Method                    // Helper method must return the SECTION format.

HTML tag direct:
    <HTML text >                        // normal HTML definition.

Comment:
    *message
    * => [                              // Array elements will be concatenate strings.
        message
        ...
    ]

Template file:
    @Template                           // no enviroment variable
    @Template  => [                     // argument will be Local Variable.
        key => Value                    // The template variable that references Value is ${key}.
    ]
    @.Template                          // inline-template or external template.

Helper Method Call:
    &MethodName                         // no argument
    &MethoName => [                     // argument will be key-array
        key => value                    // To refer 'value', $argv['key']
    ]

Single-Repeat Tag:
    -tag_identifier                     // HTML single Tag output, ex. <BR>,...
    -tag_identifier => [                // 
        common-attribute                // The same attribute for each element.
        [ additinal-attribute ]         // Attributes specific to repeat tags.
        ...
    ]

Hyper-Link:
    %link => [                          // array will be multi HyperLink elements.
        innerText => URL
        ...
    ]
    %innerText => URL

built-in command:
    +setvar         Set Variable in Template GLOBAL
    +include        Include JS and CSS files   
    +echo           Value as it is output a list of, ignore even if you specify the key name   
    +style          Value to output a list of as a style sheet   
    +jquery         Value the list of JQuery to output as a function   
    +img            Image Tag output
    +ul/ol          UL/OL tag dedicated list output, scalar elements can be output as list items 
    +dl             DL list of tag-only output
    +select         Output dedicated to SELECT tag  
    +table          Output dedicated to TABLE tag 
    +radio          INPUT RADIO tag dedicated list output
    +checkbox       INPUT CHECKBOX tag dedicated list output,allow in two-fomart
    +inline.SecName Inline layout section definition. Can be reused by calling a template
    +markdown       Text Outputs a formatted Text as a simple markdown. (*)
    +recordset      Repeat Section for each record read
    +tabset         Tabset output using <ul> tag 
    +floatwin       for floatWindow simple description command

(*) Markdown Syntax is See Markdown Page.

Built-In command specification.

+setvar                             // Set Variable in Template GLOBAL
    +setvar => [
        varname => value            // Template GLOBAL variable that references Value is ${varname}.
        ...
        ]

+include                            // Include JS and CSS files
    +include => [
        filename                    // Include tags are automatically identified by extension(js/css/ico).
        ...
    ]

+echo                               // echo messages.
    +echo => Message
    +echo => [                      // The array outputs only the values concatenated.
        Message
        ...
    ]

+style                              // output <style>...</style>
    +style => [
        value                       // The elements values will be concatenated strings.
        ...
    ]

+jquery                             // Output JQuery function
    +jquery => [                    // <script> $(function() { ... }); </script>
        value
        ...
    ]

+img                                // Image Tag output,allowed to add tag attributes to the command name.
    +img => URL                     // ex:  +img.class#id => URL
    +img => [
        attribule => value          // When the attribute is not included in the tag.
        URL
    ]

+ul/ol                              // UL/OL tag dedicated list output
    +ul/ol => [
        attr => value               // ul/ol tag attribute
        list-text                   // scalar: <li> list-text </li>
        .XXX#DDD => [               // LI tag with attributem, it can be omitted.
            section                 // LI tag inner section.
        ]
        ...
    ]

+dl                                 // DL list of tag-only output
    +dl => [
        attr => value               // dl tag attribute
        [   dt-texxt                // scalar: DT tag innerText
            dt-attr => value        // DT tag attribute
            .XXX#DDD => [           // DD tag with class/id attribute, it can be omitted.
                dd-attr => value    // DD tag attribute
                [ section  ]        // DD section
            ] 
        ]
    ]

+select                             // Output dedicated to SELECT tag  
    +select => [
        selected_key = > [          // default selected item value
            option_text => value    // option tag text,and value
            ...
        ]
    ]

+table                              // Output dedicated to TABLE tag 
    +table => [
        .XXX#DDD => [               // TR tag with attribute
            th => TEXT              // TH cell, TEXT willbe innerText
            th => [ section ]       // TH cell with section
            [ section ]             // empty key will be TD cell secion
            .td_attr => [ section ] // or attribute only too.
        ]
        ...                         // repeat TR section
    ]

+radio                              // INPUT RADIO tag dedicated list output
    +radio[name] => [               // radio button group-name
        attr => value               // other attribute
        checked-value => [          // same value as checked-value is checked.
            text => value           // radio button with text displayed.
            ...
        ]
    ]

+checkbox                           // INPUT CHECKBOX tag dedicated list output,allow in two-fomart
    FORMAT-I:                       // tag with name attribute,or name attribute element
    +checkbox[name] => [
        { name=TEXT }               // if tag identigier name attribute nothing.
        @Value => TEXT              // display checkbox TEXT,and when checked-value Value
        [ STR => value ]            // compare STR and value, same as CHECKED
    ]
    FORMAT-II:                      // tag without name attribute, name is elements key
    +checkbox => [
        name1 => [                  // first checkbox-item, Other attributes are the same as FORMAT-I.
            @Value1=>TEXT
            [ STR1 => value1 ]
        ]
        name2 => ...                // seconde element, ...
    ]

+inline                             // Inline layout section definition. Can be reused by calling a template
    +inline.SecName => [            // Secname will be Template Name, using as @.SecName
        section
    ]

+markdown                           // Text Outputs a formatted Text as a simple markdown. (*)
    +markdown => Text               // Convert to Markdown text to HTML
    +markdown.my_markdown => Text   // with markdown block class is 'my_markdown'

+recordset                          // Repeat Section for each record read
    +recordset => [ Section ]       // repeat each $Records[] in Model class, record data will be $RecData
    +recordset[:PropName] => [      // repeat as Model class property 'PropName'
        Section                     //   for example, [:Select] is $Model->Select throw in $RecData
    ]

+tabset                             // Tabset output using <ul> tag 
    +tabset => [
        Title1 => [ Section ]      // Title1 will be selection Tab text, and Section is TabContents
        ...                        // this command need 'tabset.js', or implement yourself.
    ]

+floatwin                          // for floatWindow simple description command
    +floatwin.class#id => [
        Window-Title               // Tilte bar text
        [ Section ]                // Window Contents
    ]

⚠️ **GitHub.com Fallback** ⚠️