Commiting v1 of the source

This commit is contained in:
bberenberg
2013-06-20 18:07:32 -07:00
parent e3cfc168b4
commit d366ccc9d7
24 changed files with 918 additions and 0 deletions

BIN
src/main/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -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<String, String> 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);
}
}
}

View File

@@ -0,0 +1,6 @@
package com.atlassian.plugins.confluence.markdown;
public interface MyPluginComponent
{
String getName();
}

BIN
src/main/resources/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,34 @@
<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2">
<plugin-info>
<description>${project.description}</description>
<version>${project.version}</version>
<vendor name="${project.organization.name}" url="${project.organization.url}" />
<param name="plugin-icon">images/pluginIcon.png</param>
<param name="plugin-logo">images/pluginLogo.png</param>
</plugin-info>
<xhtml-macro name="markdown"
class="com.atlassian.plugins.confluence.markdown.MarkdownMacro"
key="markdown"
icon="/download/resources/com.atlassian.plugins.confluence.markdown.confluence-markdown-macro/images/pluginIcon.png"
documentation-url="http://daringfireball.net/projects/markdown/">
<category name="formatting"/>
<parameters>
<parameter name="extended" type="boolean" default ="true">
</parameter>
</parameters>
</xhtml-macro>
<macro name="markdown"
class="com.atlassian.plugins.confluence.markdown.MarkdownMacro"
key="markdown.wiki"
icon="/download/resources/com.atlassian.plugins.confluence.markdown.confluence-markdown-macro/images/pluginIcon.png"
documentation-url="http://daringfireball.net/projects/markdown/">
<category name="formatting"/>
<parameters>
<parameter name="extended" type="boolean" default ="true">
</parameter>
</parameters>
</macro>
<resource type="i18n" name="markdown" location="markdownproperties/markdown"/>
<resource type="download" name="images/" key="images" location="images/"/>
</atlassian-plugin>

View File

@@ -0,0 +1,2 @@
#put any key/value pairs here
my.plugin.name=Markdown

BIN
src/main/resources/images/.DS_Store vendored Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 958 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -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: <a href="https://github.com/sirthias/pegdown#readme">https://github.com/sirthias/pegdown#readme</a>

View File

@@ -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: <a href="https://github.com/sirthias/pegdown#readme">https://github.com/sirthias/pegdown#readme</a>

View File

@@ -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: <a href="https://github.com/sirthias/pegdown#readme">https://github.com/sirthias/pegdown#readme</a>