mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
docs(xml): code escaping for XMLDocs generation (#5703)
This commit is contained in:
parent
23b035b052
commit
ad27f3bf02
@ -60,7 +60,7 @@ function _innerRenderNodes(nodes, maxColumns = 80, wrapParagraphs = true) {
|
|||||||
else
|
else
|
||||||
summary.push(..._wrapAndEscape(node, maxColumns));
|
summary.push(..._wrapAndEscape(node, maxColumns));
|
||||||
} else if (node.type === 'code' && node.codeLang === 'csharp') {
|
} else if (node.type === 'code' && node.codeLang === 'csharp') {
|
||||||
_wrapInNode('code', node.lines, summary);
|
_wrapInNode('code', _wrapCode(node.lines), summary);
|
||||||
} else if (node.type === 'li') {
|
} else if (node.type === 'li') {
|
||||||
_wrapInNode('item><description', _wrapAndEscape(node, maxColumns), summary, '/description></item');
|
_wrapInNode('item><description', _wrapAndEscape(node, maxColumns), summary, '/description></item');
|
||||||
} else if (node.type === 'note') {
|
} else if (node.type === 'note') {
|
||||||
@ -73,6 +73,19 @@ function _innerRenderNodes(nodes, maxColumns = 80, wrapParagraphs = true) {
|
|||||||
return { summary, remarks };
|
return { summary, remarks };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _wrapCode(lines) {
|
||||||
|
let i = 0;
|
||||||
|
let out = [];
|
||||||
|
for (let line of lines) {
|
||||||
|
line = line.replace('<', '<').replace('>', '>');
|
||||||
|
if (i < lines.length - 1)
|
||||||
|
line = line + "<br/>";
|
||||||
|
out.push(line);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
function _wrapInNode(tag, nodes, target, closingTag = null) {
|
function _wrapInNode(tag, nodes, target, closingTag = null) {
|
||||||
if (nodes.length === 0)
|
if (nodes.length === 0)
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user