Skip to content

Commit 0469a25

Browse files
authored
fix(portal): ignore prose in snip Seen-on values (#101)
1 parent e242a9b commit 0469a25

2 files changed

Lines changed: 143 additions & 594 deletions

File tree

portal/scripts/generate-snips.mjs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,19 @@ function parseSnip(text) {
153153
const so = trimmed.match(/^(Junos|EVO)\s*:\s*(.*)$/i);
154154
if (so) {
155155
const bucket = so[1].toLowerCase() === "evo" ? "evo" : "junos";
156-
for (const tok of so[2].split(/\s+/).filter(Boolean)) seenOn[bucket].push(tok);
156+
// Stop at the first token that begins a parenthetical note like
157+
// "(none in this JVD ...)" or "(and all other EVO PEs ...)". Only
158+
// tokens before the note are real device names. Authors sometimes
159+
// use these notes to indicate "no devices on this OS" or
160+
// "+ implicit others"; either way the prose should not become chips.
161+
// Also skip bare prose tokens like "—" used as a placeholder for
162+
// "not applicable".
163+
for (const tok of so[2].split(/\s+/).filter(Boolean)) {
164+
if (tok.startsWith("(")) break;
165+
// A real device token must start with a letter or digit.
166+
if (!/^[A-Za-z0-9]/.test(tok)) continue;
167+
seenOn[bucket].push(tok);
168+
}
157169
}
158170
continue;
159171
}

0 commit comments

Comments
 (0)