mirror of
https://github.com/golang/go
synced 2024-11-15 02:40:32 -07:00
[release-branch.go1.2] go/doc: add full stop of Japanese, Chinese and Korean.
««« CL 21130043 / 0685a9549d5a go/doc: add full stop of Japanese, Chinese and Korean. This fix will show a good synopsis on package listings in that languages. R=adg, r CC=golang-dev https://golang.org/cl/21130043 »»» R=golang-dev CC=golang-dev https://golang.org/cl/25720043
This commit is contained in:
parent
9cb593dc89
commit
f7edec22f7
@ -22,6 +22,9 @@ func firstSentenceLen(s string) int {
|
||||
if q == ' ' && p == '.' && (!unicode.IsUpper(pp) || unicode.IsUpper(ppp)) {
|
||||
return i
|
||||
}
|
||||
if p == '。' || p == '.' {
|
||||
return i
|
||||
}
|
||||
ppp, pp, p = pp, p, q
|
||||
}
|
||||
return len(s)
|
||||
|
@ -28,6 +28,8 @@ var tests = []struct {
|
||||
{"P. Q. ", 8, "P. Q."},
|
||||
{"Package Καλημέρα κόσμε.", 36, "Package Καλημέρα κόσμε."},
|
||||
{"Package こんにちは 世界\n", 31, "Package こんにちは 世界"},
|
||||
{"Package こんにちは。世界", 26, "Package こんにちは。"},
|
||||
{"Package 안녕.世界", 17, "Package 안녕."},
|
||||
{"Package foo does bar.", 21, "Package foo does bar."},
|
||||
{"Copyright 2012 Google, Inc. Package foo does bar.", 27, ""},
|
||||
{"All Rights reserved. Package foo does bar.", 20, ""},
|
||||
|
Loading…
Reference in New Issue
Block a user