Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
c272fd14
Commit
c272fd14
authored
Aug 13, 2013
by
David Symonds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
go/doc: permit a package synopsis to end with ":\n".
R=gri, r CC=golang-dev
https://golang.org/cl/12822043
parent
f7ab3917
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
src/pkg/go/doc/synopsis.go
src/pkg/go/doc/synopsis.go
+6
-3
src/pkg/go/doc/synopsis_test.go
src/pkg/go/doc/synopsis_test.go
+1
-0
No files found.
src/pkg/go/doc/synopsis.go
View file @
c272fd14
...
@@ -10,12 +10,15 @@ import (
...
@@ -10,12 +10,15 @@ import (
)
)
// firstSentenceLen returns the length of the first sentence in s.
// firstSentenceLen returns the length of the first sentence in s.
// The sentence ends a
fter the first period followed by space and
// The sentence ends a
t the first colon followed by a newline,
//
not preceded by exactly one uppercase letter.
//
or at the first period followed by space and not preceded by
//
//
exactly one uppercase letter.
func
firstSentenceLen
(
s
string
)
int
{
func
firstSentenceLen
(
s
string
)
int
{
var
ppp
,
pp
,
p
rune
var
ppp
,
pp
,
p
rune
for
i
,
q
:=
range
s
{
for
i
,
q
:=
range
s
{
if
p
==
':'
&&
q
==
'\n'
{
return
i
}
if
q
==
'\n'
||
q
==
'\r'
||
q
==
'\t'
{
if
q
==
'\n'
||
q
==
'\r'
||
q
==
'\t'
{
q
=
' '
q
=
' '
}
}
...
...
src/pkg/go/doc/synopsis_test.go
View file @
c272fd14
...
@@ -29,6 +29,7 @@ var tests = []struct {
...
@@ -29,6 +29,7 @@ var tests = []struct {
{
"Package Καλημέρα κόσμε."
,
36
,
"Package Καλημέρα κόσμε."
},
{
"Package Καλημέρα κόσμε."
,
36
,
"Package Καλημέρα κόσμε."
},
{
"Package こんにちは 世界
\n
"
,
31
,
"Package こんにちは 世界"
},
{
"Package こんにちは 世界
\n
"
,
31
,
"Package こんにちは 世界"
},
{
"Package foo does bar."
,
21
,
"Package foo does bar."
},
{
"Package foo does bar."
,
21
,
"Package foo does bar."
},
{
"Package foo does these things:
\n
- a
\n
- b"
,
30
,
"Package foo does these things:"
},
{
"Copyright 2012 Google, Inc. Package foo does bar."
,
27
,
""
},
{
"Copyright 2012 Google, Inc. Package foo does bar."
,
27
,
""
},
{
"All Rights reserved. Package foo does bar."
,
20
,
""
},
{
"All Rights reserved. Package foo does bar."
,
20
,
""
},
{
"All rights reserved. Package foo does bar."
,
20
,
""
},
{
"All rights reserved. Package foo does bar."
,
20
,
""
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment