From 3797116d97dd281c007761445befb4760edc3397 Mon Sep 17 00:00:00 2001 From: Leandro Carneiro <42899277+carnei-ro@users.noreply.github.com> Date: Mon, 25 Oct 2021 06:52:04 -0300 Subject: [PATCH] feat: youtube widget macro (#127) --- README.md | 7 +++++++ pkg/mark/stdlib/stdlib.go | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/README.md b/README.md index 825a2f5..52057ef 100644 --- a/README.md +++ b/README.md @@ -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 +* 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. ## Template & Macros Usecases diff --git a/pkg/mark/stdlib/stdlib.go b/pkg/mark/stdlib/stdlib.go index f39d61c..e9d4d57 100644 --- a/pkg/mark/stdlib/stdlib.go +++ b/pkg/mark/stdlib/stdlib.go @@ -177,6 +177,18 @@ func templates(api *confluence.API) (*template.Template, error) { ``, ), + /* https://confluence.atlassian.com/doc/widget-connector-macro-171180449.html#WidgetConnectorMacro-YouTube */ + + `ac:youtube`: text( + `{{printf "\n"}}`, + `youtube{{printf "\n"}}`, + `com/atlassian/confluence/extra/widgetconnector/templates/youtube.vm{{printf "\n"}}`, + `{{ or .Width "640px" }}{{printf "\n"}}`, + `{{ or .Height "360px" }}{{printf "\n"}}`, + `{{printf "\n"}}`, + `{{printf "\n"}}`, + ), + // TODO(seletskiy): more templates here } { templates, err = templates.New(name).Parse(body)