diff --git a/docs/gatsby-config.js b/docs/gatsby-config.js
index 98cfc30ad..83e6d679c 100644
--- a/docs/gatsby-config.js
+++ b/docs/gatsby-config.js
@@ -48,6 +48,13 @@ module.exports = {
path: `${__dirname}/../jacdac-spec/dist/services.json`,
},
},
+ {
+ resolve: `gatsby-source-filesystem`,
+ options: {
+ name: `serviceSources`,
+ path: `${__dirname}/../jacdac-spec/dist/services-sources.json`,
+ },
+ },
{
resolve: `gatsby-source-filesystem`,
options: {
diff --git a/docs/gatsby-node.js b/docs/gatsby-node.js
index 96f7296fc..0c954175c 100644
--- a/docs/gatsby-node.js
+++ b/docs/gatsby-node.js
@@ -9,16 +9,22 @@ const { IgnorePlugin } = require('webpack')
async function createServicePages(graphql, actions, reporter) {
const { createPage, createRedirect } = actions
const result = await graphql(`
-{
- allServicesJson {
- nodes {
- name
- shortName
- shortId
- classIdentifier
+ {
+ allServicesJson {
+ nodes {
+ name
+ shortName
+ shortId
+ classIdentifier
+ }
+ }
+ allServicesSourcesJson {
+ nodes {
+ source
+ classIdentifier
+ }
}
}
-}
`)
if (result.errors) {
@@ -34,16 +40,21 @@ async function createServicePages(graphql, actions, reporter) {
// Instagram post. Since the scraped Instagram data
// already includes an ID field, we just use that for
// each page's path.
- result.data.allServicesJson.nodes.forEach(node => {
- const p = `/services/${node.shortId}/`;
+ result.data.allServicesJson.nodes.map((node) => {
+ const { classIdentifier, shortId } = node;
+ const p = `/services/${shortId}/`;
const pplay = `${p}playground/`
const ptest = `${p}test/`
- const r = `/services/0x${node.classIdentifier.toString(16)}`
+ const r = `/services/0x${classIdentifier.toString(16)}`
+
+ const source = result.data.allServicesSourcesJson.nodes.find(node => node.classIdentifier === classIdentifier).source
+
createPage({
path: p,
component: slash(serviceTemplate),
context: {
- node
+ classIdentifier,
+ source,
},
})
createPage({
diff --git a/docs/src/components/ServiceMarkdown.tsx b/docs/src/components/ServiceMarkdown.tsx
index cc5b8d031..5c43f7216 100644
--- a/docs/src/components/ServiceMarkdown.tsx
+++ b/docs/src/components/ServiceMarkdown.tsx
@@ -3,16 +3,20 @@ import Markdown from "./ui/Markdown";
import ServiceSpecificationStatusAlert from "./ServiceSpecificationStatusAlert"
import { Button, Link } from "gatsby-theme-material-ui";
import DeviceSpecificationList from "./DeviceSpecificationList";
+import { serviceSpecificationFromClassIdentifier } from "../../../src/jdom/spec";
export default function ServiceMarkdown(props: {
- service: jdspec.ServiceSpec
+ classIdentifier: number,
+ source: string
}) {
- const { service: node } = props;
- const { shortId, classIdentifier } = node;
+ const { classIdentifier, source } = props;
+ const service = serviceSpecificationFromClassIdentifier(classIdentifier)
+ const { shortId } = service;
+
return <>
-