mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-28 22:19:59 +02:00
Allow getJSON errors to be ignored
This change is mostly motivated to get a more stable CI build (we're building the Hugo site there, with Instagram and Twitter shortcodes sometimes failing). Fixes #7866
This commit is contained in:
@@ -47,7 +47,7 @@ type orgConverter struct {
|
||||
func (c *orgConverter) Convert(ctx converter.RenderContext) (converter.Result, error) {
|
||||
logger := c.cfg.Logger
|
||||
config := org.New()
|
||||
config.Log = logger.WARN
|
||||
config.Log = logger.Warn()
|
||||
config.ReadFile = func(filename string) ([]byte, error) {
|
||||
return afero.ReadFile(c.cfg.ContentFs, filename)
|
||||
}
|
||||
@@ -55,7 +55,7 @@ func (c *orgConverter) Convert(ctx converter.RenderContext) (converter.Result, e
|
||||
writer.HighlightCodeBlock = func(source, lang string, inline bool) string {
|
||||
highlightedSource, err := c.cfg.Highlight(source, lang, "")
|
||||
if err != nil {
|
||||
logger.ERROR.Printf("Could not highlight source as lang %s. Using raw source.", lang)
|
||||
logger.Errorf("Could not highlight source as lang %s. Using raw source.", lang)
|
||||
return source
|
||||
}
|
||||
return highlightedSource
|
||||
@@ -63,7 +63,7 @@ func (c *orgConverter) Convert(ctx converter.RenderContext) (converter.Result, e
|
||||
|
||||
html, err := config.Parse(bytes.NewReader(ctx.Src), c.ctx.DocumentName).Write(writer)
|
||||
if err != nil {
|
||||
logger.ERROR.Printf("Could not render org: %s. Using unrendered content.", err)
|
||||
logger.Errorf("Could not render org: %s. Using unrendered content.", err)
|
||||
return converter.Bytes(ctx.Src), nil
|
||||
}
|
||||
return converter.Bytes([]byte(html)), nil
|
||||
|
Reference in New Issue
Block a user