aboutsummaryrefslogtreecommitdiff
path: root/infra/perfetto.dev/src/gen_proto_reference.js
diff options
context:
space:
mode:
Diffstat (limited to 'infra/perfetto.dev/src/gen_proto_reference.js')
-rw-r--r--infra/perfetto.dev/src/gen_proto_reference.js24
1 files changed, 3 insertions, 21 deletions
diff --git a/infra/perfetto.dev/src/gen_proto_reference.js b/infra/perfetto.dev/src/gen_proto_reference.js
index c3d0481b3..044929eb3 100644
--- a/infra/perfetto.dev/src/gen_proto_reference.js
+++ b/infra/perfetto.dev/src/gen_proto_reference.js
@@ -26,30 +26,13 @@ const PROJECT_ROOT =
const visited = {};
-// This function is used to escape:
-// - The message-level comment, which becomes a full paragraph.
-// - The per-field comments, rendered as as table.
-function escapeCommentCommon(comment) {
- comment = comment || '';
-
- // Remove Next id: NN lines.
- comment = comment.replace(/(\n)?^\s*next.*\bid:.*$/img, '');
-
- // Hide our little dirty secrets.
- comment = comment.replace(/(\n)?^\s*TODO\(\w+\):.*$/img, '');
-
- // Turn |variable| references into `variable`.
- comment = comment.replace(/[|](\w+?)[|]/g, '`$1`');
- return comment;
-}
-// This is used to escape only the per-field comments.
// Removes \n due to 80col wrapping and preserves only end-of-sentence line
// breaks.
function singleLineComment(comment) {
- comment = escapeCommentCommon(comment);
+ comment = comment || '';
comment = comment.trim();
- comment = comment.replace(/([.:?!])\n/g, '$1<br>');
+ comment = comment.replace(/\.\n/g, '<br>');
comment = comment.replace(/\n/g, ' ');
return comment;
}
@@ -79,8 +62,7 @@ function genType(pType, depth) {
md += '\n';
const fileName = path.basename(pType.filename);
const relPath = path.relative(PROJECT_ROOT, pType.filename);
-
- md += escapeCommentCommon(pType.comment);
+ md += `${(pType.comment || '').replace(/(\n)?^\s*next.*\bid:.*$/img, '')}`;
md += `\n\nDefined in [${fileName}](/${relPath})\n\n`;
const subTypes = [];