Skip to content

Commit

Permalink
Fixed: Do not randomly remove slashes from comments, fixes #656
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Jan 24, 2017
1 parent 3317a76 commit 301f776
Show file tree
Hide file tree
Showing 14 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion dist/light/protobuf.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/light/protobuf.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified dist/light/protobuf.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/minimal/protobuf.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/minimal/protobuf.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified dist/minimal/protobuf.min.js.gz
Binary file not shown.
4 changes: 2 additions & 2 deletions dist/protobuf.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/protobuf.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/protobuf.min.js

Large diffs are not rendered by default.

Binary file modified dist/protobuf.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/protobuf.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/tokenize.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function tokenize(source) {
.substring(start, end)
.split(/\n/g);
for (var i = 0; i < lines.length; ++i)
lines[i] = lines[i].replace(/ *[*/]+ */, "").trim();
lines[i] = lines[i].replace(/^ *[*/]+ */, "").trim();
commentText = lines
.join("\n")
.trim();
Expand Down
2 changes: 1 addition & 1 deletion tests/data/comments.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ message Test1 {
// Field with no comment.
uint32 field2 = 2;

bool field3 = 3; /// Field with a comment.
bool field3 = 3; /// Field with a comment and a <a href="http://example.com/foo/">link</a>
}

// Message
Expand Down
2 changes: 1 addition & 1 deletion tests/docs_comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ tape.test("proto comments", function(test) {

test.equal(root.lookup("Test1.field1").comment, "Field with a comment.", "should parse blocks for message fields");
test.equal(root.lookup("Test1.field2").comment, null, "should not parse lines for message fields");
test.equal(root.lookup("Test1.field3").comment, "Field with a comment.", "should parse triple-slash lines for message fields");
test.equal(root.lookup("Test1.field3").comment, "Field with a comment and a <a href=\"http://example.com/foo/\">link</a>", "should parse triple-slash lines for message fields");

test.equal(root.lookup("Test3").comments.ONE, "Value with a comment.", "should parse blocks for enum values");
test.equal(root.lookup("Test3").comments.TWO, null, "should not parse lines for enum values");
Expand Down

0 comments on commit 301f776

Please sign in to comment.