"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tpl/inflect/inflect.go" between
hugo-0.80.0.tar.gz and hugo-0.81.0.tar.gz

About: Hugo is a static site generator that takes a source directory of Markdown files and templates and uses these as input to create a complete website (written in Go).

inflect.go  (hugo-0.80.0):inflect.go  (hugo-0.81.0)
skipping to change at line 19 skipping to change at line 19
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// Package inflect provides template functions for the inflection of words. // Package inflect provides template functions for the inflection of words.
package inflect package inflect
import ( import (
"strconv" "strconv"
"strings"
_inflect "github.com/markbates/inflect" _inflect "github.com/gobuffalo/flect"
"github.com/spf13/cast" "github.com/spf13/cast"
) )
// New returns a new instance of the inflect-namespaced template functions. // New returns a new instance of the inflect-namespaced template functions.
func New() *Namespace { func New() *Namespace {
return &Namespace{} return &Namespace{}
} }
// Namespace provides template functions for the "inflect" namespace. // Namespace provides template functions for the "inflect" namespace.
type Namespace struct{} type Namespace struct{}
skipping to change at line 56 skipping to change at line 57
if word == "" { if word == "" {
return "", nil return "", nil
} }
_, ok := in.(int) // original param was literal int value _, ok := in.(int) // original param was literal int value
_, err = strconv.Atoi(word) // original param was string containing an in t value _, err = strconv.Atoi(word) // original param was string containing an in t value
if ok || err == nil { if ok || err == nil {
return _inflect.Ordinalize(word), nil return _inflect.Ordinalize(word), nil
} }
return _inflect.Humanize(word), nil str := _inflect.Humanize(word)
return _inflect.Humanize(strings.ToLower(str)), nil
} }
// Pluralize returns the plural form of a single word. // Pluralize returns the plural form of a single word.
func (ns *Namespace) Pluralize(in interface{}) (string, error) { func (ns *Namespace) Pluralize(in interface{}) (string, error) {
word, err := cast.ToStringE(in) word, err := cast.ToStringE(in)
if err != nil { if err != nil {
return "", err return "", err
} }
return _inflect.Pluralize(word), nil return _inflect.Pluralize(word), nil
 End of changes. 3 change blocks. 
2 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)