d2: preserve leading comment spacing
This commit is contained in:
parent
79301872e5
commit
f53eabdbf6
2 changed files with 26 additions and 1 deletions
23
patches/d2/402_preserve_leading_comment_spacing.patch
Normal file
23
patches/d2/402_preserve_leading_comment_spacing.patch
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
diff --git a/d2format/format.go b/d2format/format.go
|
||||||
|
index 754e3302..a45d55f6 100644
|
||||||
|
--- a/d2format/format.go
|
||||||
|
+++ b/d2format/format.go
|
||||||
|
@@ -76,17 +76,17 @@ func (p *printer) node(n d2ast.Node) {
|
||||||
|
p.edgeIndex(n)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *printer) comment(c *d2ast.Comment) {
|
||||||
|
lines := strings.Split(c.Value, "\n")
|
||||||
|
for i, line := range lines {
|
||||||
|
p.sb.WriteString("#")
|
||||||
|
- if line != "" && !strings.HasPrefix(line, " ") {
|
||||||
|
+ if line != "" {
|
||||||
|
p.sb.WriteByte(' ')
|
||||||
|
}
|
||||||
|
p.sb.WriteString(line)
|
||||||
|
if i < len(lines)-1 {
|
||||||
|
p.newline()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,7 +27,9 @@ buildGoModule {
|
||||||
|
|
||||||
nativeBuildInputs = [ installShellFiles ];
|
nativeBuildInputs = [ installShellFiles ];
|
||||||
|
|
||||||
patches = [ ];
|
patches = [
|
||||||
|
../patches/d2/402_preserve_leading_comment_spacing.patch
|
||||||
|
];
|
||||||
|
|
||||||
postInstall = "installManPage ci/release/template/man/d2.1";
|
postInstall = "installManPage ci/release/template/man/d2.1";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue