mirror of
https://github.com/kovetskiy/mark.git
synced 2025-04-23 21:32:41 +08:00
Add user profile macro
This commit is contained in:
parent
d67cc63871
commit
6a63913a1e
@ -172,7 +172,7 @@ The key's value must be a string which defines the template's content.
|
||||
|
||||
If you set the Layout to plain, the page layout can be customized using HTML comments inside the markdown:
|
||||
|
||||
```
|
||||
```markdown
|
||||
<!-- Layout: plain -->
|
||||
<!-- ac:layout -->
|
||||
|
||||
@ -421,6 +421,9 @@ By default, mark provides several built-in templates and macros:
|
||||
- Title: Defines the text next to the expand/collapse icon.
|
||||
- Body: The Text that it is expanded to.
|
||||
|
||||
* template: `ac:profile` to display a short summary of a given Confluence user's profile.
|
||||
- Name: The username of the Confluence user whose profile summary you wish to show.
|
||||
|
||||
* macro `@{...}` to mention user by name specified in the braces.
|
||||
|
||||
## Template & Macros Usecases
|
||||
|
@ -136,7 +136,11 @@ func templates(api *confluence.API) (*template.Template, error) {
|
||||
`ac:link:user`: text(
|
||||
`{{ with .Name | user }}`,
|
||||
/**/ `<ac:link>`,
|
||||
/**/ `<ri:user ri:account-id="{{ .AccountID }}"/>`,
|
||||
/**/ `{{ with .AccountID }}`,
|
||||
/****/ `<ri:user ri:account-id="{{ .AccountID }}" />`,
|
||||
/**/ `{{ else }}`,
|
||||
/****/ `<ri:user ri:userkey="{{ .UserKey }}" />`,
|
||||
/**/ `{{ end }}`,
|
||||
/**/ `</ac:link>`,
|
||||
`{{ else }}`,
|
||||
/**/ `{{ .Name }}`,
|
||||
@ -319,6 +323,22 @@ func templates(api *confluence.API) (*template.Template, error) {
|
||||
`</ac:structured-macro>`,
|
||||
),
|
||||
|
||||
/* https://confluence.atlassian.com/conf59/user-profile-macro-792499223.html */
|
||||
|
||||
`ac:profile`: text(
|
||||
`{{ with .Name | user }}`,
|
||||
`<ac:structured-macro ac:name="profile">{{printf "\n"}}`,
|
||||
`<ac:parameter ac:name="user">{{printf "\n"}}`,
|
||||
`{{ with .AccountID }}`,
|
||||
/**/ `<ri:user ri:account-id="{{ .AccountID }}" />{{printf "\n"}}`,
|
||||
`{{ else }}`,
|
||||
/**/ `<ri:user ri:userkey="{{ .UserKey }}" />`,
|
||||
`{{ end }}`,
|
||||
`</ac:parameter>{{printf "\n"}}`,
|
||||
`</ac:structured-macro>{{printf "\n"}}`,
|
||||
`{{ end }}`,
|
||||
),
|
||||
|
||||
// TODO(seletskiy): more templates here
|
||||
} {
|
||||
templates, err = templates.New(name).Parse(body)
|
||||
|
Loading…
x
Reference in New Issue
Block a user