}
public static void createPage(IFile file) {
+ String templateFileName = Util.getLocalTemplate(file);
String srcBasePath = Util.getWikiTextsPath(file);
String binBasePath = Util.getProjectsWikiOutputPath(file.getProject(), WikiEditorPlugin.HTML_OUTPUT_PATH);
- createPage(file, binBasePath, srcBasePath);
+ createPage(templateFileName, file, binBasePath, srcBasePath);
}
- public static void createPage(IFile file, String binBasepath, String srcBasePath) {
+ public static void createPage(String templateFileName, IFile file, String binBasepath, String srcBasePath) {
// only interested in files with the "wp" extension
if ("wp".equalsIgnoreCase(file.getFileExtension())) {
try {
IContentRenderer renderer = RendererFactory.createContentRenderer(file.getProject());
- convertWikiFile(file, binBasepath, srcBasePath, renderer);
+ convertWikiFile(templateFileName, file, binBasepath, srcBasePath, renderer);
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
- public static void convertWikiFile(IFile file, String binBasePath, String srcBasePath, IContentRenderer renderer)
+ public static void convertWikiFile(String templateFileName, IFile file, String binBasePath, String srcBasePath, IContentRenderer renderer)
throws CoreException {
StringBuffer htmlBuffer = new StringBuffer();
- convertWikiBuffer(htmlBuffer, file, renderer, true);
+ convertWikiBuffer(templateFileName, htmlBuffer, file, renderer, true);
String htmlName = Util.getHTMLFileName(file, binBasePath, srcBasePath);
if (htmlName != null) {
writeHTMLFile(htmlBuffer, htmlName);
return;
}
- public static void convertWikiBuffer(StringBuffer htmlBuffer, IFile file, IContentRenderer renderer, boolean completeHTML)
+ public static void convertWikiBuffer(String templateFileName, StringBuffer htmlBuffer, IFile file, IContentRenderer renderer, boolean completeHTML)
throws CoreException {
BufferedInputStream stream = new BufferedInputStream(file.getContents());
try {
if (filePath.startsWith(srcPath)) {
filePath = filePath.substring(srcPath.length()+1);
}
- createWikiBuffer(htmlBuffer, filePath, content, renderer, completeHTML);
+ createWikiBuffer(templateFileName, htmlBuffer, filePath, content, renderer, completeHTML);
} catch (IOException e) {
e.printStackTrace();
} finally {
* @param content
* @param renderer
*/
- public static void createWikiBuffer(StringBuffer htmlBuffer, String fileName, String content, IContentRenderer renderer,
+ public static void createWikiBuffer(String templateFileName, StringBuffer htmlBuffer, String fileName, String content, IContentRenderer renderer,
boolean completeHTML) {
// calculate the <i>depth</i> of the file (i.e. ../../../ as much as needed)
int index = 0;
index++;
}
}
- renderer.render(content, htmlBuffer, level, completeHTML);
+ renderer.render(templateFileName, content, htmlBuffer, level, completeHTML);
}
public static void writeHTMLFile(StringBuffer buffer, String filename) {