mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
hugolib: Display correct markup identifier in error message
Fixes #11538
This commit is contained in:
parent
8f60c0c1ec
commit
a2488b1c95
2 changed files with 28 additions and 1 deletions
|
@ -14,6 +14,7 @@
|
|||
package hugolib_test
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/gohugoio/hugo/hugolib"
|
||||
|
@ -87,3 +88,29 @@ tags: ['T1']
|
|||
)
|
||||
|
||||
}
|
||||
|
||||
// Issue #11538
|
||||
func TestRenderStringBadMarkupOpt(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
files := `
|
||||
-- layouts/index.html --
|
||||
{{ $opts := dict "markup" "foo" }}
|
||||
{{ "something" | .RenderString $opts }}
|
||||
`
|
||||
|
||||
b := hugolib.NewIntegrationTestBuilder(
|
||||
hugolib.IntegrationTestConfig{
|
||||
T: t,
|
||||
TxtarString: files,
|
||||
},
|
||||
)
|
||||
|
||||
_, err := b.BuildE()
|
||||
|
||||
want := `no content renderer found for markup "foo"`
|
||||
if !strings.Contains(err.Error(), want) {
|
||||
t.Errorf("error msg must contain %q, error msg actually contains %q", want, err.Error())
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -731,7 +731,7 @@ func (p *pageMeta) newContentConverter(ps *pageState, markup string) (converter.
|
|||
}
|
||||
cp := p.s.ContentSpec.Converters.Get(markup)
|
||||
if cp == nil {
|
||||
return converter.NopConverter, fmt.Errorf("no content renderer found for markup %q", p.markup)
|
||||
return converter.NopConverter, fmt.Errorf("no content renderer found for markup %q", markup)
|
||||
}
|
||||
|
||||
var id string
|
||||
|
|
Loading…
Reference in a new issue