Merge branch 'kovetskiy:master' into master

This commit is contained in:
Fethbita 2023-02-13 16:46:45 +02:00 committed by GitHub
commit df3e95f5fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 8 deletions

View File

@ -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. - Frameborder: Choose whether to draw a border around content in the iframe.
- `show` (Default) - `show` (Default)
- `hide` - `hide`
- Width: Width in px. Defualts to "640px" - Width: Width in px. Defaults to "640px"
- Height: Height in px. Defualts to "360px" - Height: Height in px. Defaults to "360px"
- Scrolling: Allow or prevent scrolling in the iframe to see additional content. - Scrolling: Allow or prevent scrolling in the iframe to see additional content.
- `yes` - `yes`
- `no` - `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 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. * macro `@{...}` to mention user by name specified in the braces.
## Template & Macros Usecases ## Template & Macros Usecases

View File

@ -555,16 +555,16 @@ func (api *API) UpdatePage(
}, },
"metadata": map[string]interface{}{ "metadata": map[string]interface{}{
"labels": labels, "labels": labels,
// The Confluence API randomly sets page width for some reason: // Fix to set full-width as has changed on Confluence APIs again.
// https://community.developer.atlassian.com/t/confluence-rest-api-create-content-at-random-width/57001 // https://jira.atlassian.com/browse/CONFCLOUD-65447
//
// 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).
"properties": map[string]interface{}{ "properties": map[string]interface{}{
"content-appearance-published": 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.
}, },
} }

View File

@ -246,6 +246,21 @@ func templates(api *confluence.API) (*template.Template, error) {
`</ac:structured-macro>{{printf "\n"}}`, `</ac:structured-macro>{{printf "\n"}}`,
), ),
/* https://confluence.atlassian.com/doc/blog-posts-macro-139470.html */
`ac:blog-posts`: text(
`<ac:structured-macro ac:name="blog-posts">{{printf "\n"}}`,
`{{ if .Content }}<ac:parameter ac:name="content">{{ .Content }}</ac:parameter>{{printf "\n"}}{{end}}`,
`{{ if .Spaces }}<ac:parameter ac:name="spaces">{{ .Spaces }}</ac:parameter>{{printf "\n"}}{{end}}`,
`{{ if .Author }}<ac:parameter ac:name="author">{{ .Author }}</ac:parameter>{{printf "\n"}}{{end}}`,
`{{ if .Time }}<ac:parameter ac:name="time">{{ .Time }}</ac:parameter>{{printf "\n"}}{{end}}`,
`{{ if .Reverse }}<ac:parameter ac:name="reverse">{{ .Reverse }}</ac:parameter>{{printf "\n"}}{{end}}`,
`{{ if .Sort }}<ac:parameter ac:name="sort">{{ .Sort }}</ac:parameter>{{printf "\n"}}{{end}}`,
`{{ if .Max }}<ac:parameter ac:name="max">{{ .Max }}</ac:parameter>{{printf "\n"}}{{end}}`,
`{{ if .Label }}<ac:parameter ac:name="label">{{ .Label }}</ac:parameter>{{printf "\n"}}{{end}}`,
`</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)