package cn.reghao.tnb.auth.app.template.layout;

import cn.reghao.tnb.auth.app.template.DirectiveHandler;
import cn.reghao.tnb.auth.app.template.TemplateDirective;
import org.springframework.stereotype.Component;

/**
 * @since 4.0.0
 */
@Component
public class ExtendsDirective extends TemplateDirective {
    @Override
    public String getName() {
        return "layout.extends";
    }

    @Override
    public void execute(DirectiveHandler handler) throws Exception {
        String layoutName =  handler.getString("name");
        handler.bodyResult();
        handler.getEnv().include(layoutName, null, true);
    }

}
