Skip to content

Commit 954a963

Browse files
cuishuangheschi
authored andcommitted
unicode: add available godoc link
Change-Id: I2273274249f05b0492950c27dc5a654422cefc79 Reviewed-on: https://go-review.googlesource.com/c/go/+/539856 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org> Run-TryBot: shuang cui <imcusg@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Heschi Kreinick <heschi@google.com>
1 parent 9341046 commit 954a963

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

src/unicode/graphic.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ var PrintRanges = []*RangeTable{
3232

3333
// IsGraphic reports whether the rune is defined as a Graphic by Unicode.
3434
// Such characters include letters, marks, numbers, punctuation, symbols, and
35-
// spaces, from categories L, M, N, P, S, Zs.
35+
// spaces, from categories [L], [M], [N], [P], [S], [Zs].
3636
func IsGraphic(r rune) bool {
3737
// We convert to uint32 to avoid the extra test for negative,
3838
// and in the index we convert to uint8 to avoid the range check.
@@ -44,8 +44,8 @@ func IsGraphic(r rune) bool {
4444

4545
// IsPrint reports whether the rune is defined as printable by Go. Such
4646
// characters include letters, marks, numbers, punctuation, symbols, and the
47-
// ASCII space character, from categories L, M, N, P, S and the ASCII space
48-
// character. This categorization is the same as IsGraphic except that the
47+
// ASCII space character, from categories [L], [M], [N], [P], [S] and the ASCII space
48+
// character. This categorization is the same as [IsGraphic] except that the
4949
// only spacing character is ASCII space, U+0020.
5050
func IsPrint(r rune) bool {
5151
if uint32(r) <= MaxLatin1 {
@@ -76,8 +76,8 @@ func In(r rune, ranges ...*RangeTable) bool {
7676
}
7777

7878
// IsControl reports whether the rune is a control character.
79-
// The C (Other) Unicode category includes more code points
80-
// such as surrogates; use Is(C, r) to test for them.
79+
// The [C] ([Other]) Unicode category includes more code points
80+
// such as surrogates; use [Is](C, r) to test for them.
8181
func IsControl(r rune) bool {
8282
if uint32(r) <= MaxLatin1 {
8383
return properties[uint8(r)]&pC != 0
@@ -86,21 +86,21 @@ func IsControl(r rune) bool {
8686
return false
8787
}
8888

89-
// IsLetter reports whether the rune is a letter (category L).
89+
// IsLetter reports whether the rune is a letter (category [L]).
9090
func IsLetter(r rune) bool {
9191
if uint32(r) <= MaxLatin1 {
9292
return properties[uint8(r)]&(pLmask) != 0
9393
}
9494
return isExcludingLatin(Letter, r)
9595
}
9696

97-
// IsMark reports whether the rune is a mark character (category M).
97+
// IsMark reports whether the rune is a mark character (category [M]).
9898
func IsMark(r rune) bool {
9999
// There are no mark characters in Latin-1.
100100
return isExcludingLatin(Mark, r)
101101
}
102102

103-
// IsNumber reports whether the rune is a number (category N).
103+
// IsNumber reports whether the rune is a number (category [N]).
104104
func IsNumber(r rune) bool {
105105
if uint32(r) <= MaxLatin1 {
106106
return properties[uint8(r)]&pN != 0
@@ -109,7 +109,7 @@ func IsNumber(r rune) bool {
109109
}
110110

111111
// IsPunct reports whether the rune is a Unicode punctuation character
112-
// (category P).
112+
// (category [P]).
113113
func IsPunct(r rune) bool {
114114
if uint32(r) <= MaxLatin1 {
115115
return properties[uint8(r)]&pP != 0
@@ -124,7 +124,7 @@ func IsPunct(r rune) bool {
124124
// '\t', '\n', '\v', '\f', '\r', ' ', U+0085 (NEL), U+00A0 (NBSP).
125125
//
126126
// Other definitions of spacing characters are set by category
127-
// Z and property Pattern_White_Space.
127+
// Z and property [Pattern_White_Space].
128128
func IsSpace(r rune) bool {
129129
// This property isn't the same as Z; special-case it.
130130
if uint32(r) <= MaxLatin1 {

src/unicode/letter.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ const (
7676

7777
type d [MaxCase]rune // to make the CaseRanges text shorter
7878

79-
// If the Delta field of a CaseRange is UpperLower, it means
79+
// If the Delta field of a [CaseRange] is UpperLower, it means
8080
// this CaseRange represents a sequence of the form (say)
81-
// Upper Lower Upper Lower.
81+
// [Upper] [Lower] [Upper] [Lower].
8282
const (
8383
UpperLower = MaxRune + 1 // (Cannot be a valid delta.)
8484
)
@@ -244,7 +244,7 @@ func to(_case int, r rune, caseRange []CaseRange) (mappedRune rune, foundMapping
244244
return r, false
245245
}
246246

247-
// To maps the rune to the specified case: UpperCase, LowerCase, or TitleCase.
247+
// To maps the rune to the specified case: [UpperCase], [LowerCase], or [TitleCase].
248248
func To(_case int, r rune) rune {
249249
r, _ = to(_case, r, CaseRanges)
250250
return r

src/unicode/utf8/utf8.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func FullRuneInString(s string) bool {
141141
}
142142

143143
// DecodeRune unpacks the first UTF-8 encoding in p and returns the rune and
144-
// its width in bytes. If p is empty it returns (RuneError, 0). Otherwise, if
144+
// its width in bytes. If p is empty it returns ([RuneError], 0). Otherwise, if
145145
// the encoding is invalid, it returns (RuneError, 1). Both are impossible
146146
// results for correct, non-empty UTF-8.
147147
//
@@ -188,8 +188,8 @@ func DecodeRune(p []byte) (r rune, size int) {
188188
return rune(p0&mask4)<<18 | rune(b1&maskx)<<12 | rune(b2&maskx)<<6 | rune(b3&maskx), 4
189189
}
190190

191-
// DecodeRuneInString is like DecodeRune but its input is a string. If s is
192-
// empty it returns (RuneError, 0). Otherwise, if the encoding is invalid, it
191+
// DecodeRuneInString is like [DecodeRune] but its input is a string. If s is
192+
// empty it returns ([RuneError], 0). Otherwise, if the encoding is invalid, it
193193
// returns (RuneError, 1). Both are impossible results for correct, non-empty
194194
// UTF-8.
195195
//
@@ -237,7 +237,7 @@ func DecodeRuneInString(s string) (r rune, size int) {
237237
}
238238

239239
// DecodeLastRune unpacks the last UTF-8 encoding in p and returns the rune and
240-
// its width in bytes. If p is empty it returns (RuneError, 0). Otherwise, if
240+
// its width in bytes. If p is empty it returns ([RuneError], 0). Otherwise, if
241241
// the encoding is invalid, it returns (RuneError, 1). Both are impossible
242242
// results for correct, non-empty UTF-8.
243243
//
@@ -276,8 +276,8 @@ func DecodeLastRune(p []byte) (r rune, size int) {
276276
return r, size
277277
}
278278

279-
// DecodeLastRuneInString is like DecodeLastRune but its input is a string. If
280-
// s is empty it returns (RuneError, 0). Otherwise, if the encoding is invalid,
279+
// DecodeLastRuneInString is like [DecodeLastRune] but its input is a string. If
280+
// s is empty it returns ([RuneError], 0). Otherwise, if the encoding is invalid,
281281
// it returns (RuneError, 1). Both are impossible results for correct,
282282
// non-empty UTF-8.
283283
//
@@ -337,7 +337,7 @@ func RuneLen(r rune) int {
337337
}
338338

339339
// EncodeRune writes into p (which must be large enough) the UTF-8 encoding of the rune.
340-
// If the rune is out of range, it writes the encoding of RuneError.
340+
// If the rune is out of range, it writes the encoding of [RuneError].
341341
// It returns the number of bytes written.
342342
func EncodeRune(p []byte, r rune) int {
343343
// Negative values are erroneous. Making it unsigned addresses the problem.
@@ -371,7 +371,7 @@ func EncodeRune(p []byte, r rune) int {
371371

372372
// AppendRune appends the UTF-8 encoding of r to the end of p and
373373
// returns the extended buffer. If the rune is out of range,
374-
// it appends the encoding of RuneError.
374+
// it appends the encoding of [RuneError].
375375
func AppendRune(p []byte, r rune) []byte {
376376
// This function is inlineable for fast handling of ASCII.
377377
if uint32(r) <= rune1Max {
@@ -433,7 +433,7 @@ func RuneCount(p []byte) int {
433433
return n
434434
}
435435

436-
// RuneCountInString is like RuneCount but its input is a string.
436+
// RuneCountInString is like [RuneCount] but its input is a string.
437437
func RuneCountInString(s string) (n int) {
438438
ns := len(s)
439439
for i := 0; i < ns; n++ {

0 commit comments

Comments
 (0)