Package webit.script

Examples of webit.script.Engine


    public void resetEngine() {
        this.engine = null;
    }

    public Engine getEngine() {
        Engine engine;
        if ((engine = this.engine) != null) {
            return engine;
        }
        return this.engine = ServletEngineUtil.createEngine(
                this.servletContextProvider.getServletContext(),
View Full Code Here


*/
public class TrimBlankLineTest {

    @Test
    public void test() throws ResourceNotFoundException {
        Engine engine = EngineManager.getEngine();
        DiscardOut out = new DiscardOut();

        engine.setTrimCodeBlockBlankLine(true);
        Template template = engine.getTemplate("/trimBlankLine.wit");

        Map<String, Object> param = new HashMap<String, Object>(4);
        param.put("trimBlankLine", true);
        template.merge(KeyValuesUtil.wrap(param), out);

        engine.setTrimCodeBlockBlankLine(false);
        template.reset();

        param.put("trimBlankLine", false);
        template.merge(KeyValuesUtil.wrap(param), out);

View Full Code Here

*/
public class ShareDataTest {

    @Test
    public void test() throws ResourceNotFoundException {
        Engine engine = EngineManager.getEngine();
        try {
            engine.setShareRootData(true);

            Template template = engine.getTemplate("/shareData.wit");
            template.reload();
            template.merge(KeyValuesUtil.wrap(new String[]{"v1", "v2"}, new Object[]{"V1", "V2"}), new DiscardOut());
        } finally {
            engine.setShareRootData(false);
        }
    }
View Full Code Here

*/
public class LooseVarTest {

    @Test
    public void test() throws ResourceNotFoundException {
        Engine engine = EngineManager.getEngine();
        try {
            engine.setLooseVar(true);
           
            Template template = engine.getTemplate("/looseVar.wit");
            template.merge(new DiscardOut());
        } finally {
            engine.setLooseVar(false);
        }
    }
View Full Code Here

     * @return TemplateAST
     * @throws ParseException
     */
    public TemplateAST parse(final Template template) throws ParseException {
        Lexer lexer = null;
        final Engine myEngine = template.engine;
        final Resource resource = template.resource;
        final TextStatementFactory textStatFactory = myEngine.getTextStatementFactory();
        this.template = template;
        this.engine = myEngine;
        this.textStatementFactory = textStatFactory;
        this.locateVarForce = !myEngine.isLooseVar();
        this.nativeFactory = myEngine.getNativeFactory();
        this.varmgr = new VariantManager(myEngine);
        this.currentLabelIndex = 0;
        this.labelsIndexMap.put(null, 0);
        try {
            //ISSUE: LexerProvider
            lexer = new Lexer(resource.openReader());
            lexer.setTrimCodeBlockBlankLine(myEngine.isTrimCodeBlockBlankLine());
            if (resource instanceof ResourceOffset) {
                lexer.setOffset((ResourceOffset) resource);
            } else {
                lexer.setOffset(0, 0);
            }
View Full Code Here

TOP

Related Classes of webit.script.Engine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.