feat: youtube widget macro (#127)

This commit is contained in:
Leandro Carneiro 2021-10-25 06:52:04 -03:00 committed by GitHub
parent e635d1f945
commit 3797116d97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 0 deletions

View File

@ -197,6 +197,13 @@ By default, mark provides several built-in templates and macros:
See: https://confluence.atlassian.com/doc/confluence-storage-format-790796544.html See: https://confluence.atlassian.com/doc/confluence-storage-format-790796544.html
* template: `ac:youtube` to include YouTube Widget. Parameters:
- URL: YouTube video endpoint
- Width: Width in px. Defualts to "640px"
- Height: Height in px. Defualts to "360px"
See: https://confluence.atlassian.com/doc/widget-connector-macro-171180449.html#WidgetConnectorMacro-YouTube
* macro `@{...}` to mention user by name specified in the braces. * macro `@{...}` to mention user by name specified in the braces.
## Template & Macros Usecases ## Template & Macros Usecases

View File

@ -177,6 +177,18 @@ func templates(api *confluence.API) (*template.Template, error) {
`<ac:emoticon ac:name="{{ .Name }}"/>`, `<ac:emoticon ac:name="{{ .Name }}"/>`,
), ),
/* https://confluence.atlassian.com/doc/widget-connector-macro-171180449.html#WidgetConnectorMacro-YouTube */
`ac:youtube`: text(
`<ac:structured-macro ac:name="widget">{{printf "\n"}}`,
`<ac:parameter ac:name="overlay">youtube</ac:parameter>{{printf "\n"}}`,
`<ac:parameter ac:name="_template">com/atlassian/confluence/extra/widgetconnector/templates/youtube.vm</ac:parameter>{{printf "\n"}}`,
`<ac:parameter ac:name="width">{{ or .Width "640px" }}</ac:parameter>{{printf "\n"}}`,
`<ac:parameter ac:name="height">{{ or .Height "360px" }}</ac:parameter>{{printf "\n"}}`,
`<ac:parameter ac:name="url"><ri:url ri:value="{{ .URL }}" /></ac:parameter>{{printf "\n"}}`,
`</ac:structured-macro>{{printf "\n"}}`,
),
// TODO(seletskiy): more templates here // TODO(seletskiy): more templates here
} { } {
templates, err = templates.New(name).Parse(body) templates, err = templates.New(name).Parse(body)