Skip to content

Commit

Permalink
Fix description of lang.FormatNumberCustom
Browse files Browse the repository at this point in the history
It currently refers to itself as a simple alternative, when it should
refer to lang.FormatNumber.
  • Loading branch information
jmooring authored and bep committed Nov 1, 2021
1 parent 0cc39af commit 04a3b45
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 5 deletions.
65 changes: 62 additions & 3 deletions docs/data/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@
"ino"
]
},
{
"Name": "ArmAsm",
"Aliases": [
"S",
"armasm",
"s"
]
},
{
"Name": "Awk",
"Aliases": [
Expand Down Expand Up @@ -133,6 +141,15 @@
"zshrc"
]
},
{
"Name": "BashSession",
"Aliases": [
"bash-session",
"console",
"sh-session",
"shell-session"
]
},
{
"Name": "Batchfile",
"Aliases": [
Expand Down Expand Up @@ -436,6 +453,13 @@
"factor"
]
},
{
"Name": "Fennel",
"Aliases": [
"fennel",
"fnl"
]
},
{
"Name": "Fish",
"Aliases": [
Expand Down Expand Up @@ -802,6 +826,15 @@
"mcfunction"
]
},
{
"Name": "Meson",
"Aliases": [
"build",
"meson",
"meson.build",
"txt"
]
},
{
"Name": "Metal",
"Aliases": [
Expand Down Expand Up @@ -925,6 +958,19 @@
"octave"
]
},
{
"Name": "OnesEnterprise",
"Aliases": [
"1S",
"1S:Enterprise",
"EPF",
"ERF",
"epf",
"erf",
"ones",
"onesenterprise"
]
},
{
"Name": "OpenSCAD",
"Aliases": [
Expand Down Expand Up @@ -1269,6 +1315,13 @@
"scss"
]
},
{
"Name": "Sieve",
"Aliases": [
"sieve",
"siv"
]
},
{
"Name": "Smalltalk",
"Aliases": [
Expand Down Expand Up @@ -3903,7 +3956,7 @@
},
"lang": {
"FormatAccounting": {
"Description": "FormatAccounting returns the currency reprecentation of number for the given currency and precision\nfor the current language in accounting notation.",
"Description": "FormatAccounting returns the currency representation of number for the given currency and precision\nfor the current language in accounting notation.\n\nThe return value is formatted with at least two decimal places.",
"Args": [
"precision",
"currency",
Expand All @@ -3918,7 +3971,7 @@
]
},
"FormatCurrency": {
"Description": "FormatCurrency returns the currency reprecentation of number for the given currency and precision\nfor the current language.",
"Description": "FormatCurrency returns the currency representation of number for the given currency and precision\nfor the current language.\n\nThe return value is formatted with at least two decimal places.",
"Args": [
"precision",
"currency",
Expand Down Expand Up @@ -3947,7 +4000,7 @@
]
},
"FormatNumberCustom": {
"Description": "FormatNumberCustom formats a number with the given precision using the\nnegative, decimal, and grouping options. The `options`\nparameter is a string consisting of `\u003cnegative\u003e \u003cdecimal\u003e \u003cgrouping\u003e`. The\ndefault `options` value is `- . ,`.\n\nNote that numbers are rounded up at 5 or greater.\nSo, with precision set to 0, 1.5 becomes `2`, and 1.4 becomes `1`.\n\nFor a simpler function that adapts to the current language, see FormatNumberCustom.",
"Description": "FormatNumberCustom formats a number with the given precision using the\nnegative, decimal, and grouping options. The `options`\nparameter is a string consisting of `\u003cnegative\u003e \u003cdecimal\u003e \u003cgrouping\u003e`. The\ndefault `options` value is `- . ,`.\n\nNote that numbers are rounded up at 5 or greater.\nSo, with precision set to 0, 1.5 becomes `2`, and 1.4 becomes `1`.\n\nFor a simpler function that adapts to the current language, see FormatNumber.",
"Args": [
"precision",
"number",
Expand Down Expand Up @@ -4331,6 +4384,12 @@
"Aliases": null,
"Examples": null
},
"Clean": {
"Description": "",
"Args": null,
"Aliases": null,
"Examples": null
},
"Dir": {
"Description": "",
"Args": null,
Expand Down
4 changes: 2 additions & 2 deletions tpl/lang/lang.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"strconv"
"strings"

translators "github.com/gohugoio/localescompressed"
"github.com/gohugoio/locales"
translators "github.com/gohugoio/localescompressed"
"github.com/pkg/errors"

"github.com/gohugoio/hugo/deps"
Expand Down Expand Up @@ -138,7 +138,7 @@ func (ns *Namespace) castPrecisionNumber(precision, number interface{}) (uint64,
// Note that numbers are rounded up at 5 or greater.
// So, with precision set to 0, 1.5 becomes `2`, and 1.4 becomes `1`.
//
// For a simpler function that adapts to the current language, see FormatNumberCustom.
// For a simpler function that adapts to the current language, see FormatNumber.
func (ns *Namespace) FormatNumberCustom(precision, number interface{}, options ...interface{}) (string, error) {
prec, err := cast.ToIntE(precision)
if err != nil {
Expand Down

0 comments on commit 04a3b45

Please sign in to comment.