SUIT Framework

Scripting Using Integrated Templates

Docs - close

07/31/2010: SUIT 2.0.1 and Rulebox 1.1.0 released.

Available Since: SUIT (2.0.0)

Handle the closing of a rule.

Syntax dict suit.close ( dict rules, str append, dict pop, list tree )
Parameters
rules

The rules used to determine how to add the string.

append

The string to add.

pop

The last item of the tree's contents.

tree

The contents of the tree.

Return Value

A dict with the following format:

Key Description
skip str: The skip rule, if opened.
tree list: The contents of the tree with the appended data.
Examples
Basic Usage
PHP
<?php
require 'suit.class.php';
require 'templating.class.php';
$suit = new SUIT();
$templating = new Templating($suit);
tree = array
(
    array
    (
        'contents' => array(),
        'rule' => '[var]'
    )
);
$pop = array_pop(tree);
$result = $suit->close($templating->rules, 'username', $pop, $tree);
/*
Result: array
(
    'skip' => false,
    'tree' => array
    (
        array
        (
            'contents' => array('username'),
            'rule' => '[var]'
        )
    )
)
*/
?>
Python
import suit
from rulebox import templating # easy_install rulebox
tree = [
    {
        'contents': [],
        'rule': '[var]'
    }
]
pop = tree.pop()
result = suit.close(templating.rules, 'username', pop, tree)
# Result: {
#     'skip': False,
#     'tree':
#     [
#         {
#             'contents': ['username'],
#             'rule': '[var]'
#         }
#     ]
# }
See Also