Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
f4f601bd
Commit
f4f601bd
authored
Nov 06, 2015
by
Jon Skeet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stop removing all blank lines in doc comments.
This fixes issue #832. Generated code changes in next commit.
parent
ffe25c76
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
csharp_doc_comment.cc
src/google/protobuf/compiler/csharp/csharp_doc_comment.cc
+18
-2
No files found.
src/google/protobuf/compiler/csharp/csharp_doc_comment.cc
View file @
f4f601bd
...
...
@@ -56,10 +56,26 @@ void WriteDocCommentBodyImpl(io::Printer* printer, SourceLocation location) {
// node of a summary element, not part of an attribute.
comments
=
StringReplace
(
comments
,
"&"
,
"&"
,
true
);
comments
=
StringReplace
(
comments
,
"<"
,
"<"
,
true
);
vector
<
string
>
lines
=
Split
(
comments
,
"
\n
"
);
vector
<
string
>
lines
=
Split
(
comments
,
"
\n
"
,
false
/* skip_empty */
);
// TODO: We really should work out which part to put in the summary and which to put in the remarks...
// but that needs to be part of a bigger effort to understand the markdown better anyway.
printer
->
Print
(
"/// <summary>
\n
"
);
bool
last_was_empty
=
false
;
// We squash multiple blank lines down to one, and remove any trailing blank lines. We need
// to preserve the blank lines themselves, as this is relevant in the markdown.
// Note that we can't remove leading or trailing whitespace as *that's* relevant in markdown too.
// (We don't skip "just whitespace" lines, either.)
for
(
std
::
vector
<
string
>::
iterator
it
=
lines
.
begin
();
it
!=
lines
.
end
();
++
it
)
{
printer
->
Print
(
"/// $line$
\n
"
,
"line"
,
*
it
);
string
line
=
*
it
;
if
(
line
.
empty
())
{
last_was_empty
=
true
;
}
else
{
if
(
last_was_empty
)
{
printer
->
Print
(
"///
\n
"
);
}
last_was_empty
=
false
;
printer
->
Print
(
"/// $line$
\n
"
,
"line"
,
*
it
);
}
}
printer
->
Print
(
"/// </summary>
\n
"
);
}
...
...
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