Skip to content

Instantly share code, notes, and snippets.

@gregmac
Last active May 4, 2017 21:24
Show Gist options
  • Save gregmac/fa89a3d86dcb1a008153 to your computer and use it in GitHub Desktop.
Save gregmac/fa89a3d86dcb1a008153 to your computer and use it in GitHub Desktop.
Confluence UML Sequence Diagram user macro
## Macro title: UML Sequence Diagram
## Macro has a body: Y
## Body processing: Unrendered
##
## This macro allows use of js-sequence-diagrams from http://bramp.github.io/js-sequence-diagrams/
##
## Developed by: Greg MacLellan
## Date created: 2015-09-15
## 2015-09-21: Added suppor for displaying parse errors while rendering
## Installed by: Greg MacLellan
## @param Theme:title=Theme|type=enum|required=true|enumValues=Hand drawn,Simple
#set( $id = $action.dateFormatter.calendar.timeInMillis)
<div id="diagram$id" class="sequence-diagram" data-sequence-theme="$paramTheme" style="font-family: monospace; white-space: pre;">$body</div>
<script type="text/javascript">
jQuery(function() {
if (typeof sequenceInitalized == "undefined") {
sequenceInitalized = true;
jQuery.getScript("https://cdn.rawgit.com/bramp/js-sequence-diagrams/gh-pages/js/raphael-min.js", function() {
jQuery.getScript("https://cdn.rawgit.com/bramp/js-sequence-diagrams/gh-pages/js/sequence-diagram-min.js", function() {
jQuery(".sequence-diagram").each(function(e) {
var jqe = jQuery(this);
var theme = jqe.attr('data-sequence-theme') == "Simple" ? "simple" : "hand";
try {
jqe.sequenceDiagram({theme: theme});
} catch (err) {
console.log('Sequence error', err.message);
jqe
.css('border', '1px solid #999')
.append('<div class="error">'+err.message+'</div>');
throw err;
}
});
});
});
}
});
</script>
@mathiasrw
Copy link

Love that !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment