From 9f31dd13ced59b5c4f0ddfbe66cae9f1c7b6ee4c Mon Sep 17 00:00:00 2001 From: Florian Scholz Date: Tue, 27 Apr 2021 15:19:49 +0200 Subject: [PATCH] Rename SpecificationTable to SpecificationSection/Specifications --- build/document-extractor.js | 4 ++-- client/src/document/index.tsx | 4 ++-- client/src/document/{spec-table.tsx => spec-section.tsx} | 5 ++++- .../macros/{SpecificationTable.ejs => Specifications.ejs} | 4 ++-- .../{SpecificationTable.test.js => Specifications.test.js} | 2 +- .../index.html | 6 +++--- testing/tests/index.test.js | 4 ++-- 7 files changed, 16 insertions(+), 13 deletions(-) rename client/src/document/{spec-table.tsx => spec-section.tsx} (90%) rename kumascript/macros/{SpecificationTable.ejs => Specifications.ejs} (88%) rename kumascript/tests/macros/{SpecificationTable.test.js => Specifications.test.js} (93%) rename testing/content/files/en-us/web/{spec_table_extraction => spec_section_extraction}/index.html (75%) diff --git a/build/document-extractor.js b/build/document-extractor.js index a28b8bbb9f1e..06084aa704b6 100644 --- a/build/document-extractor.js +++ b/build/document-extractor.js @@ -111,7 +111,7 @@ function extractSections($) { * data: {....} * }] * - * Another example is for specification tables. If the input is this: + * Another example is for the specification section. If the input is this: * *

Specifications

*
...
@@ -124,7 +124,7 @@ function extractSections($) { * query: "foo.bar.thing", * id: "specifications", * title: "Specifications", - * specURLs: {....} + * specifications: {....} * }] */ function addSections($) { diff --git a/client/src/document/index.tsx b/client/src/document/index.tsx index bd348276f9e9..c0e540780a94 100644 --- a/client/src/document/index.tsx +++ b/client/src/document/index.tsx @@ -9,7 +9,7 @@ import { Doc } from "./types"; // Ingredients import { Prose, ProseWithHeading } from "./ingredients/prose"; import { LazyBrowserCompatibilityTable } from "./lazy-bcd-table"; -import { SpecificationTable } from "./spec-table"; +import { SpecificationSection } from "./spec-section"; // Misc // Sub-components @@ -235,7 +235,7 @@ function RenderDocumentBody({ doc }) { ); } else if (section.type === "specifications") { return ( - + ); } else { console.warn(section); diff --git a/client/src/document/spec-table.tsx b/client/src/document/spec-section.tsx similarity index 90% rename from client/src/document/spec-table.tsx rename to client/src/document/spec-section.tsx index 353cad864187..5c8c83727a0d 100644 --- a/client/src/document/spec-table.tsx +++ b/client/src/document/spec-section.tsx @@ -1,6 +1,6 @@ import { DisplayH2, DisplayH3 } from "./ingredients/utils"; -export function SpecificationTable({ +export function SpecificationSection({ id, title, isH3, @@ -38,6 +38,8 @@ export function SpecificationTable({ {spec.title} ({spec.shortTitle}) +
{" "} + #{spec.bcdSpecificationURL.split("#")[1]}
@@ -46,6 +48,7 @@ export function SpecificationTable({ ) : (
+

No specification found

No specification data found for {query}.
Check for problems with this page or diff --git a/kumascript/macros/SpecificationTable.ejs b/kumascript/macros/Specifications.ejs similarity index 88% rename from kumascript/macros/SpecificationTable.ejs rename to kumascript/macros/Specifications.ejs index db814031924b..149ae710502f 100644 --- a/kumascript/macros/SpecificationTable.ejs +++ b/kumascript/macros/Specifications.ejs @@ -8,8 +8,8 @@ $0 – A query string indicating for which feature to retrieve specification URL Example calls -{{SpecificationTable}} -{{SpecificationTable("html.element.abbr")}} +{{Specifications}} +{{Specifications("html.element.abbr")}} */ diff --git a/kumascript/tests/macros/SpecificationTable.test.js b/kumascript/tests/macros/Specifications.test.js similarity index 93% rename from kumascript/tests/macros/SpecificationTable.test.js rename to kumascript/tests/macros/Specifications.test.js index d88929c8ecc4..ffff3ed11f6b 100644 --- a/kumascript/tests/macros/SpecificationTable.test.js +++ b/kumascript/tests/macros/Specifications.test.js @@ -3,7 +3,7 @@ const { assert, itMacro, describeMacro, lintHTML } = require("./utils"); const jsdom = require("jsdom"); const { JSDOM } = jsdom; -describeMacro("SpecificationTable", function () { +describeMacro("Specifications", function () { itMacro("Outputs a simple div tag", async (macro) => { const result = await macro.call("api.feature"); const dom = JSDOM.fragment(result); diff --git a/testing/content/files/en-us/web/spec_table_extraction/index.html b/testing/content/files/en-us/web/spec_section_extraction/index.html similarity index 75% rename from testing/content/files/en-us/web/spec_table_extraction/index.html rename to testing/content/files/en-us/web/spec_section_extraction/index.html index b25d06def344..927474afb5ad 100644 --- a/testing/content/files/en-us/web/spec_table_extraction/index.html +++ b/testing/content/files/en-us/web/spec_section_extraction/index.html @@ -1,7 +1,7 @@ --- -title: Spec table extraction +title: Spec section extraction browser-compat: javascript.builtins.Array.toLocaleString -slug: Web/Spec_Table_Extraction +slug: Web/Spec_Section_Extraction ---

Intro

@@ -9,7 +9,7 @@

Intro

Specifications

-

{{SpecificationTable}}

+

{{Specifications}}

Browser compatibility

diff --git a/testing/tests/index.test.js b/testing/tests/index.test.js index 428f7bad74dd..71e637304858 100644 --- a/testing/tests/index.test.js +++ b/testing/tests/index.test.js @@ -1019,13 +1019,13 @@ test("bcd table extraction followed by h3", () => { expect(doc.body[4].value.isH3).toBeTruthy(); }); -test("specification table and bcd extraction", () => { +test("specifications and bcd extraction", () => { const builtFolder = path.join( buildRoot, "en-us", "docs", "web", - "spec_table_extraction" + "spec_section_extraction" ); expect(fs.existsSync(builtFolder)).toBeTruthy(); const jsonFile = path.join(builtFolder, "index.json");