Permalink
Browse files

Fixed: Do not randomly remove slashes from comments, fixes #656

  • Loading branch information...
dcodeIO committed Jan 24, 2017
1 parent 3317a76 commit 301f7762ef724229cd1df51e496eed8cfd2f10eb

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
BIN -1 Byte (100%) dist/light/protobuf.min.js.gz
Binary file not shown.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
BIN +0 Bytes (100%) dist/minimal/protobuf.min.js.gz
Binary file not shown.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
BIN +1 Byte (100%) dist/protobuf.min.js.gz
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -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();
@@ -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
@@ -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");

0 comments on commit 301f776

Please sign in to comment.