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); } } } }
/** * 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); } } } }
/** * 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); } }