1 package net.sourceforge.phpeclipse.wiki.builder;
3 import net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin;
4 import net.sourceforge.phpeclipse.wiki.preferences.Util;
6 import org.eclipse.core.resources.IProject;
7 import org.eclipse.core.runtime.IPath;
8 import org.radeox.api.engine.WikiRenderEngine;
9 import org.radeox.api.engine.context.InitialRenderContext;
10 import org.radeox.api.engine.context.RenderContext;
11 import org.radeox.engine.BaseRenderEngine;
12 import org.plog4u.wiki.filter.FilterUtil;
14 public class BuilderRenderEngine extends BaseRenderEngine implements WikiRenderEngine {
21 public BuilderRenderEngine(IProject project, InitialRenderContext context) {
24 fPath = fProject.getFullPath();
31 * the absolute basepath or <code>null</code>
33 * the name of the wiki link
35 * the file extension of the wiki text ( *.wp prefered )
36 * @param createHTMLLevel -
37 * if true prepend the directory level before the link i.e. <code>../../</code>
40 public String createHTMLLink(String location, String name, String extension, boolean createHTMLLevel) {
41 return FilterUtil.createHTMLLink(location, name, extension, createHTMLLevel, fLevel);
44 public boolean exists(String name) {
46 java.io.File file = new java.io.File(createHTMLLink(Util.getWikiTextsPath(fProject), name, "wp", false));
48 // return name.equals("SnipSnap") || name.equals("stephan");
51 public boolean showCreate() {
55 public void appendLink(StringBuffer buffer, String name, String view, String anchor) {
56 String basePath = Util.getProjectsWikiOutputPath(fProject, WikiEditorPlugin.HTML_OUTPUT_PATH);
57 // String basePath = WikiEditorPlugin.getDefault().getPreferenceStore().getString(WikiConstants.HTML_OUTPUT_PATH);
58 buffer.append("<a href=\"");
59 buffer.append(createHTMLLink(null, name, "html", true));
61 buffer.append(anchor);
64 buffer.append("</a>");
65 //buffer.append("link:"+name+"|"+view+"#"+anchor);
68 public void appendLink(StringBuffer buffer, String name, String view) {
69 String basePath = Util.getProjectsWikiOutputPath(fProject, WikiEditorPlugin.HTML_OUTPUT_PATH);
70 // String basePath = WikiEditorPlugin.getDefault().getPreferenceStore().getString(WikiConstants.HTML_OUTPUT_PATH);
71 buffer.append("<a href=\"");
72 buffer.append(createHTMLLink(null, name, "html", true));
75 buffer.append("</a>");
76 // buffer.append("link:" + name + "|" +view);
79 public void appendCreateLink(StringBuffer buffer, String name, String view) {
80 // if showCreate is true this method will be used to create a link to a
81 // "Wiki creationpage"
84 // buffer.append("'").append(name).append("' - ");
85 // buffer.append("'").append(Encoder.escape(name)).append("'");
88 public String getName() {
89 return "BuilderRenderEngine";
92 public void setLevel(int level) {