mirror of
https://github.com/apricote/releaser-pleaser.git
synced 2026-01-13 21:21:03 +00:00
fix: no html escaping for changelog template
This commit is contained in:
parent
612928a382
commit
79bad58f97
7 changed files with 37 additions and 24 deletions
|
|
@ -3,9 +3,9 @@ package changelog
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
_ "embed"
|
_ "embed"
|
||||||
"html/template"
|
|
||||||
"log"
|
"log"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
|
"text/template"
|
||||||
|
|
||||||
"github.com/apricote/releaser-pleaser/internal/commitparser"
|
"github.com/apricote/releaser-pleaser/internal/commitparser"
|
||||||
"github.com/apricote/releaser-pleaser/internal/markdown"
|
"github.com/apricote/releaser-pleaser/internal/markdown"
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import (
|
||||||
|
|
||||||
"github.com/apricote/releaser-pleaser/internal/commitparser"
|
"github.com/apricote/releaser-pleaser/internal/commitparser"
|
||||||
"github.com/apricote/releaser-pleaser/internal/git"
|
"github.com/apricote/releaser-pleaser/internal/git"
|
||||||
|
"github.com/apricote/releaser-pleaser/internal/testdata"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ptr[T any](input T) *T {
|
func ptr[T any](input T) *T {
|
||||||
|
|
@ -143,16 +144,9 @@ func Test_NewChangelogEntry(t *testing.T) {
|
||||||
},
|
},
|
||||||
version: "1.0.0",
|
version: "1.0.0",
|
||||||
link: "https://example.com/1.0.0",
|
link: "https://example.com/1.0.0",
|
||||||
prefix: "### Breaking Changes",
|
prefix: testdata.MustReadFileString(t, "prefix.txt"),
|
||||||
},
|
},
|
||||||
want: `## [1.0.0](https://example.com/1.0.0)
|
want: testdata.MustReadFileString(t, "changelog-entry-prefix.txt"),
|
||||||
|
|
||||||
### Breaking Changes
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
- Foobar!
|
|
||||||
`,
|
|
||||||
wantErr: assert.NoError,
|
wantErr: assert.NoError,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -167,18 +161,9 @@ func Test_NewChangelogEntry(t *testing.T) {
|
||||||
},
|
},
|
||||||
version: "1.0.0",
|
version: "1.0.0",
|
||||||
link: "https://example.com/1.0.0",
|
link: "https://example.com/1.0.0",
|
||||||
suffix: "### Compatibility\n\nThis version is compatible with flux-compensator v2.2 - v2.9.",
|
suffix: testdata.MustReadFileString(t, "suffix.txt"),
|
||||||
},
|
},
|
||||||
want: `## [1.0.0](https://example.com/1.0.0)
|
want: testdata.MustReadFileString(t, "changelog-entry-suffix.txt"),
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
- Foobar!
|
|
||||||
|
|
||||||
### Compatibility
|
|
||||||
|
|
||||||
This version is compatible with flux-compensator v2.2 - v2.9.
|
|
||||||
`,
|
|
||||||
wantErr: assert.NoError,
|
wantErr: assert.NoError,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
19
internal/testdata/changelog-entry-prefix.txt
vendored
Normal file
19
internal/testdata/changelog-entry-prefix.txt
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
## [1.0.0](https://example.com/1.0.0)
|
||||||
|
|
||||||
|
## Foo
|
||||||
|
|
||||||
|
- Cool thing
|
||||||
|
|
||||||
|
```go
|
||||||
|
// Some code example
|
||||||
|
func IsPositive(number int) error {
|
||||||
|
if number < 0 {
|
||||||
|
return fmt.Errorf("number %d is negative", number)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- Foobar!
|
||||||
9
internal/testdata/changelog-entry-suffix.txt
vendored
Normal file
9
internal/testdata/changelog-entry-suffix.txt
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
## [1.0.0](https://example.com/1.0.0)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- Foobar!
|
||||||
|
|
||||||
|
## Compatibility
|
||||||
|
|
||||||
|
This version is compatible with flux-compensator v2.2 - v2.9.
|
||||||
2
internal/testdata/description-overrides.txt
vendored
2
internal/testdata/description-overrides.txt
vendored
|
|
@ -38,7 +38,7 @@ This will be added to the end of the release notes.
|
||||||
~~~~rp-suffix
|
~~~~rp-suffix
|
||||||
## Compatibility
|
## Compatibility
|
||||||
|
|
||||||
No compatibility guarantees.
|
This version is compatible with flux-compensator v2.2 - v2.9.
|
||||||
~~~~
|
~~~~
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
|
||||||
2
internal/testdata/description-suffix.txt
vendored
2
internal/testdata/description-suffix.txt
vendored
|
|
@ -25,7 +25,7 @@ This will be added to the end of the release notes.
|
||||||
~~~~rp-suffix
|
~~~~rp-suffix
|
||||||
## Compatibility
|
## Compatibility
|
||||||
|
|
||||||
No compatibility guarantees.
|
This version is compatible with flux-compensator v2.2 - v2.9.
|
||||||
~~~~
|
~~~~
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
|
||||||
2
internal/testdata/suffix.txt
vendored
2
internal/testdata/suffix.txt
vendored
|
|
@ -1,3 +1,3 @@
|
||||||
## Compatibility
|
## Compatibility
|
||||||
|
|
||||||
No compatibility guarantees.
|
This version is compatible with flux-compensator v2.2 - v2.9.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue