Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
fix(core/inlines): allow quotes in inline var's types (for enums) (sp…
Browse files Browse the repository at this point in the history
  • Loading branch information
sidvishnoi committed Apr 12, 2024
1 parent dfab903 commit ba1f9cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/inlines.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const l10n = getIntlData(localizationStrings);
// add support.
const inlineCodeRegExp = /(?:`[^`]+`)(?!`)/; // `code`
const inlineIdlReference = /(?:{{[^}]+\?*}})/; // {{ WebIDLThing }}, {{ WebIDLThing? }}
const inlineVariable = /\B\|\w[\w\s]*(?:\s*:[\w\s&;<>]+\??)?\|\B/; // |var : Type?|
const inlineVariable = /\B\|\w[\w\s]*(?:\s*:[\w\s&;"<>]+\??)?\|\B/; // |var : Type?|
const inlineCitation = /(?:\[\[(?:!|\\|\?)?[\w.-]+(?:|[^\]]+)?\]\])/; // [[citation]]
const inlineExpansion = /(?:\[\[\[(?:!|\\|\?)?#?[\w-.]+\]\]\])/; // [[[expand]]]
const inlineAnchor = /(?:\[=[^=]+=\])/; // Inline [= For/link =]
Expand Down
5 changes: 5 additions & 0 deletions tests/spec/core/inlines-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ describe("Core - Inlines", () => {
</section>
<section>
<p id="a4">TEXT |with spaces : Type with spaces| TEXT</p>
<p id="a5">TEXT |typeWithQuotes: "valid" or "invalid"| TEXT</p>
<p id="b">TEXT |variable| TEXT</p>
<p id="c">TEXT | ignored | TEXT</p>
<p id="d">TEXT|ignore: Ignore|TEXT</p>
Expand Down Expand Up @@ -190,6 +191,10 @@ describe("Core - Inlines", () => {
expect(a4.textContent).toBe("with spaces");
expect(a4.dataset.type).toBe("Type with spaces");

const a5 = doc.querySelector("#a5 var");
expect(a5.textContent).toBe("typeWithQuotes");
expect(a5.dataset.type).toBe(`"valid" or "invalid"`);

const b = doc.querySelector("#b var");
expect(b.textContent).toBe("variable");
expect(b.dataset.type).toBeUndefined();
Expand Down

0 comments on commit ba1f9cd

Please sign in to comment.