]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.2] go/doc: add full stop of Japanese, Chinese and Korean.
authorAndrew Gerrand <adg@golang.org>
Wed, 13 Nov 2013 03:31:58 +0000 (14:31 +1100)
committerAndrew Gerrand <adg@golang.org>
Wed, 13 Nov 2013 03:31:58 +0000 (14:31 +1100)
««« 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

src/pkg/go/doc/synopsis.go
src/pkg/go/doc/synopsis_test.go

index d1ad86c74166edf238ec798f3140373eb4b4a277..c90080b7cc1752c8d8b344e560e1601cc197c9b0 100644 (file)
@@ -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)
index fd7081a07c2c6adc3758192c2b6ed50c9ecbf1e7..59b253cb8dcea1185635b383b7dc8f7a33a03f55 100644 (file)
@@ -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, ""},