packages/okam-build/lib/processor/template/plugins/helper.js
function transform(transformers, element, tplOpts, options) {
    let {config} = tplOpts;
    let onTag = config.onTag;
    if (onTag) {
        onTag(element.name);
    }

    // transform element first
    let transformer = findMatchElemTransformer(transformers.element, element);
    transformer && transformer.call(this, element, tplOpts, options);

    if (element.removed) {
        return;
    }

    // transform element attributes
    let {attribs: attrs} = element;
    attrs && Object.keys(attrs).forEach(k => {
        transformer = findMatchAttrTransformer(transformers.attribute, k);
        if (transformer) {
            transformer.call(this, attrs, k, tplOpts, options, element);
            if (transformer.type === 'for') {
                element.hasForLoop = true;
            }
        }
    });
}
function transform(transformers, element, tplOpts, options) {
    let {config} = tplOpts;
    let onTag = config.onTag;
    if (onTag) {
        onTag(element.name);
    }

    // transform element first
    let transformer = findMatchElemTransformer(transformers.element, element);
    transformer && transformer.call(this, element, tplOpts, options);

    if (element.removed) {
        return;
    }

    // transform element attributes
    let {attribs: attrs} = element;
    attrs && Object.keys(attrs).forEach(k => {
        transformer = findMatchAttrTransformer(transformers.attribute, k);
        if (transformer) {
            transformer.call(this, attrs, k, tplOpts, options, element);
            if (transformer.type === 'for') {
                element.hasForLoop = true;
            }
        }
    });
}
Transform the given template element

@param {Object} transformers the custom transformers
@param {Object} element the element to be visited currently
@param {Object} tplOpts the template transform options
@param {Object} options the template transform plugin options