mirror of
https://github.com/kovetskiy/mark.git
synced 2025-04-24 05:42:40 +08:00
feat: Add Excerpt and ExcerptInclude macros
This commit is contained in:
parent
1285947ab3
commit
deb7cd9cbc
@ -375,6 +375,15 @@ By default, mark provides several built-in templates and macros:
|
||||
- Page: the page to be included
|
||||
- Space: the space the page is in (optional, otherwise same space)
|
||||
|
||||
* template: `ac:excerpt-include` to include the excerpt from another page
|
||||
- Page: the page the excerpt should be included from
|
||||
- NoPanel: Determines whether Confluence will display a panel around the excerpted content (optional, default: false)
|
||||
|
||||
* template: `ac:excerpt` to create an excerpt and include it in the page
|
||||
- Excerpt: The text you want to include
|
||||
- OutputType: Determines whether the content of the Excerpt macro body is displayed on a new line or inline (optional, options: "BLOCK" or "INLINE", default: BLOCK)
|
||||
- Hidden: Hide the excerpt content (optional, default: false)
|
||||
|
||||
* macro `@{...}` to mention user by name specified in the braces.
|
||||
|
||||
## Template & Macros Usecases
|
||||
|
@ -273,6 +273,27 @@ func templates(api *confluence.API) (*template.Template, error) {
|
||||
`</ac:structured-macro>{{printf "\n"}}`,
|
||||
),
|
||||
|
||||
/* https://confluence.atlassian.com/conf59/excerpt-include-macro-792499101.html */
|
||||
|
||||
`ac:excerpt-include`: text(
|
||||
`<ac:macro ac:name="excerpt-include">{{printf "\n"}}`,
|
||||
`<ac:parameter ac:name="nopanel">{{ if .NoPanel }}{{ .NoPanel }}{{ else }}false{{ end }}</ac:parameter>{{printf "\n"}}`,
|
||||
`<ac:default-parameter>{{ .Page }}</ac:default-parameter>{{printf "\n"}}`,
|
||||
`</ac:macro>{{printf "\n"}}`,
|
||||
),
|
||||
|
||||
/* https://confluence.atlassian.com/conf59/excerpt-macro-792499102.html */
|
||||
|
||||
`ac:excerpt`: text(
|
||||
`<ac:structured-macro ac:name="excerpt">{{printf "\n"}}`,
|
||||
`<ac:parameter ac:name="hidden">{{ if .Hidden }}{{ .Hidden }}{{ else }}false{{ end }}</ac:parameter>{{printf "\n"}}`,
|
||||
`<ac:parameter ac:name="atlassian-macro-output-type">{{ if .OutputType }}{{ .OutputType }}{{ else }}BLOCK{{ end }}</ac:parameter>{{printf "\n"}}`,
|
||||
`<ac:rich-text-body>{{printf "\n"}}`,
|
||||
`{{ .Excerpt }}{{printf "\n"}}`,
|
||||
`</ac:rich-text-body>{{printf "\n"}}`,
|
||||
`</ac:structured-macro>{{printf "\n"}}`,
|
||||
),
|
||||
|
||||
// TODO(seletskiy): more templates here
|
||||
} {
|
||||
templates, err = templates.New(name).Parse(body)
|
||||
|
Loading…
x
Reference in New Issue
Block a user