diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..9a874b5 Binary files /dev/null and b/.DS_Store differ diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..ec71df7 --- /dev/null +++ b/.classpath @@ -0,0 +1,690 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5231862 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.idea +*.iml +target diff --git a/.project b/.project new file mode 100644 index 0000000..ad46cbc --- /dev/null +++ b/.project @@ -0,0 +1,14 @@ + + + confluence-markdown-macro + This is the com.atlassian.plugins.confluence.markdown:confluence-markdown-macro plugin for Atlassian Confluence. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + + + org.eclipse.jdt.core.javabuilder + + + + org.eclipse.jdt.core.javanature + + \ No newline at end of file diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..3440d25 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +#Fri Jun 07 16:40:36 PDT 2013 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9c6ab63 --- /dev/null +++ b/LICENSE @@ -0,0 +1,6 @@ +To avoid future confusion, we recommend that you include a license with your plugin. +This file is simply a reminder. + +For a template license you can have a look at: http://www.opensource.org/licenses/ + +Atlassian releases most of its modules under the Apache2 license: http://opensource.org/licenses/Apache-2.0 diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..7491370 --- /dev/null +++ b/pom.xml @@ -0,0 +1,79 @@ + + + + 4.0.0 + com.atlassian.plugins.confluence.markdown + confluence-markdown-macro + 1.0-SNAPSHOT + + Atlassian + http://www.atlassian.com/ + + confluence-markdown-macro + This plugin provides a Markdown render macro for Confluence. + atlassian-plugin + + + junit + junit + 4.10 + test + + + com.atlassian.confluence + confluence + ${confluence.version} + provided + + + + com.atlassian.plugins + atlassian-plugins-osgi-testrunner + ${plugin.testrunner.version} + test + + + javax.ws.rs + jsr311-api + 1.1.1 + provided + + + com.google.code.gson + gson + 2.2.2-atlassian-1 + + + org.pegdown + pegdown + 1.2.1 + + + + + + com.atlassian.maven.plugins + maven-confluence-plugin + ${amps.version} + true + + ${confluence.version} + ${confluence.data.version} + + + + maven-compiler-plugin + + 1.6 + 1.6 + + + + + + 4.3.7 + 4.3.7 + 4.2.2 + 1.1 + + diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000..7b0d367 Binary files /dev/null and b/src/.DS_Store differ diff --git a/src/main/.DS_Store b/src/main/.DS_Store new file mode 100644 index 0000000..5ddc54c Binary files /dev/null and b/src/main/.DS_Store differ diff --git a/src/main/java/com/atlassian/plugins/confluence/markdown/MarkdownMacro.java b/src/main/java/com/atlassian/plugins/confluence/markdown/MarkdownMacro.java new file mode 100644 index 0000000..1369d5b --- /dev/null +++ b/src/main/java/com/atlassian/plugins/confluence/markdown/MarkdownMacro.java @@ -0,0 +1,70 @@ +package com.atlassian.plugins.confluence.markdown; + +import com.atlassian.confluence.content.render.xhtml.ConversionContext; +import com.atlassian.confluence.content.render.xhtml.DefaultConversionContext; +import com.atlassian.confluence.content.render.xhtml.XhtmlException; +import com.atlassian.confluence.macro.Macro; +import com.atlassian.confluence.macro.MacroExecutionException; +import com.atlassian.confluence.xhtml.api.MacroDefinition; +import com.atlassian.confluence.xhtml.api.MacroDefinitionHandler; +import com.atlassian.confluence.xhtml.api.XhtmlContent; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import com.atlassian.renderer.RenderContext; +import com.atlassian.renderer.v2.RenderMode; +import com.atlassian.renderer.v2.macro.BaseMacro; +import com.atlassian.renderer.v2.macro.MacroException; +import org.pegdown.Parser; +import org.pegdown.PegDownProcessor; + +public class MarkdownMacro extends BaseMacro implements Macro +{ + private final XhtmlContent xhtmlUtils; + + public MarkdownMacro(XhtmlContent xhtmlUtils) + { + this.xhtmlUtils = xhtmlUtils; + } + + @Override + public BodyType getBodyType() + { + return BodyType.PLAIN_TEXT; + } + + @Override + public OutputType getOutputType() + { + return OutputType.BLOCK; + } + + @Override + public String execute(Map parameters, String bodyContent, ConversionContext conversionContext) throws MacroExecutionException + { + PegDownProcessor translator = new PegDownProcessor(Parser.ALL); + String output = translator.markdownToHtml(bodyContent); + return output; + } + + @Override + public boolean hasBody() { + return true; //To change body of implemented methods use File | Settings | File Templates. + } + + @Override + public RenderMode getBodyRenderMode() { + return RenderMode.NO_RENDER; //To change body of implemented methods use File | Settings | File Templates. + } + + @Override + public String execute(Map map, String s, RenderContext renderContext) throws MacroException { + try { + return execute(map, s, new DefaultConversionContext(renderContext)); + } catch (MacroExecutionException e) { + throw new MacroException(e.getMessage(),e); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/atlassian/plugins/confluence/markdown/MyPluginComponent.java b/src/main/java/com/atlassian/plugins/confluence/markdown/MyPluginComponent.java new file mode 100644 index 0000000..ad75393 --- /dev/null +++ b/src/main/java/com/atlassian/plugins/confluence/markdown/MyPluginComponent.java @@ -0,0 +1,6 @@ +package com.atlassian.plugins.confluence.markdown; + +public interface MyPluginComponent +{ + String getName(); +} \ No newline at end of file diff --git a/src/main/resources/.DS_Store b/src/main/resources/.DS_Store new file mode 100644 index 0000000..2e63a17 Binary files /dev/null and b/src/main/resources/.DS_Store differ diff --git a/src/main/resources/atlassian-plugin.xml b/src/main/resources/atlassian-plugin.xml new file mode 100644 index 0000000..e47b080 --- /dev/null +++ b/src/main/resources/atlassian-plugin.xml @@ -0,0 +1,34 @@ + + + ${project.description} + ${project.version} + + images/pluginIcon.png + images/pluginLogo.png + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/confluence-markdown-macro.properties b/src/main/resources/confluence-markdown-macro.properties new file mode 100644 index 0000000..7f56fa2 --- /dev/null +++ b/src/main/resources/confluence-markdown-macro.properties @@ -0,0 +1,2 @@ +#put any key/value pairs here +my.plugin.name=Markdown \ No newline at end of file diff --git a/src/main/resources/css/confluence-markdown-macro.css b/src/main/resources/css/confluence-markdown-macro.css new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/images/.DS_Store b/src/main/resources/images/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/src/main/resources/images/.DS_Store differ diff --git a/src/main/resources/images/1pluginIcon.png b/src/main/resources/images/1pluginIcon.png new file mode 100644 index 0000000..798d9e2 Binary files /dev/null and b/src/main/resources/images/1pluginIcon.png differ diff --git a/src/main/resources/images/1pluginLogo.png b/src/main/resources/images/1pluginLogo.png new file mode 100644 index 0000000..48143ec Binary files /dev/null and b/src/main/resources/images/1pluginLogo.png differ diff --git a/src/main/resources/images/pluginIcon.png b/src/main/resources/images/pluginIcon.png new file mode 100644 index 0000000..fe8d936 Binary files /dev/null and b/src/main/resources/images/pluginIcon.png differ diff --git a/src/main/resources/images/pluginLogo.png b/src/main/resources/images/pluginLogo.png new file mode 100644 index 0000000..999714d Binary files /dev/null and b/src/main/resources/images/pluginLogo.png differ diff --git a/src/main/resources/js/confluence-markdown-macro.js b/src/main/resources/js/confluence-markdown-macro.js new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/markdownproperties/markdown.properties b/src/main/resources/markdownproperties/markdown.properties new file mode 100644 index 0000000..b1b5302 --- /dev/null +++ b/src/main/resources/markdownproperties/markdown.properties @@ -0,0 +1,3 @@ +com.atlassian.plugins.confluence.markdown.confluence-markdown-macro.markdown.desc=This macro renders text in Markdown syntax into HTML. +com.atlassian.plugins.confluence.markdown.confluence-markdown-macro.markdown.param.extended.label=Enable extended Markdown properties: +com.atlassian.plugins.confluence.markdown.confluence-markdown-macro.markdown.param.extended.desc=Find info about extended Markdown at: https://github.com/sirthias/pegdown#readme \ No newline at end of file diff --git a/src/main/resources/markdownproperties/markdown_de_DE.properties b/src/main/resources/markdownproperties/markdown_de_DE.properties new file mode 100644 index 0000000..247e086 --- /dev/null +++ b/src/main/resources/markdownproperties/markdown_de_DE.properties @@ -0,0 +1,3 @@ +com.atlassian.plugins.confluence.markdown.confluence-markdown-macro.markdown.desc=Dieses Makro wandelt Markdown in HTML um. +com.atlassian.plugins.confluence.markdown.confluence-markdown-macro.markdown.param.extended.label=Aktivieren sich weiter Eigenschaften Markdown: +com.atlassian.plugins.confluence.markdown.confluence-markdown-macro.markdown.param.extended.desc=Befindet sich information \u00FCber Extended Markdown: https://github.com/sirthias/pegdown#readme \ No newline at end of file diff --git a/src/main/resources/markdownproperties/markdown_fr_FR.properties b/src/main/resources/markdownproperties/markdown_fr_FR.properties new file mode 100644 index 0000000..c6ae523 --- /dev/null +++ b/src/main/resources/markdownproperties/markdown_fr_FR.properties @@ -0,0 +1,3 @@ +com.atlassian.plugins.confluence.markdown.confluence-markdown-macro.markdown.desc=Ce macro converti le text format\u00E9 selon Markdown vers HTML +com.atlassian.plugins.confluence.markdown.confluence-markdown-macro.markdown.param.extended.label=Activez les propri\u00E9t\u00E9s avanc\u00E9es de Markdown:Pour plus d'information sur +com.atlassian.plugins.confluence.markdown.confluence-markdown-macro.markdown.param.extended.desc=Pour plus d'information sur les propri\u00E9t\u00E9s avanc\u00E9es de Markdown: https://github.com/sirthias/pegdown#readme \ No newline at end of file