Add PluralizeListTitles option (default true) to allow disabling use of the inflect...
authorKristoffer Grönlund <krig@koru.se>
Tue, 24 Jun 2014 21:44:16 +0000 (23:44 +0200)
committerspf13 <steve.francia@gmail.com>
Mon, 30 Jun 2014 19:21:09 +0000 (15:21 -0400)
commands/hugo.go
hugolib/site.go

index d3e3bea1e81c9adcdf374d73f3c464e3132a875d..f5c8415ae25b7aa2c843cc58e527b9883e871db1 100644 (file)
@@ -51,7 +51,7 @@ Complete documentation is available at http://hugo.spf13.com`,
 
 var hugoCmdV *cobra.Command
 
-var BuildWatch, Draft, Future, UglyUrls, Verbose, Logging, VerboseLog, DisableRSS, DisableSitemap bool
+var BuildWatch, Draft, Future, UglyUrls, Verbose, Logging, VerboseLog, DisableRSS, DisableSitemap, PluralizeListTitles bool
 var Source, Destination, Theme, BaseUrl, CfgFile, LogFile string
 
 func Execute() {
@@ -84,6 +84,7 @@ func init() {
        HugoCmd.PersistentFlags().StringVar(&LogFile, "logFile", "", "Log File path (if set, logging enabled automatically)")
        HugoCmd.PersistentFlags().BoolVar(&VerboseLog, "verboseLog", false, "verbose logging")
        HugoCmd.PersistentFlags().BoolVar(&nitro.AnalysisOn, "stepAnalysis", false, "display memory and timing of different steps of the program")
+       HugoCmd.PersistentFlags().BoolVar(&PluralizeListTitles, "pluralizeListTitles", true, "Pluralize titles in lists using inflect")
        HugoCmd.Flags().BoolVarP(&BuildWatch, "watch", "w", false, "watch filesystem for changes and recreate as needed")
        hugoCmdV = HugoCmd
 }
@@ -119,6 +120,7 @@ func InitializeConfig() {
        viper.SetDefault("PygmentsStyle", "monokai")
        viper.SetDefault("PygmentsUseClasses", false)
        viper.SetDefault("DisableLiveReload", false)
+       viper.SetDefault("PluralizeListTitles", true)
 
        if hugoCmdV.PersistentFlags().Lookup("buildDrafts").Changed {
                viper.Set("BuildDrafts", Draft)
@@ -144,6 +146,10 @@ func InitializeConfig() {
                viper.Set("Verbose", Verbose)
        }
 
+       if hugoCmdV.PersistentFlags().Lookup("pluralizeListTitles").Changed {
+               viper.Set("PluralizeListTitles", PluralizeListTitles)
+       }
+
        if hugoCmdV.PersistentFlags().Lookup("logFile").Changed {
                viper.Set("LogFile", LogFile)
        }
index 86b4e07b901c7ad7594c9b80f1700d2e4d86fb2c..32c737415d92e534646badeaa1646d4e0bc6de7c 100644 (file)
@@ -676,7 +676,11 @@ func (s *Site) RenderListsOfTaxonomyTerms() (err error) {
 func (s *Site) RenderSectionLists() error {
        for section, data := range s.Sections {
                n := s.NewNode()
-               n.Title = strings.Title(inflect.Pluralize(section))
+               if viper.GetBool("PluralizeListTitles") {
+                       n.Title = strings.Title(inflect.Pluralize(section))
+               } else {
+                       n.Title = strings.Title(section)
+               }
                s.setUrls(n, section)
                n.Date = data[0].Page.Date
                n.Data["Pages"] = data.Pages()