1 37 package org.webharvest.runtime.processors; 38 39 import org.webharvest.definition.TemplateDef; 40 import org.webharvest.runtime.Scraper; 41 import org.webharvest.runtime.ScraperContext; 42 import org.webharvest.runtime.templaters.BaseTemplater; 43 import org.webharvest.runtime.variables.IVariable; 44 import org.webharvest.runtime.variables.NodeVariable; 45 46 50 public class TemplateProcessor extends BaseProcessor { 51 52 private TemplateDef templateDef; 53 54 public TemplateProcessor(TemplateDef templateDef) { 55 super(templateDef); 56 this.templateDef = templateDef; 57 } 58 59 public IVariable execute(Scraper scraper, ScraperContext context) { 60 IVariable body = getBodyTextContent(templateDef, scraper, context); 61 62 String result = BaseTemplater.execute(body.toString(), scraper.getScriptEngine()); 63 64 return new NodeVariable(result); 65 } 66 67 } | Popular Tags |