return fmt.Errorf("No source files found")
}
+ contentDir := helpers.AbsPathify(viper.GetString("contentDir"))
jww.FEEDBACK.Println("processing", len(site.Source.Files()), "content files")
for _, file := range site.Source.Files() {
jww.INFO.Println("Attempting to convert", file.LogicalName())
metadata = newmetadata
}
- page.SetDir(filepath.Join(helpers.AbsPathify(viper.GetString("contentDir")), file.Dir()))
+ page.SetDir(filepath.Join(contentDir, file.Dir()))
page.SetSourceContent(psr.Content())
if err = page.SetSourceMetaData(metadata, mark); err != nil {
jww.ERROR.Printf("Failed to set source metadata for file %q: %s. For more info see For more info see https://github.com/spf13/hugo/issues/2458", page.FullFilePath(), err)
}
func build(watches ...bool) error {
-
// Hugo writes the output to memory instead of the disk
// This is only used for benchmark testing. Cause the content is only visible
// in memory
jww.FEEDBACK.Printf("Syncing all static files\n")
err := copyStatic()
if err != nil {
- utils.StopOnErr(err, fmt.Sprintf("Error copying static files to %s", helpers.AbsPathify(viper.GetString("publishDir"))))
+ utils.StopOnErr(err, fmt.Sprintf("Error copying static files to %s", publishDir))
}
} else {
staticSourceFs := getStaticSourceFs()
// Highlight takes some code and returns highlighted code.
func Highlight(code, lang, optsStr string) string {
-
if !HasPygments() {
jww.WARN.Println("Highlighting requires Pygments to be installed and in the path")
return code
}
func parseDefaultPygmentsOpts() (map[string]string, error) {
-
options := make(map[string]string)
err := parseOptions(options, viper.GetString("pygmentsOptions"))
if err != nil {
}
func parsePygmentsOpts(in string) (string, error) {
-
options, err := parseDefaultPygmentsOpts()
if err != nil {
return "", err
// LoadGlobalConfig loads Hugo configuration into the global Viper.
func LoadGlobalConfig(relativeSourcePath, configFilename string) error {
-
if relativeSourcePath == "" {
relativeSourcePath = "."
}
}
func commonConvert(p *Page, t tpl.Template) HandledResult {
-
if p.rendered {
panic(fmt.Sprintf("Page %q already rendered, does not need conversion", p.BaseFileName()))
}
if err != nil {
return nil, err
}
- // fmt.Printf("have a section override for %q in section %s → %s\n", p.Title, p.Section, permalink)
} else {
if len(pSlug) > 0 {
permalink = helpers.URLPrep(viper.GetBool("uglyURLs"), path.Join(dir, p.Slug+"."+p.Extension()))
}
func (s *Site) initializeSiteInfo() {
-
var (
lang *helpers.Language = s.Language
languages helpers.Languages
}
if n.paginator != nil {
-
paginatePath := helpers.Config().GetString("paginatePath")
// write alias for page 1
}
func (s *Site) renderHomePage(prepare bool) error {
-
n := s.newHomeNode(prepare, 0)
if prepare {
return nil
jww.WARN.Printf("No translation bundle found for default language %q", defaultContentLanguage)
}
+ enableMissingTranslationPlaceholders := viper.GetBool("enableMissingTranslationPlaceholders")
for _, lang := range bndl.LanguageTags() {
currentLang := lang
if Logi18nWarnings {
i18nWarningLogger.Printf("i18n|MISSING_TRANSLATION|%s|%s", currentLang, translationID)
}
- if viper.GetBool("enableMissingTranslationPlaceholders") {
+ if enableMissingTranslationPlaceholders {
return fmt.Sprintf("[i18n] %s", translationID)
}
if defaultT != nil {
// resGetRemote loads the content of a remote file. This method is thread safe.
func resGetRemote(url string, fs afero.Fs, hc *http.Client) ([]byte, error) {
-
c, err := resGetCache(url, fs, viper.GetBool("ignoreCache"))
if c != nil && err == nil {
return c, nil