org.jbake.render.IndexRenderer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jbake-core Show documentation
Show all versions of jbake-core Show documentation
JBake is a Java based open source static site/blog generator for developers.
package org.jbake.render;
import org.apache.commons.configuration2.CompositeConfiguration;
import org.jbake.app.ContentStore;
import org.jbake.app.Renderer;
import org.jbake.app.configuration.JBakeConfiguration;
import org.jbake.app.configuration.JBakeConfigurationFactory;
import org.jbake.template.RenderingException;
import java.io.File;
public class IndexRenderer implements RenderingTool {
@Override
public int render(Renderer renderer, ContentStore db, JBakeConfiguration config) throws RenderingException {
if (config.getRenderIndex()) {
try {
String fileName = config.getIndexFileName();
//TODO: refactor this. the renderer has a reference to the configuration
if (config.getPaginateIndex()) {
renderer.renderIndexPaging(fileName);
} else {
renderer.renderIndex(fileName);
}
return 1;
} catch (Exception e) {
throw new RenderingException(e);
}
} else {
return 0;
}
}
@Override
public int render(Renderer renderer, ContentStore db, File destination, File templatesPath, CompositeConfiguration config) throws RenderingException {
JBakeConfiguration configuration = new JBakeConfigurationFactory().createDefaultJbakeConfiguration(templatesPath.getParentFile(), config);
return render(renderer, db, configuration);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy