public DelegatingTemplateEngine(final ContentStore db, final JBakeConfiguration config) { super(config, db); this.renderers = new TemplateEngines(config, db); }
public TemplateEngines(final JBakeConfiguration config, final ContentStore db) { engines = new HashMap<>(); loadEngines(config, db); }
private void registerEngine(final JBakeConfiguration config, final ContentStore db, String className, String... extensions) { AbstractTemplateEngine engine = tryLoadEngine(config, db, className); if (engine != null) { for (String extension : extensions) { registerEngine(extension, engine); } } } }
for (String extension : renderers.getRecognizedExtensions()) { templateFile = new File(templateFolder, templateNameWithoutExt + "." + extension); if (templateFile.exists()) { AbstractTemplateEngine engine = renderers.getEngine(ext); if (engine != null) { engine.renderDocument(model, templateName, writer);
/** * This method is used internally to load markup engines. Markup engines are found using descriptor files on * classpath, so adding an engine is as easy as adding a jar on classpath with the descriptor file included. */ private void loadEngines(final JBakeConfiguration config, final ContentStore db) { try { ClassLoader cl = TemplateEngines.class.getClassLoader(); Enumeration<URL> resources = cl.getResources("META-INF/org.jbake.parser.TemplateEngines.properties"); while (resources.hasMoreElements()) { URL url = resources.nextElement(); Properties props = new Properties(); props.load(url.openStream()); for (Map.Entry<Object, Object> entry : props.entrySet()) { String className = (String) entry.getKey(); String[] extensions = ((String) entry.getValue()).split(","); registerEngine(config, db, className, extensions); } } } catch (IOException e) { LOGGER.error("Error loading engines", e); } }
for (String extension : renderers.getRecognizedExtensions()) { templateFile = new File(templateFolder, templateNameWithoutExt + "." + extension); if (templateFile.exists()) { AbstractTemplateEngine engine = renderers.getEngine(ext); if (engine != null) { engine.renderDocument(model, templateName, writer);
/** * This method is used internally to load markup engines. Markup engines are found using descriptor files on * classpath, so adding an engine is as easy as adding a jar on classpath with the descriptor file included. */ private void loadEngines(final JBakeConfiguration config, final ContentStore db) { try { ClassLoader cl = TemplateEngines.class.getClassLoader(); Enumeration<URL> resources = cl.getResources("META-INF/org.jbake.parser.TemplateEngines.properties"); while (resources.hasMoreElements()) { URL url = resources.nextElement(); Properties props = new Properties(); props.load(url.openStream()); for (Map.Entry<Object, Object> entry : props.entrySet()) { String className = (String) entry.getKey(); String[] extensions = ((String) entry.getValue()).split(","); registerEngine(config, db, className, extensions); } } } catch (IOException e) { LOGGER.error("Error loading engines", e); } }
private void registerEngine(final JBakeConfiguration config, final ContentStore db, String className, String... extensions) { AbstractTemplateEngine engine = tryLoadEngine(config, db, className); if (engine != null) { for (String extension : extensions) { registerEngine(extension, engine); } } } }
/** * @deprecated Use {@link #DelegatingTemplateEngine(ContentStore, JBakeConfiguration)} instead. */ @Deprecated public DelegatingTemplateEngine(final CompositeConfiguration config, final ContentStore db, final File destination, final File templatesPath) { super(config, db, destination, templatesPath); this.renderers = new TemplateEngines(this.config, db); }
public TemplateEngines(final JBakeConfiguration config, final ContentStore db) { engines = new HashMap<>(); loadEngines(config, db); }
public DelegatingTemplateEngine(final ContentStore db, final JBakeConfiguration config) { super(config, db); this.renderers = new TemplateEngines(config, db); }
/** * @deprecated Use {@link #DelegatingTemplateEngine(ContentStore, JBakeConfiguration)} instead. */ @Deprecated public DelegatingTemplateEngine(final CompositeConfiguration config, final ContentStore db, final File destination, final File templatesPath) { super(config, db, destination, templatesPath); this.renderers = new TemplateEngines(this.config, db); }