Skip to content

Commit

Permalink
Merge pull request #40 from nicholaswilde/fix-missing-image
Browse files Browse the repository at this point in the history
fix missing image
  • Loading branch information
nicholaswilde committed Jul 16, 2022
2 parents 1d19339 + bb16cce commit ada48a5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion pkg/cook/recipe_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ func MergeRecipeData(recipeInfo RecipeDocumentationInfo, recipeData *cooklang.Re

recipeData.Metadata["title"] = recipeInfo.RecipeName

recipeData.Metadata["ImageName"] = filepath.Base(recipeInfo.ImagePath)
if len(recipeInfo.ImagePath) > 0 {
recipeData.Metadata["ImageName"] = filepath.Base(recipeInfo.ImagePath)
}

return recipeData
}
6 changes: 3 additions & 3 deletions pkg/document/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"errors"
"fmt"
"io/ioutil"
"net/url"
"os"
"path/filepath"
"strings"
"text/template"
"net/url"

"github.com/Masterminds/sprig/v3"
"github.com/aquilax/cooklang-go"
Expand Down Expand Up @@ -323,14 +323,14 @@ func newRecipeDocumentationTemplate(recipeSearchRoot string, recipeInfo cook.Rec
documentationTemplate := template.New(recipeInfo.RecipePath)
documentationTemplate.Funcs(sprig.TxtFuncMap())
documentationTemplate.Funcs(template.FuncMap{"getSource": func(source string) string {
_, err := url.ParseRequestURI(source)
_, err := url.ParseRequestURI(source)
if err != nil {
return source
}
u, err := url.Parse(source)
if err != nil || u.Scheme == "" || u.Host == "" {
return source
}
}
return "<" + source + ">"
}})
documentationTemplate.Funcs(template.FuncMap{"sumTimers": func(steps []cooklang.Step) string {
Expand Down

0 comments on commit ada48a5

Please sign in to comment.