Skip to content

Commit

Permalink
all: Fix typos in variable names, tests, and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear committed Oct 3, 2023
1 parent 4c95389 commit 3caade5
Show file tree
Hide file tree
Showing 23 changed files with 53 additions and 53 deletions.
2 changes: 1 addition & 1 deletion config/allconfig/alldecoders.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ var allDecoderSetups = map[string]decodeWeight{
var err error
m := p.p.GetStringMap(d.key)
if len(m) == 1 {
// In v0.112.4 we moved this to the language config, but it's very commmon for mono language sites to have this at the top level.
// In v0.112.4 we moved this to the language config, but it's very common for mono language sites to have this at the top level.
var first maps.Params
var ok bool
for _, v := range m {
Expand Down
4 changes: 2 additions & 2 deletions docs/data/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2834,7 +2834,7 @@ tpl:
- format
- args
Description: Printf returns string representation of args formatted with the
layouut in format.
layout in format.
Examples:
- - '{{ printf "%s!" "works" }}'
- works!
Expand Down Expand Up @@ -4252,7 +4252,7 @@ tpl:
Args:
- s
Description: |-
HTMLUnescape returns a copy of s with HTML escape requences converted to plain
HTMLUnescape returns a copy of s with HTML escape sequences converted to plain
text.
Examples:
- - '{{ htmlUnescape "Cathal Garvey & The Sunshine Band <cathal@foo.bar>"
Expand Down
2 changes: 1 addition & 1 deletion helpers/path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func TestIsDir(t *testing.T) {
data := []test{
{"./", true},
{"/", true},
{"./this-directory-does-not-existi", false},
{"./this-directory-does-not-exist", false},
{"/this-absolute-directory/does-not-exist", false},
}

Expand Down
2 changes: 1 addition & 1 deletion hugofs/files/classifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func ClassifyContentFile(filename string, open func() (afero.File, error)) Conte
if IsHTMLFile(filename) {
// We need to look inside the file. If the first non-whitespace
// character is a "<", then we treat it as a regular file.
// Eearlier we created pages for these files, but that had all sorts
// Earlier we created pages for these files, but that had all sorts
// of troubles, and isn't what it says in the documentation.
// See https://github.com/gohugoio/hugo/issues/7030
if open == nil {
Expand Down
42 changes: 21 additions & 21 deletions hugolib/dates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,17 @@ expiryDate=%s

b.WithContent(
// YAML
"short-date-yaml-unqouted.en.md", createPageContent(pageTemplYaml, shortDateTempl, false),
"short-date-yaml-unqouted.nn.md", createPageContent(pageTemplYaml, shortDateTempl, false),
"short-date-yaml-qouted.en.md", createPageContent(pageTemplYaml, shortDateTempl, true),
"short-date-yaml-qouted.nn.md", createPageContent(pageTemplYaml, shortDateTempl, true),
"long-date-yaml-unqouted.en.md", createPageContent(pageTemplYaml, longDateTempl, false),
"long-date-yaml-unqouted.nn.md", createPageContent(pageTemplYaml, longDateTempl, false),
"short-date-yaml-unquoted.en.md", createPageContent(pageTemplYaml, shortDateTempl, false),
"short-date-yaml-unquoted.nn.md", createPageContent(pageTemplYaml, shortDateTempl, false),
"short-date-yaml-quoted.en.md", createPageContent(pageTemplYaml, shortDateTempl, true),
"short-date-yaml-quoted.nn.md", createPageContent(pageTemplYaml, shortDateTempl, true),
"long-date-yaml-unquoted.en.md", createPageContent(pageTemplYaml, longDateTempl, false),
"long-date-yaml-unquoted.nn.md", createPageContent(pageTemplYaml, longDateTempl, false),
// TOML
"short-date-toml-unqouted.en.md", createPageContent(pageTemplTOML, shortDateTempl, false),
"short-date-toml-unqouted.nn.md", createPageContent(pageTemplTOML, shortDateTempl, false),
"short-date-toml-qouted.en.md", createPageContent(pageTemplTOML, shortDateTempl, true),
"short-date-toml-qouted.nn.md", createPageContent(pageTemplTOML, shortDateTempl, true),
"short-date-toml-unquoted.en.md", createPageContent(pageTemplTOML, shortDateTempl, false),
"short-date-toml-unquoted.nn.md", createPageContent(pageTemplTOML, shortDateTempl, false),
"short-date-toml-quoted.en.md", createPageContent(pageTemplTOML, shortDateTempl, true),
"short-date-toml-quoted.nn.md", createPageContent(pageTemplTOML, shortDateTempl, true),
)

const datesTempl = `
Expand Down Expand Up @@ -171,22 +171,22 @@ ExpiryDate: 2099-07-13 15:28:01 +0000 UTC`
// have date literals.

// YAML
// Note: This is with go-yaml v2, I suspect v3 will fail with the unquouted values.
b.AssertFileContent("public/en/short-date-yaml-unqouted/index.html", expectShortDateEn)
b.AssertFileContent("public/nn/short-date-yaml-unqouted/index.html", expectShortDateNn)
b.AssertFileContent("public/en/short-date-yaml-qouted/index.html", expectShortDateEn)
b.AssertFileContent("public/nn/short-date-yaml-qouted/index.html", expectShortDateNn)
// Note: This is with go-yaml v2, I suspect v3 will fail with the unquoted values.
b.AssertFileContent("public/en/short-date-yaml-unquoted/index.html", expectShortDateEn)
b.AssertFileContent("public/nn/short-date-yaml-unquoted/index.html", expectShortDateNn)
b.AssertFileContent("public/en/short-date-yaml-quoted/index.html", expectShortDateEn)
b.AssertFileContent("public/nn/short-date-yaml-quoted/index.html", expectShortDateNn)

b.AssertFileContent("public/en/long-date-yaml-unqouted/index.html", expectLongDateEn)
b.AssertFileContent("public/nn/long-date-yaml-unqouted/index.html", expectLongDateNn)
b.AssertFileContent("public/en/long-date-yaml-unquoted/index.html", expectLongDateEn)
b.AssertFileContent("public/nn/long-date-yaml-unquoted/index.html", expectLongDateNn)

// TOML
// These fails: TOML (Burnt Sushi) defaults to local timezone.
// TODO(bep) check go-toml
b.AssertFileContent("public/en/short-date-toml-unqouted/index.html", expectShortDateEn)
b.AssertFileContent("public/nn/short-date-toml-unqouted/index.html", expectShortDateNn)
b.AssertFileContent("public/en/short-date-toml-qouted/index.html", expectShortDateEn)
b.AssertFileContent("public/nn/short-date-toml-qouted/index.html", expectShortDateNn)
b.AssertFileContent("public/en/short-date-toml-unquoted/index.html", expectShortDateEn)
b.AssertFileContent("public/nn/short-date-toml-unquoted/index.html", expectShortDateNn)
b.AssertFileContent("public/en/short-date-toml-quoted/index.html", expectShortDateEn)
b.AssertFileContent("public/nn/short-date-toml-quoted/index.html", expectShortDateNn)

}

Expand Down
4 changes: 2 additions & 2 deletions hugolib/hugo_sites_build_errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func TestSiteBuildErrors(t *testing.T) {
},
},
{
name: "Shortode does not exist",
name: "Shortcode does not exist",
fileType: yamlcontent,
fileFixer: func(content string) string {
return strings.Replace(content, "{{< sc >}}", "{{< nono >}}", 1)
Expand Down Expand Up @@ -277,7 +277,7 @@ title = "The TOML"
p1 = "v"
p2 = "v"
p3 = "v"
description = "Descriptioon"
description = "Description"
+++
Some content.
Expand Down
4 changes: 2 additions & 2 deletions hugolib/page_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,7 @@ func TestPagePaths(t *testing.T) {
t.Parallel()
c := qt.New(t)

siteParmalinksSetting := map[string]string{
sitePermalinksSetting := map[string]string{
"post": ":year/:month/:day/:title/",
}

Expand All @@ -1180,7 +1180,7 @@ func TestPagePaths(t *testing.T) {
c.Assert(err, qt.IsNil)

if test.hasPermalink {
cfg.Set("permalinks", siteParmalinksSetting)
cfg.Set("permalinks", sitePermalinksSetting)
}

writeSource(t, fs, filepath.Join("content", filepath.FromSlash(test.path)), test.content)
Expand Down
2 changes: 1 addition & 1 deletion hugolib/shortcode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ title: "Hugo Rocks!"
types positional: {{< hello true false 33 3.14 >}}
types named: {{< hello b1=true b2=false i1=33 f1=3.14 >}}
types string: {{< hello "true" trues "33" "3.14" >}}
escaped quoute: {{< hello "hello \"world\"." >}}
escaped quote: {{< hello "hello \"world\"." >}}
`).WithTemplatesAdded(
Expand Down
2 changes: 1 addition & 1 deletion langs/i18n/i18n.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (t Translator) initFuncs(bndl *i18n.Bundle) {
// the context.Context.
// A common pattern is to pass Page to i18n, and use .ReadingTime etc.
// We need to improve this, but that requires some upstream changes.
// For now, just creata a wrepper.
// For now, just create a wrapper.
templateData = page.PageWithContext{Page: p, Ctx: ctx}
}
}
Expand Down
2 changes: 1 addition & 1 deletion main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ var commonTestScriptsParam = testscript.Params{
fmt.Fprintf(ts.Stdout(), "%s %04o %s %s\n", fi.Mode(), fi.Mode().Perm(), fi.ModTime().Format(time.RFC3339Nano), fi.Name())
}
},
// append appends to a file with a leaading newline.
// append appends to a file with a leading newline.
"append": func(ts *testscript.TestScript, neg bool, args []string) {
if len(args) < 2 {
ts.Fatalf("usage: append FILE TEXT")
Expand Down
8 changes: 4 additions & 4 deletions markup/goldmark/convert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (
qt "github.com/frankban/quicktest"
)

var cfgStrHighlichgtNoClasses = `
var cfgStrHighlightNoClasses = `
[markup]
[markup.highlight]
noclasses=false
Expand Down Expand Up @@ -484,15 +484,15 @@ noclasses=false

c.Run("Highlight lines, default config", func(c *qt.C) {

result := convertForConfig(c, cfgStrHighlichgtNoClasses, lines, `bash {linenos=table,hl_lines=[2 "4-5"],linenostart=3}`)
result := convertForConfig(c, cfgStrHighlightNoClasses, lines, `bash {linenos=table,hl_lines=[2 "4-5"],linenostart=3}`)
c.Assert(result, qt.Contains, "<div class=\"highlight\"><div class=\"chroma\">\n<table class=\"lntable\"><tr><td class=\"lntd\">\n<pre tabindex=\"0\" class=\"chroma\"><code><span class")
c.Assert(result, qt.Contains, "<span class=\"hl\"><span class=\"lnt\">4")

result = convertForConfig(c, cfgStrHighlichgtNoClasses, lines, "bash {linenos=inline,hl_lines=[2]}")
result = convertForConfig(c, cfgStrHighlightNoClasses, lines, "bash {linenos=inline,hl_lines=[2]}")
c.Assert(result, qt.Contains, "<span class=\"ln\">2</span><span class=\"cl\">LINE2\n</span></span>")
c.Assert(result, qt.Not(qt.Contains), "<table")

result = convertForConfig(c, cfgStrHighlichgtNoClasses, lines, "bash {linenos=true,hl_lines=[2]}")
result = convertForConfig(c, cfgStrHighlightNoClasses, lines, "bash {linenos=true,hl_lines=[2]}")
c.Assert(result, qt.Contains, "<table")
c.Assert(result, qt.Contains, "<span class=\"hl\"><span class=\"lnt\">2\n</span>")
})
Expand Down
2 changes: 1 addition & 1 deletion markup/goldmark/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ FENCE
runBenchmark(filesTemplate, b)
})

b.Run("Hook no higlight", func(b *testing.B) {
b.Run("Hook no highlight", func(b *testing.B) {
files := filesTemplate + `
-- layouts/_default/_markup/render-codeblock.html --
{{ .Inner }}
Expand Down
2 changes: 1 addition & 1 deletion markup/internal/attributes/attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (a *AttributesHolder) OptionsSlice() []Attribute {

// RenderASTAttributes writes the AST attributes to the given as attributes to an HTML element.
// This is used by the default HTML renderers, e.g. for headings etc. where no hook template could be found.
// This performs HTML esacaping of string attributes.
// This performs HTML escaping of string attributes.
func RenderASTAttributes(w hugio.FlexiWriter, attributes ...ast.Attribute) {
for _, attr := range attributes {

Expand Down
2 changes: 1 addition & 1 deletion modules/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ type Client struct {
goBinaryStatus goBinaryStatus
}

// Graph writes a module dependenchy graph to the given writer.
// Graph writes a module dependency graph to the given writer.
func (c *Client) Graph(w io.Writer) error {
mc, coll := c.collect(true)
if coll.err != nil {
Expand Down
2 changes: 1 addition & 1 deletion parser/pageparser/pagelexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (l *pageLexer) emit(t ItemType) {
}()

if t == tText {
// Identify any trailing whitespace/intendation.
// Identify any trailing whitespace/indentation.
// We currently only care about the last one.
for i := l.pos - 1; i >= l.start; i-- {
b := l.input[i]
Expand Down
4 changes: 2 additions & 2 deletions resources/page/pagemeta/pagemeta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ func TestDateAndSlugFromBaseFilename(t *testing.T) {
}

for _, test := range tests {
expecteFDate, err := time.Parse("2006-01-02", test.date)
expectedFDate, err := time.Parse("2006-01-02", test.date)
c.Assert(err, qt.IsNil)

gotDate, gotSlug := dateAndSlugFromBaseFilename(time.UTC, test.name)

c.Assert(gotDate, qt.Equals, expecteFDate)
c.Assert(gotDate, qt.Equals, expectedFDate)
c.Assert(gotSlug, qt.Equals, test.slug)

}
Expand Down
4 changes: 2 additions & 2 deletions resources/page/permalinks.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
"github.com/gohugoio/hugo/resources/kinds"
)

// PermalinkExpander holds permalin mappings per section.
// PermalinkExpander holds permalink mappings per section.
type PermalinkExpander struct {
// knownPermalinkAttributes maps :tags in a permalink specification to a
// function which, given a page and the tag, returns the resulting string
Expand Down Expand Up @@ -416,7 +416,7 @@ func DecodePermalinksConfig(m map[string]any) (map[string]map[string]string, err
// [permalinks]
// key = '...'

// To sucessfully be backward compatible, "default" patterns need to be set for both page and term
// To successfully be backward compatible, "default" patterns need to be set for both page and term
permalinksConfig[kinds.KindPage][k] = v
permalinksConfig[kinds.KindTerm][k] = v

Expand Down
2 changes: 1 addition & 1 deletion resources/page/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
"github.com/gohugoio/hugo/navigation"
)

// Site represents a site. There can be multople sites in a multilingual setup.
// Site represents a site. There can be multiple sites in a multilingual setup.
type Site interface {
// Returns the Language configured for this Site.
Language() *langs.Language
Expand Down
2 changes: 1 addition & 1 deletion resources/postpub/postpub.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const (
PostProcessPrefix = "__h_pp_l1"

// The suffix has an '=' in it to prevent the minifier to remove any enclosing
// quoutes around the attribute values.
// quotes around the attribute values.
// See issue #8884.
PostProcessSuffix = "__e="
)
Expand Down
2 changes: 1 addition & 1 deletion resources/resource_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ type Spec struct {
*SpecCommon
}

// The parts of Spec that's comoon for all sites.
// The parts of Spec that's common for all sites.
type SpecCommon struct {
incr identity.Incrementer
ResourceCache *ResourceCache
Expand Down
6 changes: 3 additions & 3 deletions tpl/fmt/fmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (ns *Namespace) Print(args ...any) string {
return _fmt.Sprint(args...)
}

// Printf returns string representation of args formatted with the layouut in format.
// Printf returns string representation of args formatted with the layout in format.
func (ns *Namespace) Printf(format string, args ...any) string {
return _fmt.Sprintf(format, args...)
}
Expand Down Expand Up @@ -79,12 +79,12 @@ func (ns *Namespace) Warnf(format string, args ...any) string {
return ""
}

// Warnmf is epxermimental and subject to change at any time.
// Warnmf is experimental and subject to change at any time.
func (ns *Namespace) Warnmf(m any, format string, args ...any) string {
return ns.logmf(ns.logger.Warn(), m, format, args...)
}

// Errormf is epxermimental and subject to change at any time.
// Errormf is experimental and subject to change at any time.
func (ns *Namespace) Errormf(m any, format string, args ...any) string {
return ns.logmf(ns.logger.Error(), m, format, args...)
}
Expand Down
2 changes: 1 addition & 1 deletion tpl/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func SetPageInContext(ctx context.Context, p page) context.Context {
return context.WithValue(ctx, texttemplate.PageContextKey, p)
}

// SetSecurityAllowActionJSTmpl sets the global setting for allowing tempalte actions in JS template literals.
// SetSecurityAllowActionJSTmpl sets the global setting for allowing template actions in JS template literals.
// This was added in Hugo 0.114.0.
// See https://github.com/golang/go/issues/59234
func SetSecurityAllowActionJSTmpl(b bool) {
Expand Down
2 changes: 1 addition & 1 deletion tpl/transform/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (ns *Namespace) HTMLEscape(s any) (string, error) {
return html.EscapeString(ss), nil
}

// HTMLUnescape returns a copy of s with HTML escape requences converted to plain
// HTMLUnescape returns a copy of s with HTML escape sequences converted to plain
// text.
func (ns *Namespace) HTMLUnescape(s any) (string, error) {
ss, err := cast.ToStringE(s)
Expand Down

0 comments on commit 3caade5

Please sign in to comment.