mirror of
https://github.com/kovetskiy/mark.git
synced 2025-06-08 15:32:40 +08:00
Merge pull request #89 from beeme1mr/feat/sidebar
feat(sidebar): Add sidebar support
This commit is contained in:
commit
76c60c33d5
@ -54,6 +54,12 @@ Also, optional following headers are supported:
|
|||||||
* (default) page: normal Confluence page - defaults to this if omitted
|
* (default) page: normal Confluence page - defaults to this if omitted
|
||||||
* blogpost: [Blog post](https://confluence.atlassian.com/doc/blog-posts-834222533.html) in `Space`. Cannot have `Parent`(s)
|
* blogpost: [Blog post](https://confluence.atlassian.com/doc/blog-posts-834222533.html) in `Space`. Cannot have `Parent`(s)
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
<!-- Sidebar: <h2>Test</h2> -->
|
||||||
|
```
|
||||||
|
|
||||||
|
Setting the sidebar creates a column on the right side. You're able to add any valid HTML content. Adding this property sets the layout to `article`.
|
||||||
|
|
||||||
Mark supports Go templates, which can be included into article by using path
|
Mark supports Go templates, which can be included into article by using path
|
||||||
to the template relative to current working dir, e.g.:
|
to the template relative to current working dir, e.g.:
|
||||||
|
|
||||||
|
10
main.go
10
main.go
@ -299,11 +299,13 @@ func processFile(
|
|||||||
&buffer,
|
&buffer,
|
||||||
"ac:layout",
|
"ac:layout",
|
||||||
struct {
|
struct {
|
||||||
Layout string
|
Layout string
|
||||||
Body string
|
Sidebar string
|
||||||
|
Body string
|
||||||
}{
|
}{
|
||||||
Layout: meta.Layout,
|
Layout: meta.Layout,
|
||||||
Body: html,
|
Sidebar: meta.Sidebar,
|
||||||
|
Body: html,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -19,6 +19,7 @@ const (
|
|||||||
HeaderAttachment = `Attachment`
|
HeaderAttachment = `Attachment`
|
||||||
HeaderLabel = `Label`
|
HeaderLabel = `Label`
|
||||||
HeaderInclude = `Include`
|
HeaderInclude = `Include`
|
||||||
|
HeaderSidebar = `Sidebar`
|
||||||
)
|
)
|
||||||
|
|
||||||
type Meta struct {
|
type Meta struct {
|
||||||
@ -27,6 +28,7 @@ type Meta struct {
|
|||||||
Type string
|
Type string
|
||||||
Title string
|
Title string
|
||||||
Layout string
|
Layout string
|
||||||
|
Sidebar string
|
||||||
Attachments map[string]string
|
Attachments map[string]string
|
||||||
Labels []string
|
Labels []string
|
||||||
}
|
}
|
||||||
@ -96,6 +98,10 @@ func ExtractMeta(data []byte) (*Meta, []byte, error) {
|
|||||||
case HeaderLayout:
|
case HeaderLayout:
|
||||||
meta.Layout = strings.TrimSpace(value)
|
meta.Layout = strings.TrimSpace(value)
|
||||||
|
|
||||||
|
case HeaderSidebar:
|
||||||
|
meta.Layout = "article"
|
||||||
|
meta.Sidebar = strings.TrimSpace(value)
|
||||||
|
|
||||||
case HeaderAttachment:
|
case HeaderAttachment:
|
||||||
meta.Attachments[value] = value
|
meta.Attachments[value] = value
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ func templates(api *confluence.API) (*template.Template, error) {
|
|||||||
/**/ `<ac:layout>`,
|
/**/ `<ac:layout>`,
|
||||||
/**/ `<ac:layout-section ac:type="two_right_sidebar">`,
|
/**/ `<ac:layout-section ac:type="two_right_sidebar">`,
|
||||||
/**/ `<ac:layout-cell>{{ .Body }}</ac:layout-cell>`,
|
/**/ `<ac:layout-cell>{{ .Body }}</ac:layout-cell>`,
|
||||||
/**/ `<ac:layout-cell></ac:layout-cell>`,
|
/**/ `<ac:layout-cell>{{ .Sidebar }}</ac:layout-cell>`,
|
||||||
/**/ `</ac:layout-section>`,
|
/**/ `</ac:layout-section>`,
|
||||||
/**/ `</ac:layout>`,
|
/**/ `</ac:layout>`,
|
||||||
`{{ else }}`,
|
`{{ else }}`,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user