mirror of
https://github.com/kovetskiy/mark.git
synced 2025-04-24 05:42:40 +08:00
fix: remove double collapse for codeboxes (#179)
This fixes a bug where if you used the code macro the renderer would create an additional expand macro if the collapse option was set. This led to the code section being collapsiable twice. Co-authored-by: Philipp Reinke <philipp.reinke@scandio.de>
This commit is contained in:
parent
2f34e93973
commit
f95835469c
@ -106,10 +106,6 @@ func templates(api *confluence.API) (*template.Template, error) {
|
||||
|
||||
// This template is used for rendering code in ```
|
||||
`ac:code`: text(
|
||||
`{{ if .Collapse }}<ac:structured-macro ac:name="expand">{{printf "\n"}}`,
|
||||
`{{ if .Title }}<ac:parameter ac:name="title">{{ .Title }}</ac:parameter>{{printf "\n"}}{{ end }}`,
|
||||
`<ac:rich-text-body>{{printf "\n"}}{{ end }}`,
|
||||
|
||||
`<ac:structured-macro ac:name="{{ if eq .Language "mermaid" }}cloudscript-confluence-mermaid{{ else }}code{{ end }}">{{printf "\n"}}`,
|
||||
/**/ `{{ if eq .Language "mermaid" }}<ac:parameter ac:name="showSource">true</ac:parameter>{{printf "\n"}}{{ else }}`,
|
||||
/**/ `<ac:parameter ac:name="language">{{ .Language }}</ac:parameter>{{printf "\n"}}{{ end }}`,
|
||||
@ -117,9 +113,6 @@ func templates(api *confluence.API) (*template.Template, error) {
|
||||
/**/ `{{ if .Title }}<ac:parameter ac:name="title">{{ .Title }}</ac:parameter>{{printf "\n"}}{{ end }}`,
|
||||
/**/ `<ac:plain-text-body><![CDATA[{{ .Text | cdata }}]]></ac:plain-text-body>{{printf "\n"}}`,
|
||||
`</ac:structured-macro>{{printf "\n"}}`,
|
||||
|
||||
`{{ if .Collapse }}</ac:rich-text-body>{{printf "\n"}}`,
|
||||
`</ac:structured-macro>{{printf "\n"}}{{ end }}`,
|
||||
),
|
||||
|
||||
`ac:status`: text(
|
||||
|
14
pkg/mark/testdata/codes.html
vendored
14
pkg/mark/testdata/codes.html
vendored
@ -34,26 +34,17 @@ text 2</p>
|
||||
<ac:parameter ac:name="title">A b c</ac:parameter>
|
||||
<ac:plain-text-body><![CDATA[no-collapse-title]]></ac:plain-text-body>
|
||||
</ac:structured-macro>
|
||||
<ac:structured-macro ac:name="expand">
|
||||
<ac:parameter ac:name="title">A b c</ac:parameter>
|
||||
<ac:rich-text-body>
|
||||
<ac:structured-macro ac:name="code">
|
||||
<ac:parameter ac:name="language">bash</ac:parameter>
|
||||
<ac:parameter ac:name="collapse">true</ac:parameter>
|
||||
<ac:parameter ac:name="title">A b c</ac:parameter>
|
||||
<ac:plain-text-body><![CDATA[collapse-and-title]]></ac:plain-text-body>
|
||||
</ac:structured-macro>
|
||||
</ac:rich-text-body>
|
||||
</ac:structured-macro>
|
||||
<ac:structured-macro ac:name="expand">
|
||||
<ac:rich-text-body>
|
||||
<ac:structured-macro ac:name="code">
|
||||
<ac:parameter ac:name="language">c</ac:parameter>
|
||||
<ac:parameter ac:name="collapse">true</ac:parameter>
|
||||
<ac:plain-text-body><![CDATA[collapse-no-title]]></ac:plain-text-body>
|
||||
</ac:structured-macro>
|
||||
</ac:rich-text-body>
|
||||
</ac:structured-macro>
|
||||
<ac:structured-macro ac:name="cloudscript-confluence-mermaid">
|
||||
<ac:parameter ac:name="showSource">true</ac:parameter>
|
||||
<ac:parameter ac:name="collapse">false</ac:parameter>
|
||||
@ -63,9 +54,6 @@ text 2</p>
|
||||
B-->D;
|
||||
C-->D;]]></ac:plain-text-body>
|
||||
</ac:structured-macro>
|
||||
<ac:structured-macro ac:name="expand">
|
||||
<ac:parameter ac:name="title">my mermaid graph</ac:parameter>
|
||||
<ac:rich-text-body>
|
||||
<ac:structured-macro ac:name="cloudscript-confluence-mermaid">
|
||||
<ac:parameter ac:name="showSource">true</ac:parameter>
|
||||
<ac:parameter ac:name="collapse">true</ac:parameter>
|
||||
@ -76,8 +64,6 @@ text 2</p>
|
||||
B-->D;
|
||||
C-->D;]]></ac:plain-text-body>
|
||||
</ac:structured-macro>
|
||||
</ac:rich-text-body>
|
||||
</ac:structured-macro>
|
||||
<ac:structured-macro ac:name="cloudscript-confluence-mermaid">
|
||||
<ac:parameter ac:name="showSource">true</ac:parameter>
|
||||
<ac:parameter ac:name="collapse">false</ac:parameter>
|
||||
|
Loading…
x
Reference in New Issue
Block a user