| OLD | NEW |
| 1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
| 2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
| 3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
| 4 // | 4 // |
| 5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
| 6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
| 7 // met: | 7 // met: |
| 8 // | 8 // |
| 9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
| 10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 location.trailing_comments : location.leading_comments; | 108 location.trailing_comments : location.leading_comments; |
| 109 if (!comments.empty()) { | 109 if (!comments.empty()) { |
| 110 // TODO(kenton): Ideally we should parse the comment text as Markdown and | 110 // TODO(kenton): Ideally we should parse the comment text as Markdown and |
| 111 // write it back as HTML, but this requires a Markdown parser. For now | 111 // write it back as HTML, but this requires a Markdown parser. For now |
| 112 // we just use <pre> to get fixed-width text formatting. | 112 // we just use <pre> to get fixed-width text formatting. |
| 113 | 113 |
| 114 // If the comment itself contains block comment start or end markers, | 114 // If the comment itself contains block comment start or end markers, |
| 115 // HTML-escape them so that they don't accidentally close the doc comment. | 115 // HTML-escape them so that they don't accidentally close the doc comment. |
| 116 comments = EscapeJavadoc(comments); | 116 comments = EscapeJavadoc(comments); |
| 117 | 117 |
| 118 std::vector<string> lines = Split(comments, "\n"); | 118 vector<string> lines = Split(comments, "\n"); |
| 119 while (!lines.empty() && lines.back().empty()) { | 119 while (!lines.empty() && lines.back().empty()) { |
| 120 lines.pop_back(); | 120 lines.pop_back(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 printer->Print(" * <pre>\n"); | 123 printer->Print(" * <pre>\n"); |
| 124 for (int i = 0; i < lines.size(); i++) { | 124 for (int i = 0; i < lines.size(); i++) { |
| 125 // Most lines should start with a space. Watch out for lines that start | 125 // Most lines should start with a space. Watch out for lines that start |
| 126 // with a /, since putting that right after the leading asterisk will | 126 // with a /, since putting that right after the leading asterisk will |
| 127 // close the comment. | 127 // close the comment. |
| 128 if (!lines[i].empty() && lines[i][0] == '/') { | 128 if (!lines[i].empty() && lines[i][0] == '/') { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 printer->Print( | 224 printer->Print( |
| 225 " * <code>$def$</code>\n" | 225 " * <code>$def$</code>\n" |
| 226 " */\n", | 226 " */\n", |
| 227 "def", EscapeJavadoc(FirstLineOf(method->DebugString()))); | 227 "def", EscapeJavadoc(FirstLineOf(method->DebugString()))); |
| 228 } | 228 } |
| 229 | 229 |
| 230 } // namespace java | 230 } // namespace java |
| 231 } // namespace compiler | 231 } // namespace compiler |
| 232 } // namespace protobuf | 232 } // namespace protobuf |
| 233 } // namespace google | 233 } // namespace google |
| OLD | NEW |