Changeset 683


Ignore:
Timestamp:
2008-10-08 10:53:38 (5 years ago)
Author:
jgou
Message:

KTL: first implementation of new feature: import

Location:
trunk/universe/kauri-template/src
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/universe/kauri-template/src/main/java/org/kauriproject/template/DefaultTemplateBuilder.java

    r674 r683  
    278278                            localName, name, attributes), templateService); 
    279279                    pushBlock(includeblock); 
     280                } else if (Directive.IMPORT == directive) { 
     281                    ImportBlock importblock = new ImportBlock(elFacade, locator, new SaxElement(uri, 
     282                            localName, name, attributes), templateService); 
     283                    pushBlock(importblock); 
    280284                } else if (Directive.VARIABLE == directive) { 
    281285                    VariableBlock varblock = new VariableBlock(elFacade, locator, new SaxElement(uri, 
  • trunk/universe/kauri-template/src/main/java/org/kauriproject/template/Directive.java

    r644 r683  
    6767    INCLUDE("include"), 
    6868    /** 
     69     * directive to import another template<br> 
     70     * import src="template-location" 
     71     */ 
     72    IMPORT("import"), 
     73    /** 
    6974     * directive to create a variable<br> 
    7075     * variable name="foo" [value="bar"] 
     
    120125        else if (name.equals(INCLUDE.tagName)) 
    121126            return INCLUDE; 
     127        else if (name.equals(IMPORT.tagName)) 
     128            return IMPORT; 
    122129        else if (name.equals(VARIABLE.tagName)) 
    123130            return VARIABLE; 
  • trunk/universe/kauri-template/src/main/java/org/kauriproject/template/DocumentBlock.java

    r656 r683  
    7878            if (inc != null) { 
    7979                // import or include 
    80                 Step next = inc.getEndStep().getCompiledNext(); 
     80                Step next = inc.getEndStep(); 
    8181                // remove mapping because of recursion detection 
    8282                includeRegistry.remove(key); 
  • trunk/universe/kauri-template/src/main/java/org/kauriproject/template/IfBlock.java

    r487 r683  
    7575        public Step executeAndProceed(ExecutionContext context, TemplateResult result) { 
    7676 
    77             // final boolean test = (Boolean) elFacade.evaluateExpression(elExpression, context); 
    7877            final boolean test = (Boolean) elExpression.evaluate(context.getTemplateContext()); 
    7978 
  • trunk/universe/kauri-template/src/test/java/org/kauriproject/template/TemplateExecutionTest.java

    r657 r683  
    102102        testFlow("/org/kauriproject/template/comment.xml", true); 
    103103    } 
    104      
     104 
    105105    public void testMacro() throws Exception { 
    106106        testFlow("/org/kauriproject/template/macro.xml", true); 
    107107    } 
    108      
     108 
    109109    public void testInclude() throws Exception { 
    110110        testFlow("/org/kauriproject/template/include.xml", true); 
     111    } 
     112 
     113    public void testImport() throws Exception { 
     114        testFlow("/org/kauriproject/template/import.xml", true); 
    111115    } 
    112116 
     
    121125        testFlow("/org/kauriproject/template/dropprefix3.xml", true); 
    122126 
    123         //test drop mapping which is still used in the document 
     127        // test drop mapping which is still used in the document 
    124128        testFlow("/org/kauriproject/template/dropprefix4.xml", true); 
    125129 
    126         //test drop mapping which is still used in the document, attrs with same local name 
     130        // test drop mapping which is still used in the document, attrs with same local name 
    127131        testFlow("/org/kauriproject/template/dropprefix4a.xml", true); 
    128132 
Note: See TracChangeset for help on using the changeset viewer.