Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCathrine Paulsen <c.r.paulsen@student.tudelft.nl>2022-03-10 16:10:21 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-03-14 21:39:07 +0300
commit61cf3c9f6386d06c18c663195b35c4152605c398 (patch)
tree5e4872e6da7f6e03a4b9e71451d7ac49404f670a
parent31fbc081c98d55a6e4b9da38c2ff29777da0b0c0 (diff)
Fix and refactor typos
-rw-r--r--create/content.go4
-rw-r--r--hugolib/content_factory.go24
-rw-r--r--hugolib/content_factory_test.go2
3 files changed, 15 insertions, 15 deletions
diff --git a/create/content.go b/create/content.go
index 400cff341..ad375b8c5 100644
--- a/create/content.go
+++ b/create/content.go
@@ -283,10 +283,10 @@ func (b *contentBuilder) applyArcheType(contentFilename, archetypeFilename strin
defer f.Close()
if archetypeFilename == "" {
- return b.cf.AppplyArchetypeTemplate(f, p, b.kind, DefaultArchetypeTemplateTemplate)
+ return b.cf.ApplyArchetypeTemplate(f, p, b.kind, DefaultArchetypeTemplateTemplate)
}
- return b.cf.AppplyArchetypeFilename(f, p, b.kind, archetypeFilename)
+ return b.cf.ApplyArchetypeFilename(f, p, b.kind, archetypeFilename)
}
diff --git a/hugolib/content_factory.go b/hugolib/content_factory.go
index cc87dd9e5..bf16a9821 100644
--- a/hugolib/content_factory.go
+++ b/hugolib/content_factory.go
@@ -35,12 +35,12 @@ type ContentFactory struct {
// We parse the archetype templates as Go templates, so we need
// to replace any shortcode with a temporary placeholder.
- shortocdeReplacerPre *strings.Replacer
- shortocdeReplacerPost *strings.Replacer
+ shortcodeReplacerPre *strings.Replacer
+ shortcodeReplacerPost *strings.Replacer
}
-// AppplyArchetypeFilename archetypeFilename to w as a template using the given Page p as the foundation for the data context.
-func (f ContentFactory) AppplyArchetypeFilename(w io.Writer, p page.Page, archetypeKind, archetypeFilename string) error {
+// ApplyArchetypeFilename archetypeFilename to w as a template using the given Page p as the foundation for the data context.
+func (f ContentFactory) ApplyArchetypeFilename(w io.Writer, p page.Page, archetypeKind, archetypeFilename string) error {
fi, err := f.h.SourceFilesystems.Archetypes.Fs.Stat(archetypeFilename)
if err != nil {
@@ -57,12 +57,12 @@ func (f ContentFactory) AppplyArchetypeFilename(w io.Writer, p page.Page, archet
}
- return f.AppplyArchetypeTemplate(w, p, archetypeKind, string(templateSource))
+ return f.ApplyArchetypeTemplate(w, p, archetypeKind, string(templateSource))
}
-// AppplyArchetypeFilename templateSource to w as a template using the given Page p as the foundation for the data context.
-func (f ContentFactory) AppplyArchetypeTemplate(w io.Writer, p page.Page, archetypeKind, templateSource string) error {
+// ApplyArchetypeTemplate templateSource to w as a template using the given Page p as the foundation for the data context.
+func (f ContentFactory) ApplyArchetypeTemplate(w io.Writer, p page.Page, archetypeKind, templateSource string) error {
ps := p.(*pageState)
if archetypeKind == "" {
archetypeKind = p.Type()
@@ -75,7 +75,7 @@ func (f ContentFactory) AppplyArchetypeTemplate(w io.Writer, p page.Page, archet
File: p.File(),
}
- templateSource = f.shortocdeReplacerPre.Replace(templateSource)
+ templateSource = f.shortcodeReplacerPre.Replace(templateSource)
templ, err := ps.s.TextTmpl().Parse("archetype.md", string(templateSource))
if err != nil {
@@ -87,7 +87,7 @@ func (f ContentFactory) AppplyArchetypeTemplate(w io.Writer, p page.Page, archet
return errors.Wrapf(err, "failed to execute archetype template: %s", err)
}
- _, err = io.WriteString(w, f.shortocdeReplacerPost.Replace(result))
+ _, err = io.WriteString(w, f.shortcodeReplacerPost.Replace(result))
return err
@@ -116,7 +116,7 @@ func (f ContentFactory) CreateContentPlaceHolder(filename string) (string, error
return "", err
}
- // This will be overwritten later, just write a placholder to get
+ // This will be overwritten later, just write a placeholder to get
// the paths correct.
placeholder := `---
title: "Content Placeholder"
@@ -135,12 +135,12 @@ _build:
func NewContentFactory(h *HugoSites) ContentFactory {
return ContentFactory{
h: h,
- shortocdeReplacerPre: strings.NewReplacer(
+ shortcodeReplacerPre: strings.NewReplacer(
"{{<", "{x{<",
"{{%", "{x{%",
">}}", ">}x}",
"%}}", "%}x}"),
- shortocdeReplacerPost: strings.NewReplacer(
+ shortcodeReplacerPost: strings.NewReplacer(
"{x{<", "{{<",
"{x{%", "{{%",
">}x}", ">}}",
diff --git a/hugolib/content_factory_test.go b/hugolib/content_factory_test.go
index dc3b4fc91..23dcd660a 100644
--- a/hugolib/content_factory_test.go
+++ b/hugolib/content_factory_test.go
@@ -52,7 +52,7 @@ Hello World.
b.Assert(p, qt.Not(qt.IsNil))
var buf bytes.Buffer
- b.Assert(cf.AppplyArchetypeFilename(&buf, p, "", "post.md"), qt.IsNil)
+ b.Assert(cf.ApplyArchetypeFilename(&buf, p, "", "post.md"), qt.IsNil)
b.Assert(buf.String(), qt.Contains, `title: "Mypage"`)
})