go fmt
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
// Let's you specify how the index should look like.
|
||||
//
|
||||
// Let's you specify how the index should look like.
|
||||
//
|
||||
// The specification is a space-separated list of index entries. Normally, each entry is just a single character,
|
||||
// but you may also specify multiple characters. For instance, the entry "The" will link to all files and
|
||||
// folders starting with "The".
|
||||
//
|
||||
// folders starting with "The".
|
||||
//
|
||||
// You may also create an entry using a group of index characters in paranthesis. For instance, the entry
|
||||
// "A-E(ABCDE)" will display as "A-E" and link to all files and folders starting with either
|
||||
// A, B, C, D or E. This may be useful for grouping less-frequently used characters (such and X, Y and Z), or
|
||||
// for grouping accented characters (such as A, \u00C0 and \u00C1)
|
||||
//
|
||||
// for grouping accented characters (such as A, \u00C0 and \u00C1)
|
||||
//
|
||||
// Files and folders that are not covered by an index entry will be placed under the index entry "#".
|
||||
package utils
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type IndexGroups map[string]string
|
||||
@@ -37,4 +37,4 @@ func ParseIndexGroups(spec string) IndexGroups {
|
||||
}
|
||||
}
|
||||
return parsed
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -3,8 +3,8 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"encoding/json"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
const delimiter = "."
|
||||
@@ -49,7 +49,7 @@ func flattenList(l []interface{}, parent string, delimiter string) (map[string]i
|
||||
j[newkey] = value
|
||||
}
|
||||
default:
|
||||
// do nothing
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
return j, nil
|
||||
@@ -92,7 +92,7 @@ func flattenMap(m map[string]interface{}, parent string, delimiter string) (map[
|
||||
j[key] = value
|
||||
}
|
||||
default:
|
||||
//nothing
|
||||
//nothing
|
||||
}
|
||||
}
|
||||
return j, nil
|
||||
@@ -110,7 +110,7 @@ func FlattenMap(input map[string]interface{}) (map[string]interface{}, error) {
|
||||
|
||||
func ToMap(rec interface{}) (map[string]interface{}, error) {
|
||||
// Convert to JSON...
|
||||
b, err := json.Marshal(rec);
|
||||
b, err := json.Marshal(rec)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -123,7 +123,7 @@ func ToMap(rec interface{}) (map[string]interface{}, error) {
|
||||
|
||||
func ToStruct(m map[string]interface{}, rec interface{}) error {
|
||||
// Convert to JSON...
|
||||
b, err := json.Marshal(m);
|
||||
b, err := json.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,15 +1,15 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"github.com/astaxie/beego"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func NoArticle(name string) string {
|
||||
articles := strings.Split(beego.AppConfig.String("ignoredArticles"), " ")
|
||||
for _, a := range articles {
|
||||
n := strings.TrimPrefix(name, a + " ")
|
||||
if (n != name) {
|
||||
n := strings.TrimPrefix(name, a+" ")
|
||||
if n != name {
|
||||
return n
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"testing"
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestParseIndexGroup(t *testing.T) {
|
||||
@@ -40,4 +40,4 @@ func TestParseIndexGroup(t *testing.T) {
|
||||
So(parsed, ShouldContainKey, "海")
|
||||
So(parsed["海"], ShouldEqual, "UTF8")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user