From 4d16a1f6066d9c7733f8ed6e75863f208c3651e4 Mon Sep 17 00:00:00 2001 From: Jay Stillman Date: Mon, 6 Feb 2023 01:18:34 -0500 Subject: [PATCH 1/2] bugfix: Remove forced default width, forced full-width without editor config #175 --- pkg/confluence/api.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/confluence/api.go b/pkg/confluence/api.go index a48f204..ed2fcf3 100644 --- a/pkg/confluence/api.go +++ b/pkg/confluence/api.go @@ -555,16 +555,16 @@ func (api *API) UpdatePage( }, "metadata": map[string]interface{}{ "labels": labels, - // The Confluence API randomly sets page width for some reason: - // https://community.developer.atlassian.com/t/confluence-rest-api-create-content-at-random-width/57001 - - // This is a workaround to compensate for that bug. It forces the page to be created - // with the default appearance, which is "fixed" (not full-width). + // Fix to set full-width as has changed on Confluence APIs again. + // https://jira.atlassian.com/browse/CONFCLOUD-65447 + // "properties": map[string]interface{}{ "content-appearance-published": map[string]interface{}{ - "value": "default", + "value": "full-width", }, }, + // content-appearance-draft should not be set as this is impacted by + // the user editor default configurations - which caused the sporadic published widths. }, } From 738400c292b75b357024c6fc4f4347cb91d52b4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20R=C3=BCger?= Date: Mon, 6 Feb 2023 18:16:39 +0100 Subject: [PATCH 2/2] Add blog-posts macro --- README.md | 22 ++++++++++++++++++++-- pkg/mark/stdlib/stdlib.go | 15 +++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fe70ac9..e789145 100644 --- a/README.md +++ b/README.md @@ -334,8 +334,8 @@ By default, mark provides several built-in templates and macros: - Frameborder: Choose whether to draw a border around content in the iframe. - `show` (Default) - `hide` - - Width: Width in px. Defualts to "640px" - - Height: Height in px. Defualts to "360px" + - Width: Width in px. Defaults to "640px" + - Height: Height in px. Defaults to "360px" - Scrolling: Allow or prevent scrolling in the iframe to see additional content. - `yes` - `no` @@ -346,6 +346,24 @@ By default, mark provides several built-in templates and macros: See: https://support.atlassian.com/confluence-cloud/docs/insert-the-iframe-macro +* template: `ac:blog-posts`to include blog-posts + - Content: How much content will be shown + - titles (default) + - excerpts + - entire + - Time: Specify how much back in time Confluence should look for blog posts (default: unlimited) + - Label: Restrict to blog posts with specific labels + - Author: Restrict to blog posts by specific authors + - Spaces: Restrict to blog posts in specific spaces + - Max: Maximum number of blog posts shown (default: 15) + - Sort: Sorting posts by + - title + - creation (default) + - modified + - Reverse: Reverses the Sort parameter from oldest to newest (default: false) + + See: https://confluence.atlassian.com/doc/blog-posts-macro-139470.html + * 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 578c269..3cc1e3e 100644 --- a/pkg/mark/stdlib/stdlib.go +++ b/pkg/mark/stdlib/stdlib.go @@ -236,6 +236,21 @@ func templates(api *confluence.API) (*template.Template, error) { `{{printf "\n"}}`, ), + /* https://confluence.atlassian.com/doc/blog-posts-macro-139470.html */ + + `ac:blog-posts`: text( + `{{printf "\n"}}`, + `{{ if .Content }}{{ .Content }}{{printf "\n"}}{{end}}`, + `{{ if .Spaces }}{{ .Spaces }}{{printf "\n"}}{{end}}`, + `{{ if .Author }}{{ .Author }}{{printf "\n"}}{{end}}`, + `{{ if .Time }}{{ .Time }}{{printf "\n"}}{{end}}`, + `{{ if .Reverse }}{{ .Reverse }}{{printf "\n"}}{{end}}`, + `{{ if .Sort }}{{ .Sort }}{{printf "\n"}}{{end}}`, + `{{ if .Max }}{{ .Max }}{{printf "\n"}}{{end}}`, + `{{ if .Label }}{{ .Label }}{{printf "\n"}}{{end}}`, + `{{printf "\n"}}`, + ), + // TODO(seletskiy): more templates here } { templates, err = templates.New(name).Parse(body)