-// Package cache contains the differenct cache implementations.
+// Package cache contains the different cache implementations.
package cache
// Max age of cache entries in this cache. Any items older than this will
// be removed and not returned from the cache.
// A negative value means forever, 0 means cache is disabled.
- // Hugo is leninent with what types it accepts here, but we recommend using
+ // Hugo is lenient with what types it accepts here, but we recommend using
// a duration string, a sequence of decimal numbers, each with optional fraction and a unit suffix,
// such as "300ms", "1.5h" or "2h45m".
// Valid time units are "ns", "us" (or "ยตs"), "ms", "s", "m", "h".
renderStaticToDisk := cfg.GetBool("renderStaticToDisk")
sourceFs := hugofs.Os
- var desinationFs afero.Fs
+ var destinationFs afero.Fs
if cfg.GetBool("renderToDisk") {
- desinationFs = hugofs.Os
+ destinationFs = hugofs.Os
} else {
- desinationFs = afero.NewMemMapFs()
+ destinationFs = afero.NewMemMapFs()
if renderStaticToDisk {
// Hybrid, render dynamic content to Root.
cfg.Set("publishDirDynamic", "/")
}
}
- fs := hugofs.NewFromSourceAndDestination(sourceFs, desinationFs, cfg)
+ fs := hugofs.NewFromSourceAndDestination(sourceFs, destinationFs, cfg)
if renderStaticToDisk {
dynamicFs := fs.PublishDir
r *rootCommand
h *hugolib.HugoSites
- // Commmands.
+ // Commands.
commands []simplecobra.Commander
}
}
// LineMatcherFn is used to match a line with an error.
-// It returns the column number or 0 if the line was found, but column could not be determinde. Returns -1 if no line match.
+// It returns the column number or 0 if the line was found, but column could not be determined. Returns -1 if no line match.
type LineMatcherFn func(m LineMatcher) int
// SimpleLineMatcher simply matches by line number.
}
// The error type from the minifier contains line number and column number.
- if line, col := exctractLineNumberAndColumnNumber(err); line >= 0 {
+ if line, col := extractLineNumberAndColumnNumber(err); line >= 0 {
pos.LineNumber = line
pos.ColumnNumber = col
return fileType, pos
}
}
-func exctractLineNumberAndColumnNumber(e error) (int, int) {
+func extractLineNumberAndColumnNumber(e error) (int, int) {
switch v := e.(type) {
case *parse.Error:
return v.Line, v.Column
return exec.Command(bin, arg...), nil
}
-// Exec encorces a security policy for commands run via os/exec.
+// Exec enforces a security policy for commands run via os/exec.
type Exec struct {
sc security.Config
// return the filename minus the extension (and the ".")
name = base[:strings.LastIndex(base, ".")]
} else {
- // no extension case so just return base, which willi
+ // no extension case so just return base, which will
// be the filename
name = base
}
// Copyright information.
Copyright string
- // The language to apply to content without any Clolanguage indicator.
+ // The language to apply to content without any language indicator.
DefaultContentLanguage string
- // By defefault, we put the default content language in the root and the others below their language ID, e.g. /no/.
+ // By default, we put the default content language in the root and the others below their language ID, e.g. /no/.
// Set this to true to put all languages below their language ID.
DefaultContentLanguageInSubdir bool
Source: `(postcss|tailwind)\.config\.js`,
Target: cssTargetCachebusterRe,
},
- // This is deliberatly coarse grained; it will cache bust resources with "json" in the cache key when js files changes, which is good.
+ // This is deliberately coarse grained; it will cache bust resources with "json" in the cache key when js files changes, which is good.
{
Source: `assets/.*\.(.*)$`,
Target: `$1`,
// related aggregated data (e.g. CSS class names).
WriteStats bool
- // Can be used to toggle off writing of the intellinsense /assets/jsconfig.js
+ // Can be used to toggle off writing of the IntelliSense /assets/jsconfig.js
// file.
NoJSConfigInAssets bool
emojiMaxSize int
)
-// Emoji returns the emojy given a key, e.g. ":smile:", nil if not found.
+// Emoji returns the emoji given a key, e.g. ":smile:", nil if not found.
func Emoji(key string) []byte {
emojiInit.Do(initEmoji)
return emojis[key]
{" :beer: :", []byte(" ๐บ :")},
{":beer: and :smile: and another :beer:!", []byte("๐บ and ๐ and another ๐บ!")},
{" :beer: : ", []byte(" ๐บ : ")},
- {"No smilies for you!", []byte("No smilies for you!")},
+ {"No smiles for you!", []byte("No smiles for you!")},
{" The motto: no smiles! ", []byte(" The motto: no smiles! ")},
{":hugo_is_the_best_static_gen:", []byte(":hugo_is_the_best_static_gen:")},
{"์ํ :smile: ์ํ", []byte("์ํ ๐ ์ํ")},
}
// CreateTempDir creates a temp dir in the given filesystem and
-// returns the dirnam and a func that removes it when done.
+// returns the dirname and a func that removes it when done.
func CreateTempDir(fs afero.Fs, prefix string) (string, func(), error) {
tempDir, err := afero.TempDir(fs, "", prefix)
if err != nil {
fim := fi.(FileMetaInfo)
langs := translations[fim.Meta().TranslationBaseNameWithExt]
if len(langs) > 0 {
- fim.Meta().Translations = sortAndremoveStringDuplicates(langs)
+ fim.Meta().Translations = sortAndRemoveStringDuplicates(langs)
}
}
}
})
}
-func sortAndremoveStringDuplicates(s []string) []string {
+func sortAndRemoveStringDuplicates(s []string) []string {
ss := sort.StringSlice(s)
ss.Sort()
i := 0
}
// IsOsFs returns whether fs is an OsFs or if it fs wraps an OsFs.
-// TODO(bep) make this nore robust.
+// TODO(bep) make this more robust.
func IsOsFs(fs afero.Fs) bool {
var isOsFs bool
WalkFilesystems(fs, func(fs afero.Fs) bool {
c.Assert(includeOnlyFilter.Match("ab.jpg", false), qt.Equals, true)
c.Assert(includeOnlyFilter.Match("ab.gif", false), qt.Equals, false)
- exlcudeOnlyFilter, err := NewFilenameFilter(nil, []string{"**.json", "**.jpg"})
+ excludeOnlyFilter, err := NewFilenameFilter(nil, []string{"**.json", "**.jpg"})
c.Assert(err, qt.IsNil)
- c.Assert(exlcudeOnlyFilter.Match("ab.json", false), qt.Equals, false)
- c.Assert(exlcudeOnlyFilter.Match("ab.jpg", false), qt.Equals, false)
- c.Assert(exlcudeOnlyFilter.Match("ab.gif", false), qt.Equals, true)
+ c.Assert(excludeOnlyFilter.Match("ab.json", false), qt.Equals, false)
+ c.Assert(excludeOnlyFilter.Match("ab.jpg", false), qt.Equals, false)
+ c.Assert(excludeOnlyFilter.Match("ab.gif", false), qt.Equals, true)
var nilFilter *FilenameFilter
c.Assert(nilFilter.Match("ab.gif", false), qt.Equals, true)
files := `
-- hugo.toml --
baseURL = "https://example.com"
-disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "setion"]
+disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "section"]
title = "Base Title"
staticDir = "mystatic"
[params]
files := `
-- hugo.toml --
baseURL = "https://example.com"
-disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "setion"]
+disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "section"]
title = "Base Title"
staticDir = "mystatic"
[params]
files := `
-- hugo.toml --
baseURL = "https://example.com"
-disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "setion"]
+disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "section"]
title = "Base Title"
defaultContentLanguage = "sv"
disableLanguages = ["sv"]
files := `
-- hugo.toml --
baseURL = "https://example.com"
-disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "setion"]
+disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "section"]
title = "Base Title"
[params]
p1 = "p1base"
-- hugo.toml --
baseURL = "https://example.com"
-disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "setion"]
+disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "section"]
ignoreErrors = ["error-missing-instagram-accesstoken"]
[params]
a = "a1"
files := `
-- hugo.toml --
baseURL = "https://example.com"
-disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "setion"]
+disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "section"]
theme = "mytheme"
-- data/a.toml --
v1 = "a_v1"
files := `
-- hugo.toml --
baseURL = "https://example.com"
-disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "setion"]
+disableKinds = ["taxonomy", "term", "RSS", "sitemap", "robotsTXT", "page", "section"]
ignoreErrors = ["error-missing-instagram-accesstoken"]
[params]
foo = "bar"
// This will only be set when js.Build have been triggered with
// imports that resolves to the project or a module.
// Write a jsconfig.json file to the project's /asset directory
- // to help JS intellisense in VS Code etc.
+ // to help JS IntelliSense in VS Code etc.
if !h.ResourceSpec.BuildConfig().NoJSConfigInAssets && h.BaseFs.Assets.Dirs != nil {
fi, err := h.BaseFs.Assets.Fs.Stat("")
if err != nil {
{"Root relative, no slash, root page", page.KindPage, nil, []string{"about.md", "ABOUT.md"}, "about page"},
{"Root relative, no slash, section", page.KindSection, nil, []string{"sect3"}, "section 3"},
{"Root relative, no slash, section page", page.KindPage, nil, []string{"sect3/page1.md"}, "Title3_1"},
- {"Root relative, no slash, sub setion", page.KindSection, nil, []string{"sect3/sect7"}, "another sect7"},
+ {"Root relative, no slash, sub section", page.KindSection, nil, []string{"sect3/sect7"}, "another sect7"},
{"Root relative, no slash, nested page", page.KindPage, nil, []string{"sect3/subsect/deep.md"}, "deep page"},
{"Root relative, no slash, OS slashes", page.KindPage, nil, []string{filepath.FromSlash("sect5/page3.md")}, "Title5_3"},
// content root relative paths without a leading slash, the lookup
// returns /sect7. This undermines ambiguity detection, but we have no choice.
//{"Ambiguous", nil, []string{"sect7"}, ""},
- {"Section, ambigous", page.KindSection, nil, []string{"sect7"}, "Sect7s"},
+ {"Section, ambiguous", page.KindSection, nil, []string{"sect7"}, "Sect7s"},
{"Absolute, home", page.KindHome, nil, []string{"/", ""}, "home page"},
{"Absolute, page", page.KindPage, nil, []string{"/about.md", "/about"}, "about page"},
return s.getLanguagePermalinkLang(alwaysInSubDir)
}
-// get any lanaguagecode to prefix the relative permalink with.
+// get any language code to prefix the relative permalink with.
func (s *Site) getLanguagePermalinkLang(alwaysInSubDir bool) string {
if !s.h.isMultiLingual() || s.h.Conf.IsMultihost() {
return ""
return l, l.loadLocation(timeZone)
}
-// This is injected from hugolib to avoid cirular dependencies.
+// This is injected from hugolib to avoid circular dependencies.
var DeprecationFunc = func(item, alternative string, err bool) {}
const paramsDeprecationWarning = `.Language.Params is deprecated and will be removed in a future release. Use site.Params instead.
wsHub.broadcast <- []byte(msg)
}
-// ServeJS serves the liverreload.js who's reference is injected into the page.
+// ServeJS serves the livereload.js who's reference is injected into the page.
func ServeJS(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", media.Builtin.JavascriptType.Type)
w.Write(liveReloadJS())
)
// Builder builds a jsconfig.json file that, currently, is used only to assist
-// intellinsense in editors.
+// IntelliSense in editors.
type Builder struct {
sourceRootsMu sync.RWMutex
sourceRoots map[string]bool
if m != nil {
// Store the source root so we can create a jsconfig.json
- // to help intellisense when the build is done.
+ // to help IntelliSense when the build is done.
// This should be a small number of elements, and when
// in server mode, we may get stale entries on renames etc.,
// but that shouldn't matter too much.