X-Git-Url: http://git.phpeclipse.com diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/builder/CreatePageAction.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/builder/CreatePageAction.java index 9fc589c..c1590a8 100644 --- a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/builder/CreatePageAction.java +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/builder/CreatePageAction.java @@ -88,17 +88,18 @@ public class CreatePageAction implements IObjectActionDelegate { } 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(); @@ -159,10 +160,10 @@ public class CreatePageAction implements IObjectActionDelegate { } } - 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); @@ -188,7 +189,7 @@ public class CreatePageAction implements IObjectActionDelegate { 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 { @@ -198,7 +199,7 @@ public class CreatePageAction implements IObjectActionDelegate { 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 { @@ -217,7 +218,7 @@ public class CreatePageAction implements IObjectActionDelegate { * @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 depth of the file (i.e. ../../../ as much as needed) int index = 0; @@ -229,7 +230,7 @@ public class CreatePageAction implements IObjectActionDelegate { index++; } } - renderer.render(content, htmlBuffer, level, completeHTML); + renderer.render(templateFileName, content, htmlBuffer, level, completeHTML); } public static void writeHTMLFile(StringBuffer buffer, String filename) {