Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
0b133d8a
Commit
0b133d8a
authored
Jul 27, 2010
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
godoc: accept '.', '!', and '?' as end of first sentence of package documentation
R=rsc CC=golang-dev
https://golang.org/cl/1875049
parent
f20c2e1c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
godoc.go
src/cmd/godoc/godoc.go
+7
-7
No files found.
src/cmd/godoc/godoc.go
View file @
0b133d8a
...
...
@@ -152,18 +152,18 @@ func htmlEscape(s string) string {
func
firstSentence
(
s
string
)
string
{
i
:=
-
1
// index+1 of first
period
j
:=
-
1
// index+1 of first
period that is
followed by white space
i
:=
-
1
// index+1 of first
terminator (punctuation ending a sentence)
j
:=
-
1
// index+1 of first
terminator
followed by white space
prev
:=
'A'
for
k
,
ch
:=
range
s
{
k1
:=
k
+
1
if
ch
==
'.'
{
if
ch
==
'.'
||
ch
==
'!'
||
ch
==
'?'
{
if
i
<
0
{
i
=
k1
// first
period
i
=
k1
// first
terminator
}
if
k1
<
len
(
s
)
&&
s
[
k1
]
<=
' '
{
if
j
<
0
{
j
=
k1
// first
period
followed by white space
j
=
k1
// first
terminator
followed by white space
}
if
!
unicode
.
IsUpper
(
prev
)
{
j
=
k1
...
...
@@ -175,10 +175,10 @@ func firstSentence(s string) string {
}
if
j
<
0
{
// use the next best
period
// use the next best
terminator
j
=
i
if
j
<
0
{
// no
period
at all, use the entire string
// no
terminator
at all, use the entire string
j
=
len
(
s
)
}
}
...
...
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