Skip to content

Commit

Permalink
fix(/xref:ui): wrap enum values in quotes in "How to cite" (#423)
Browse files Browse the repository at this point in the history
Co-authored-by: Sid Vishnoi <8426945+sidvishnoi@users.noreply.github.com>
  • Loading branch information
tidoust and sidvishnoi committed Jun 19, 2024
1 parent 42efa56 commit a6fa5e0
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions static/xref/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,11 @@ function renderResults(entries, query) {
const cite = metadata.types.idl.has(entry.type)
? howToCiteIDL(term, entry)
: metadata.types.markup.has(entry.type)
? howToCiteMarkup(term, entry)
: metadata.types.css.has(entry.type) || metadata.types.http.has(entry.type)
? howToCiteAnchor(term, entry)
: howToCiteTerm(term, entry);
? howToCiteMarkup(term, entry)
: metadata.types.css.has(entry.type) ||
metadata.types.http.has(entry.type)
? howToCiteAnchor(term, entry)
: howToCiteTerm(term, entry);
let row = `
<tr>
<td><a href="${link}">${title}</a></td>
Expand All @@ -171,7 +172,12 @@ function renderResults(entries, query) {
function howToCiteIDL(term, entry) {
const { type, for: forList } = entry;
if (forList) {
return forList.map(f => `{{${f}/${term ? term : '""'}}}`).join('<br>');
return forList
.map(f => {
const termPart = type === 'enum-value' ? `"${term}"` : term;
return `{{${f}/${term ? termPart : '""'}}}`;
})
.join('<br>');
}
switch (type) {
case 'exception':
Expand Down

0 comments on commit a6fa5e0

Please sign in to comment.