Skip to content

Commit

Permalink
Address some feedback, mostly rename things
Browse files Browse the repository at this point in the history
  • Loading branch information
Elchi3 committed Apr 16, 2021
1 parent 7c38a6e commit a30d53a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
14 changes: 6 additions & 8 deletions build/document-extractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,13 @@ function extractSections($) {
* query: "foo.bar.thing",
* id: "specifications",
* title: "Specifications",
* spec_urls: {....}
* specURLs: {....}
* }]
*/
function addSections($) {
const flaws = [];

const countPotentialSpecialDivs =
$.find("div.bc-data").length + $.find("div.bc-specs").length;
const countPotentialSpecialDivs = $.find("div.bc-data, div.bc-specs").length;
if (countPotentialSpecialDivs) {
/** If there's exactly 1 special table the only section to add is something
* like this:
Expand Down Expand Up @@ -376,7 +375,7 @@ function _addSingleSpecialSection($) {
},
];
} else if (specialSectionType === "specifications") {
let spec_urls = [];
let specURLs = [];

for (const [key, compat] of Object.entries(data)) {
let block;
Expand All @@ -387,9 +386,9 @@ function _addSingleSpecialSection($) {
}
if (block && block.spec_url) {
if (Array.isArray(block.spec_url)) {
spec_urls = block.spec_url;
specURLs = block.spec_url;
} else {
spec_urls.push(block.spec_url);
specURLs.push(block.spec_url);
}
}
}
Expand All @@ -401,8 +400,7 @@ function _addSingleSpecialSection($) {
title,
id,
isH3,
spec_urls,
query,
specURLs,
},
},
];
Expand Down
8 changes: 3 additions & 5 deletions client/src/document/spec-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ export function SpecificationTable({
id,
title,
isH3,
spec_urls,
query,
specURLs,
}: {
id: string;
title: string;
isH3: boolean;
spec_urls: [];
query: string;
specURLs: string[];
}) {
return (
<>
Expand All @@ -24,7 +22,7 @@ export function SpecificationTable({
</tr>
</thead>
<tr>
<td>{spec_urls}</td>
<td>{specURLs}</td>
</tr>
</table>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ Example calls
*/
var query = $0 || env['browser-compat'];
if (!query) {
throw new Error("No first query argument or 'browser-compat' front-matter value passed");
}
var output = `<div class="bc-specs" data-bcd-query="${query}"></div>`;
%>

Expand Down

0 comments on commit a30d53a

Please sign in to comment.