Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

Commit

Permalink
Restructure plugin components
Browse files Browse the repository at this point in the history
Rewrite plugin definition, move resources around.
  • Loading branch information
siavashs committed Oct 24, 2020
1 parent 4a9c8e5 commit 89e1627
Show file tree
Hide file tree
Showing 5 changed files with 2,023 additions and 863 deletions.
5 changes: 3 additions & 2 deletions src/main/java/com/catawiki/jira/prism/Code.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,10 @@ public String execute(Map<String, Object> parameters, String body, RenderContext

try {
return this.soyTemplateRenderer.render(
"com.catawiki.jira.prism:handler",
"com.catawiki.jira.prism:soy",
"Prism.Macros.Code.html",
templateParams.build());
templateParams.build()
);
} catch (SoyException e) {
return String.format(FALLBACK_RENDER_OUTPUT, body);
}
Expand Down
51 changes: 18 additions & 33 deletions src/main/resources/atlassian-plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,50 +9,35 @@
<param name="plugin-logo">images/pluginLogo.png</param>
</plugin-info>

<!-- add our web resources -->
<web-resource key="prism" name="Prism Macro Init">
<context>jira.navigator.advanced</context>
<context>jira.navigator.simple</context>
<context>jira.view.issue</context>
<context>gh-rapid</context>

<dependency>${atlassian.plugin.key}:handler</dependency>
<macro key="code" class="com.catawiki.jira.prism.Code" name="{code} formatting macro">
<description>Syntax highlighting for code blocks.</description>
<param name="convert-selector">code-macro</param>
<param name="convert-function">Prism.Macros.Code.convert</param>
</macro>

<resource type="download" name="js/prism.js" location="js/prism.js"/>
<resource type="download" name="js/prism-init.js" location="js/prism-init.js"/>
</web-resource>
<component key="init" class="com.catawiki.jira.prism.Init" name="Prism Plugin Initialization">
<description>Helper module to enable/disable JIRA standard code macro on Prism plugin uninstall/install.</description>
</component>

<web-resource key="handler" name="Prism Plugin Context Init">
<!-- add our web resources -->
<web-resource key="soy" name="Prism Plugin Soy Transformer">
<context>jira.rich.editor</context>

<dependency>com.atlassian.jira.plugins.jira-editor-plugin:converter</dependency>

<resource name="soy/prism.soy.js" type="download" location="soy/prism.soy" />

<resource name="soy/prism.soy.js" type="download" location="soy/prism.soy"/>
<transformation extension="soy">
<transformer key="soyTransformer"/>
</transformation>
</web-resource>

<web-resource key="css" name="Prism CSS Resources">
<context>jira.navigator.advanced</context>
<context>jira.navigator.simple</context>
<context>jira.view.issue</context>
<context>gh-rapid</context>

<context>jira.general</context>
<resource type="download" name="css/prism.css" location="css/prism.css"/>
</web-resource>

<macro key='code' name='{code} formatting macro'
class='com.catawiki.jira.prism.Code'>
<description>Syntax highlighting for code blocks.</description>
<param name="convert-selector">code-macro</param>
<param name="convert-function">Prism.Macros.Code.convert</param>
</macro>

<component key="init" class="com.catawiki.jira.prism.Init"
name="Prism initialization support">
<description>Helper module to automatic disabling / enabling of Jira standard code macro on
installation or enabling / deinstallation or disabling of Prism Syntax Highlighter plugin</description>
</component>
<web-resource key="js" name="Prism JavaScript Resources">
<context>jira.general</context>
<dependency>${atlassian.plugin.key}:soy</dependency>
<resource type="download" name="js/prism-core.js" location="js/prismjs/prism.js"/>
<resource type="download" name="js/prism-event.js" location="js/event.js"/>
</web-resource>
</atlassian-plugin>
File renamed without changes.
Loading

0 comments on commit 89e1627

Please sign in to comment.