From 0b6dd09013edee399d4721f46c44d993da02e2a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20R=C3=BCger?= Date: Tue, 23 May 2023 12:25:03 +0200 Subject: [PATCH] Drop newlines completely from macros --- pkg/mark/stdlib/stdlib.go | 32 ++++++++++++++++---------------- pkg/mark/testdata/codes.html | 28 ++++++++-------------------- 2 files changed, 24 insertions(+), 36 deletions(-) diff --git a/pkg/mark/stdlib/stdlib.go b/pkg/mark/stdlib/stdlib.go index 4ef4a59..a4304dd 100644 --- a/pkg/mark/stdlib/stdlib.go +++ b/pkg/mark/stdlib/stdlib.go @@ -122,7 +122,7 @@ func templates(api *confluence.API) (*template.Template, error) { /**/ `{{ if .Firstline }}{{ .Firstline }}{{ end }}`, /**/ `{{ if .Title }}{{ .Title }}{{ end }}`, /**/ ``, - `{{printf "\n"}}`, + ``, ), `ac:status`: text( @@ -130,7 +130,7 @@ func templates(api *confluence.API) (*template.Template, error) { `{{ or .Color "Grey" }}`, `{{ or .Title .Color }}`, `{{ or .Subtle false }}`, - `{{printf "\n"}}`, + ``, ), `ac:link:user`: text( @@ -150,7 +150,7 @@ func templates(api *confluence.API) (*template.Template, error) { `ac:jira:ticket`: text( ``, `{{ .Ticket }}`, - `{{printf "\n"}}`, + ``, ), /* https://confluence.atlassian.com/doc/jira-issues-macro-139380.html */ @@ -166,7 +166,7 @@ func templates(api *confluence.API) (*template.Template, error) { `{{ or .Title "Jira Issues" }}`, `{{ .URL }}`, `{{ or .Width "100%" }}`, - `{{printf "\n"}}`, + ``, ), /* https://confluence.atlassian.com/conf59/info-tip-note-and-warning-macros-792499127.html */ @@ -176,7 +176,7 @@ func templates(api *confluence.API) (*template.Template, error) { `{{ or .Icon "false" }}`, `{{ if .Title }}{{ .Title }}{{ end }}`, `{{ .Body }}`, - `{{printf "\n"}}`, + ``, ), /* https://confluence.atlassian.com/conf59/table-of-contents-macro-792499210.html */ @@ -192,7 +192,7 @@ func templates(api *confluence.API) (*template.Template, error) { `{{ or .Type "list" }}`, `{{ or .Outline "clear" }}`, `{{ or .Include "" }}`, - `{{printf "\n"}}`, + ``, ), /* https://confluence.atlassian.com/doc/children-display-macro-139501.html */ @@ -213,7 +213,7 @@ func templates(api *confluence.API) (*template.Template, error) { `{{ if .First}}{{ .First }}{{end}}`, `{{ if .Depth}}{{ .Depth }}{{end}}`, `{{ if .All}}{{ .All }}{{end}}`, - `{{printf "\n"}}`, + ``, ), /* https://confluence.atlassian.com/doc/confluence-storage-format-790796544.html */ @@ -242,7 +242,7 @@ func templates(api *confluence.API) (*template.Template, error) { `{{ or .Width "640px" }}`, `{{ or .Height "360px" }}`, ``, - `{{printf "\n"}}`, + ``, ), /* https://support.atlassian.com/confluence-cloud/docs/insert-the-iframe-macro/ */ @@ -255,7 +255,7 @@ func templates(api *confluence.API) (*template.Template, error) { `{{ if .Align }}{{ .Align }}{{end}}`, `{{ or .Width "640px" }}`, `{{ or .Height "360px" }}`, - `{{printf "\n"}}`, + ``, ), /* https://confluence.atlassian.com/doc/blog-posts-macro-139470.html */ @@ -270,7 +270,7 @@ func templates(api *confluence.API) (*template.Template, error) { `{{ if .Sort }}{{ .Sort }}{{end}}`, `{{ if .Max }}{{ .Max }}{{end}}`, `{{ if .Label }}{{ .Label }}{{end}}`, - `{{printf "\n"}}`, + ``, ), /* https://confluence.atlassian.com/conf59/include-page-macro-792499125.html */ @@ -282,7 +282,7 @@ func templates(api *confluence.API) (*template.Template, error) { ``, ``, ``, - `{{printf "\n"}}`, + ``, ), /* https://confluence.atlassian.com/conf59/excerpt-include-macro-792499101.html */ @@ -291,7 +291,7 @@ func templates(api *confluence.API) (*template.Template, error) { ``, `{{ if .NoPanel }}{{ .NoPanel }}{{ else }}false{{ end }}`, `{{ .Page }}`, - `{{printf "\n"}}`, + ``, ), /* https://confluence.atlassian.com/conf59/excerpt-macro-792499102.html */ @@ -303,7 +303,7 @@ func templates(api *confluence.API) (*template.Template, error) { ``, `{{ .Excerpt }}`, ``, - `{{printf "\n"}}`, + ``, ), /* https://confluence.atlassian.com/conf59/anchor-macro-792499068.html */ @@ -311,7 +311,7 @@ func templates(api *confluence.API) (*template.Template, error) { `ac:anchor`: text( ``, `{{ .Anchor }}`, - `{{printf "\n"}}`, + ``, ), /* https://confluence.atlassian.com/conf59/expand-macro-792499106.html */ @@ -320,7 +320,7 @@ func templates(api *confluence.API) (*template.Template, error) { ``, `{{ .Title }}`, `{{ .Body }}`, - `{{printf "\n"}}`, + ``, ), /* https://confluence.atlassian.com/conf59/user-profile-macro-792499223.html */ @@ -335,7 +335,7 @@ func templates(api *confluence.API) (*template.Template, error) { /**/ ``, `{{ end }}`, ``, - `{{printf "\n"}}`, + ``, `{{ end }}`, ), diff --git a/pkg/mark/testdata/codes.html b/pkg/mark/testdata/codes.html index 0757528..733410b 100644 --- a/pkg/mark/testdata/codes.html +++ b/pkg/mark/testdata/codes.html @@ -1,32 +1,20 @@

inline

-false -bashfalse -bashfalse -unknownfalse -

text +falsebashfalsebashfalseunknownfalse

text text 2

-unknownfalse -shfalseA b c -bashtrueA b c -ctrue -nestedfalseunknownfalseshfalseA b cbashtrueA b cctruenestedfalse -false -truefalsefalsetruefalseB; A-->C; B-->D; - C-->D;]]> -truetruemy mermaid graphD;]]>truetruemy mermaid graphB; A-->C; B-->D; - C-->D;]]> -truefalsemy mermaid graphD;]]>truefalsemy mermaid graphB; A-->C; B-->D; - C-->D;]]> + C-->D;]]> \ No newline at end of file