mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-29 22:29:56 +02:00
all: Fix minor typos
This commit is contained in:
@@ -21,7 +21,7 @@ import (
|
||||
)
|
||||
|
||||
func Test073(t *testing.T) {
|
||||
asertDisabledTaxonomyAndTerm := func(b *sitesBuilder, taxonomy, term bool) {
|
||||
assertDisabledTaxonomyAndTerm := func(b *sitesBuilder, taxonomy, term bool) {
|
||||
b.Assert(b.CheckExists("public/tags/index.html"), qt.Equals, taxonomy)
|
||||
b.Assert(b.CheckExists("public/tags/tag1/index.html"), qt.Equals, term)
|
||||
}
|
||||
@@ -88,7 +88,7 @@ taxonomy = ["JSON"]
|
||||
`disableKinds = ["taxonomy", "taxonomyTerm"]`,
|
||||
func(err error, out string, b *sitesBuilder) {
|
||||
b.Assert(err, qt.IsNil)
|
||||
asertDisabledTaxonomyAndTerm(b, false, false)
|
||||
assertDisabledTaxonomyAndTerm(b, false, false)
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -96,7 +96,7 @@ taxonomy = ["JSON"]
|
||||
`disableKinds = ["taxonomyTerm"]`,
|
||||
func(err error, out string, b *sitesBuilder) {
|
||||
b.Assert(err, qt.IsNil)
|
||||
asertDisabledTaxonomyAndTerm(b, false, true)
|
||||
assertDisabledTaxonomyAndTerm(b, false, true)
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -113,7 +113,7 @@ taxonomy = ["JSON"]
|
||||
ignoreErrors = ["error-disable-taxonomy"]`,
|
||||
func(err error, out string, b *sitesBuilder) {
|
||||
b.Assert(err, qt.IsNil)
|
||||
asertDisabledTaxonomyAndTerm(b, false, true)
|
||||
assertDisabledTaxonomyAndTerm(b, false, true)
|
||||
},
|
||||
},
|
||||
} {
|
||||
|
@@ -58,8 +58,8 @@ const (
|
||||
cmLeafSeparator = "__hl_"
|
||||
)
|
||||
|
||||
// Used to mark ambigous keys in reverse index lookups.
|
||||
var ambigousContentNode = &contentNode{}
|
||||
// Used to mark ambiguous keys in reverse index lookups.
|
||||
var ambiguousContentNode = &contentNode{}
|
||||
|
||||
func newContentMap(cfg contentMapConfig) *contentMap {
|
||||
m := &contentMap{
|
||||
@@ -86,8 +86,8 @@ func newContentMap(cfg contentMapConfig) *contentMap {
|
||||
addToReverseMap := func(k string, n *contentNode, m map[interface{}]*contentNode) {
|
||||
k = strings.ToLower(k)
|
||||
existing, found := m[k]
|
||||
if found && existing != ambigousContentNode {
|
||||
m[k] = ambigousContentNode
|
||||
if found && existing != ambiguousContentNode {
|
||||
m[k] = ambiguousContentNode
|
||||
} else if !found {
|
||||
m[k] = n
|
||||
}
|
||||
|
@@ -232,7 +232,7 @@ func (m *pageMap) newResource(fim hugofs.FileMetaInfo, owner *pageState) (resour
|
||||
outputFormats := owner.m.outputFormats()
|
||||
seen := make(map[string]bool)
|
||||
var targetBasePaths []string
|
||||
// Make sure bundled resources are published to all of the ouptput formats'
|
||||
// Make sure bundled resources are published to all of the output formats'
|
||||
// sub paths.
|
||||
for _, f := range outputFormats {
|
||||
p := f.Path
|
||||
|
@@ -185,7 +185,7 @@ func TestShortcodeYoutube(t *testing.T) {
|
||||
`{{< youtube id="w7Ft2ymGmfc" class="video" autoplay="true" >}}`,
|
||||
"(?s)\n<div class=\"video\">.*?<iframe src=\"https://www.youtube.com/embed/w7Ft2ymGmfc\\?autoplay=1\".*?allowfullscreen title=\"YouTube Video\">.*?</iframe>.*?</div>",
|
||||
},
|
||||
// set custom title for accessability)
|
||||
// set custom title for accessibility)
|
||||
{
|
||||
`{{< youtube id="w7Ft2ymGmfc" title="A New Hugo Site in Under Two Minutes" >}}`,
|
||||
"(?s)\n<div style=\".*?\">.*?<iframe src=\"https://www.youtube.com/embed/w7Ft2ymGmfc\" style=\".*?\" allowfullscreen title=\"A New Hugo Site in Under Two Minutes\">.*?</iframe>.*?</div>",
|
||||
|
@@ -151,7 +151,7 @@ JS imported in module: |
|
||||
"devDependencies": {
|
||||
"postcss-cli": "7.8.0",
|
||||
"tailwindcss": "1.8.0"
|
||||
|
||||
|
||||
}
|
||||
}`)
|
||||
|
||||
@@ -375,7 +375,7 @@ module github.com/gohugoio/tests/testHugoModules
|
||||
}
|
||||
|
||||
func createChildModMatchers(m *mods.Md, ignoreVendor, vendored bool) []string {
|
||||
// Child depdendencies are one behind.
|
||||
// Child dependencies are one behind.
|
||||
expectMinorVersion := 3
|
||||
|
||||
if !ignoreVendor && vendored {
|
||||
@@ -1078,7 +1078,7 @@ workingDir=%q
|
||||
[[module.mounts]]
|
||||
source = %q
|
||||
target = "content"
|
||||
|
||||
|
||||
`, workDir, absContentDir)
|
||||
|
||||
defer clean1()
|
||||
|
@@ -584,7 +584,7 @@ type renderStringOpts struct {
|
||||
Markup string
|
||||
}
|
||||
|
||||
var defualtRenderStringOpts = renderStringOpts{
|
||||
var defaultRenderStringOpts = renderStringOpts{
|
||||
Display: "inline",
|
||||
Markup: "", // Will inherit the page's value when not set.
|
||||
}
|
||||
@@ -595,7 +595,7 @@ func (p *pageState) RenderString(args ...interface{}) (template.HTML, error) {
|
||||
}
|
||||
|
||||
var s string
|
||||
opts := defualtRenderStringOpts
|
||||
opts := defaultRenderStringOpts
|
||||
sidx := 1
|
||||
|
||||
if len(args) == 1 {
|
||||
@@ -978,7 +978,7 @@ func (p *pageState) shiftToOutputFormat(isRenderingSite bool, idx int) error {
|
||||
//
|
||||
// For pages that have a source file, it is returns the path to this file as an
|
||||
// absolute path rooted in this site's content dir.
|
||||
// For pages that do not (sections witout content page etc.), it returns the
|
||||
// For pages that do not (sections without content page etc.), it returns the
|
||||
// virtual path, consistent with where you would add a source file.
|
||||
func (p *pageState) sourceRef() string {
|
||||
if !p.File().IsZero() {
|
||||
|
@@ -57,7 +57,7 @@ type pageCommon struct {
|
||||
bucket *pagesMapBucket
|
||||
treeRef *contentTreeRef
|
||||
|
||||
// Laziliy initialized dependencies.
|
||||
// Lazily initialized dependencies.
|
||||
init *lazy.Init
|
||||
|
||||
// All of these represents the common parts of a page.Page
|
||||
|
@@ -302,7 +302,7 @@ func TestPageBundlerSiteMultilingual(t *testing.T) {
|
||||
// A bundle in a/b/index.en.md
|
||||
// a/b/index.en.md => OK
|
||||
// a/b/index => OK
|
||||
// index.en.md => ambigous, but OK.
|
||||
// index.en.md => ambiguous, but OK.
|
||||
// With bundles, the file name has little meaning, the folder it lives in does. So this should also work:
|
||||
// a/b
|
||||
// and probably also just b (aka "my-bundle")
|
||||
@@ -1250,7 +1250,7 @@ func TestBundleTransformMany(t *testing.T) {
|
||||
title: "Page"
|
||||
weight: %d
|
||||
---
|
||||
|
||||
|
||||
`, i))
|
||||
b.WithSourceFile(fmt.Sprintf("content/bundle%d/data.yaml", i), fmt.Sprintf(`data: v%d`, i))
|
||||
b.WithSourceFile(fmt.Sprintf("content/bundle%d/data.json", i), fmt.Sprintf(`{ "data": "v%d" }`, i))
|
||||
|
@@ -98,7 +98,7 @@ func newPageCollections(m *pageMap) *PageCollections {
|
||||
|
||||
// This is an adapter func for the old API with Kind as first argument.
|
||||
// This is invoked when you do .Site.GetPage. We drop the Kind and fails
|
||||
// if there are more than 2 arguments, which would be ambigous.
|
||||
// if there are more than 2 arguments, which would be ambiguous.
|
||||
func (c *PageCollections) getPageOldVersion(ref ...string) (page.Page, error) {
|
||||
var refs []string
|
||||
for _, r := range ref {
|
||||
@@ -291,7 +291,7 @@ func (c *PageCollections) getContentNode(context page.Page, isReflink bool, ref
|
||||
getByName := func(s string) (*contentNode, error) {
|
||||
n := m.pageReverseIndex.Get(s)
|
||||
if n != nil {
|
||||
if n == ambigousContentNode {
|
||||
if n == ambiguousContentNode {
|
||||
return nil, fmt.Errorf("page reference %q is ambiguous", ref)
|
||||
}
|
||||
return n, nil
|
||||
|
@@ -278,7 +278,7 @@ func (c *pagesCollector) addToBundle(info hugofs.FileMetaInfo, btyp bundleDirTyp
|
||||
if btyp == bundleBranch {
|
||||
// No special logic for branch bundles.
|
||||
// Every language needs its own _index.md file.
|
||||
// Also, we only clone bundle headers for lonsesome, bundled,
|
||||
// Also, we only clone bundle headers for lonesome, bundled,
|
||||
// content files.
|
||||
return c.handleFiles(info)
|
||||
}
|
||||
|
@@ -268,7 +268,7 @@ func (p *Paths) RelPathify(filename string) string {
|
||||
return strings.TrimPrefix(strings.TrimPrefix(filename, p.WorkingDir), FilePathSeparator)
|
||||
}
|
||||
|
||||
// AbsPathify creates an absolute path if given a working dir and arelative path.
|
||||
// AbsPathify creates an absolute path if given a working dir and a relative path.
|
||||
// If already absolute, the path is just cleaned.
|
||||
func AbsPathify(workingDir, inPath string) string {
|
||||
if filepath.IsAbs(inPath) {
|
||||
|
@@ -956,7 +956,7 @@ func (s *Site) translateFileEvents(events []fsnotify.Event) []fsnotify.Event {
|
||||
eventMap := make(map[string][]fsnotify.Event)
|
||||
|
||||
// We often get a Remove etc. followed by a Create, a Create followed by a Write.
|
||||
// Remove the superflous events to mage the update logic simpler.
|
||||
// Remove the superfluous events to mage the update logic simpler.
|
||||
for _, ev := range events {
|
||||
eventMap[ev.Name] = append(eventMap[ev.Name], ev)
|
||||
}
|
||||
@@ -999,7 +999,7 @@ var (
|
||||
)
|
||||
|
||||
// reBuild partially rebuilds a site given the filesystem events.
|
||||
// It returns whetever the content source was changed.
|
||||
// It returns whatever the content source was changed.
|
||||
// TODO(bep) clean up/rewrite this method.
|
||||
func (s *Site) processPartial(config *BuildCfg, init func(config *BuildCfg) error, events []fsnotify.Event) error {
|
||||
events = s.filterFileEvents(events)
|
||||
@@ -1513,7 +1513,7 @@ func (s *Site) assembleMenus() {
|
||||
}
|
||||
}
|
||||
|
||||
// get any lanaguagecode to prefix the target file path with.
|
||||
// get any language code to prefix the target file path with.
|
||||
func (s *Site) getLanguageTargetPathLang(alwaysInSubDir bool) string {
|
||||
if s.h.IsMultihost() {
|
||||
return s.Language().Lang
|
||||
|
@@ -316,7 +316,7 @@ categories: ["This is Cool", "And new" ]
|
||||
---
|
||||
|
||||
Content.
|
||||
|
||||
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -454,7 +454,7 @@ categories: ["funny"]
|
||||
`,
|
||||
"categories/_index.md", "---\ntitle: Categories Page\n---",
|
||||
"categories/data.json", "Category data",
|
||||
"categories/funny/_index.md", "---\ntitle: Funnny Category\n---",
|
||||
"categories/funny/_index.md", "---\ntitle: Funny Category\n---",
|
||||
"categories/funny/funnydata.json", "Category funny data",
|
||||
)
|
||||
|
||||
@@ -525,7 +525,7 @@ Funny:|/p2/|`)
|
||||
func TestTaxonomiesListPages(t *testing.T) {
|
||||
b := newTestSitesBuilder(t)
|
||||
b.WithTemplates("_default/list.html", `
|
||||
|
||||
|
||||
{{ template "print-taxo" "categories.cats" }}
|
||||
{{ template "print-taxo" "categories.funny" }}
|
||||
|
||||
@@ -560,7 +560,7 @@ categories: ["cats"]
|
||||
b.Build(BuildCfg{})
|
||||
|
||||
b.AssertFileContent("public/index.html", `
|
||||
|
||||
|
||||
Len categories.cats: 2
|
||||
categories.cats:|/blog/|
|
||||
categories.cats:|/|
|
||||
|
@@ -928,13 +928,13 @@ func buildSingleSite(t testing.TB, depsCfg deps.DepsCfg, buildCfg BuildCfg) *Sit
|
||||
return buildSingleSiteExpected(t, false, false, depsCfg, buildCfg)
|
||||
}
|
||||
|
||||
func buildSingleSiteExpected(t testing.TB, expectSiteInitEror, expectBuildError bool, depsCfg deps.DepsCfg, buildCfg BuildCfg) *Site {
|
||||
func buildSingleSiteExpected(t testing.TB, expectSiteInitError, expectBuildError bool, depsCfg deps.DepsCfg, buildCfg BuildCfg) *Site {
|
||||
t.Helper()
|
||||
b := newTestSitesBuilderFromDepsCfg(t, depsCfg).WithNothingAdded()
|
||||
|
||||
err := b.CreateSitesE()
|
||||
|
||||
if expectSiteInitEror {
|
||||
if expectSiteInitError {
|
||||
b.Assert(err, qt.Not(qt.IsNil))
|
||||
return nil
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user