Skip to content

Commit

Permalink
Rename SpecificationTable to SpecificationSection/Specifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Elchi3 committed Apr 27, 2021
1 parent 4193f3b commit 9f31dd1
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 13 deletions.
4 changes: 2 additions & 2 deletions build/document-extractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:
*
* <h2 id="Specifications">Specifications</h2>
* <div class="bc-specs" data-bcd-query="foo.bar.thing">...</div>
Expand All @@ -124,7 +124,7 @@ function extractSections($) {
* query: "foo.bar.thing",
* id: "specifications",
* title: "Specifications",
* specURLs: {....}
* specifications: {....}
* }]
*/
function addSections($) {
Expand Down
4 changes: 2 additions & 2 deletions client/src/document/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -235,7 +235,7 @@ function RenderDocumentBody({ doc }) {
);
} else if (section.type === "specifications") {
return (
<SpecificationTable key={`specifications${i}`} {...section.value} />
<SpecificationSection key={`specifications${i}`} {...section.value} />
);
} else {
console.warn(section);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DisplayH2, DisplayH3 } from "./ingredients/utils";

export function SpecificationTable({
export function SpecificationSection({
id,
title,
isH3,
Expand Down Expand Up @@ -38,6 +38,8 @@ export function SpecificationTable({
<td>
<a href={spec.bcdSpecificationURL}>
{spec.title} ({spec.shortTitle})
<br />{" "}
<small>#{spec.bcdSpecificationURL.split("#")[1]}</small>
</a>
</td>
</tr>
Expand All @@ -46,6 +48,7 @@ export function SpecificationTable({
</table>
) : (
<div className="notecard warning">
<h4>No specification found</h4>
<p>
No specification data found for <code>{query}</code>.<br />
<a href="#on-github">Check for problems with this page</a> or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")}}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
title: Spec table extraction
title: Spec section extraction
browser-compat: javascript.builtins.Array.toLocaleString
slug: Web/Spec_Table_Extraction
slug: Web/Spec_Section_Extraction
---

<h2>Intro</h2>
<p>Text in Intro</p>

<h2 id="Specifications">Specifications</h2>

<p>{{SpecificationTable}}</p>
<p>{{Specifications}}</p>

<h2 id="Browser_compatibility">Browser compatibility</h2>

Expand Down
4 changes: 2 additions & 2 deletions testing/tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 9f31dd1

Please sign in to comment.