Skip to content

Commit

Permalink
fix: use text/template instead
Browse files Browse the repository at this point in the history
  • Loading branch information
mdelapenya committed May 4, 2023
1 parent 9e35dbc commit d74e1af
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modulegen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package main
import (
"flag"
"fmt"
"html/template"
htmltemplate "html/template"
"os"
"os/exec"
"path/filepath"
"regexp"
"sort"
"strings"
"text/template"
"unicode"
"unicode/utf8"

Expand Down Expand Up @@ -182,7 +183,7 @@ func generate(example Example, rootDir string) error {
"ParentDir": func() string { return example.ParentDir() },
"ToLower": func() string { return example.Lower() },
"Title": func() string { return example.Title() },
"codeinclude": func(s string) template.HTML { return template.HTML(s) }, // escape HTML comments for codeinclude
"codeinclude": func(s string) htmltemplate.HTML { return htmltemplate.HTML(s) }, // escape HTML comments for codeinclude
}

// create the example dir
Expand Down
1 change: 1 addition & 0 deletions modulegen/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ func assertExampleGithubWorkflowContent(t *testing.T, example Example, exampleWo
data := strings.Split(sanitiseContent(string(content)), "\n")
assert.Equal(t, "name: "+title+" "+example.Type()+" pipeline", data[0])
assert.Equal(t, " test-"+lower+":", data[23])
assert.Equal(t, " if: ${{ github.event.workflow_run.conclusion == 'success' }}", data[24])
assert.Equal(t, " go-version: ${{ matrix.go-version }}", data[34])
assert.Equal(t, " working-directory: ./"+example.ParentDir()+"/"+lower, data[41])
assert.Equal(t, " working-directory: ./"+example.ParentDir()+"/"+lower, data[45])
Expand Down

0 comments on commit d74e1af

Please sign in to comment.