diff --git a/@types/webref.d.ts b/@types/webref.d.ts index 81657f8..20ec619 100644 --- a/@types/webref.d.ts +++ b/@types/webref.d.ts @@ -18,6 +18,7 @@ declare module "webref" { informative: boolean; heading: Record; definedIn: string; + htmlProse: string; } interface SpecVersion { diff --git a/routes/xref/lib/scraper.ts b/routes/xref/lib/scraper.ts index 0fc75a0..755a640 100644 --- a/routes/xref/lib/scraper.ts +++ b/routes/xref/lib/scraper.ts @@ -146,6 +146,7 @@ function mapDefinition( uri: dfn.href.replace(spec.url, ""), // This is full URL to term here normative: !dfn.informative, for: dfn.for.length > 0 ? dfn.for : undefined, + htmlProse: dfn.htmlProse, }; } diff --git a/routes/xref/lib/search.ts b/routes/xref/lib/search.ts index 8b35468..27b0084 100644 --- a/routes/xref/lib/search.ts +++ b/routes/xref/lib/search.ts @@ -26,6 +26,7 @@ export interface DataEntry { uri: string; normative: boolean; for?: string[]; + htmlProse?: string; } type SpecType = DataEntry["status"] | "draft" | "official"; @@ -58,7 +59,7 @@ const specStatusAlias = new Map([ ]); export const defaultOptions: Options = { - fields: ["shortname", "spec", "type", "for", "normative", "uri"], + fields: ["shortname", "spec", "type", "for", "normative", "uri", "htmlProse"], spec_type: ["draft", "official"], types: [], }; diff --git a/tests/routes/xref/lib/data-by-term.js b/tests/routes/xref/lib/data-by-term.js index 21d14b4..4f68756 100644 --- a/tests/routes/xref/lib/data-by-term.js +++ b/tests/routes/xref/lib/data-by-term.js @@ -41,6 +41,8 @@ export default { shortname: "font-metrics-api", status: "current", uri: "#baseline", + normative: true, + htmlProse: "test html Prose", }, ], baseline: [ diff --git a/tests/routes/xref/lib/search.test.js b/tests/routes/xref/lib/search.test.js index ea241f5..87e91ca 100644 --- a/tests/routes/xref/lib/search.test.js +++ b/tests/routes/xref/lib/search.test.js @@ -60,6 +60,9 @@ describe("xref - search", () => { spec: "font-metrics-api-1", type: "interface", uri: "#baseline", + normative: true, + htmlProse: "test html Prose", + for: undefined, }, ]); }); diff --git a/tests/routes/xref/lib/utils.test.js b/tests/routes/xref/lib/utils.test.js index 6d28e13..6913a7d 100644 --- a/tests/routes/xref/lib/utils.test.js +++ b/tests/routes/xref/lib/utils.test.js @@ -24,7 +24,8 @@ describe("xref - utils", () => { }); expect(utils.pickFields(object, ["foo", "nope", "bar"])).toEqual({ foo: object.foo, - bar: object.foo, + bar: object.bar, + nope: undefined, }); expect(utils.pickFields(object, ["bar"]).bar).toBe(object.bar); });