Skip to content

Commit

Permalink
add jira ticket template
Browse files Browse the repository at this point in the history
  • Loading branch information
seletskiy committed Aug 6, 2019
1 parent 07a8e3f commit 58f4a55
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ By default, mark provides several built-in templates and macros:
- true
- false

* template `ac:jira:ticket` to include JIRA ticket link. Parameters:
- Ticket: Jira ticket number like BUGS-123.

See: https://confluence.atlassian.com/conf59/status-macro-792499207.html

* macro `@{...}` to mention user by name specified in the braces.
Expand Down Expand Up @@ -133,20 +136,14 @@ This is my article.

## Insert Jira Ticket

**ticket.md**

```markdown
[{{ .Ticket }}](http://myjira.atlassian.net/browse/{{ .Ticket }})
```

**article.md**

```markdown
<!-- Space: TEST -->
<!-- Title: TODO List -->

<!-- Macro: MYJIRA-\d+
Template: ticket.md
Template: ac:jira:ticket
Ticket: ${0} -->

See task MYJIRA-123.
Expand Down
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ By default, mark provides several built-in templates and macros:
See: https://confluence.atlassian.com/conf59/status-macro-792499207.html
* template 'ac:jira:ticket' to include JIRA ticket link. Parameters:
- Ticket: Jira ticket number like BUGS-123.
* macro '@{...}' to mention user by name specified in the braces.
Usage:
Expand Down
6 changes: 6 additions & 0 deletions pkg/mark/stdlib/stdlib.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ func templates(api *confluence.API) (*template.Template, error) {
`{{ end }}`,
),

`ac:jira:ticket`: text(
`<ac:structured-macro ac:name="jira">`,
`<ac:parameter ac:name="key">{{ .Ticket }}</ac:parameter>`,
`</ac:structured-macro>`,
),

// TODO(seletskiy): more templates here
} {
templates, err = templates.New(name).Parse(body)
Expand Down

0 comments on commit 58f4a55

Please sign in to comment.