diff --git a/docs/src/.vuepress/components/ImageVerification.vue b/docs/src/.vuepress/components/ImageVerification.vue new file mode 100644 index 000000000..16cd8688a --- /dev/null +++ b/docs/src/.vuepress/components/ImageVerification.vue @@ -0,0 +1,55 @@ + + + diff --git a/docs/src/.vuepress/config.ts b/docs/src/.vuepress/config.ts index b41eb68ce..ea3340245 100644 --- a/docs/src/.vuepress/config.ts +++ b/docs/src/.vuepress/config.ts @@ -1,6 +1,8 @@ import { viteBundler } from '@vuepress/bundler-vite'; import { defineUserConfig } from "vuepress"; import theme from "./theme.js"; +import { releaseVarsPlugin, replaceReleaseTokens } from "./markdown/releaseVarsPlugin.js"; +import { getReleaseFromPath } from "./data/releases.js"; export default defineUserConfig({ @@ -28,7 +30,32 @@ export default defineUserConfig({ }, },*/ plugins: [ - + { + name: 'release-vars', + extendsMarkdown: (md) => { + md.use(releaseVarsPlugin); + }, + extendsPage: (page) => { + const lookup = page.filePathRelative ? '/' + page.filePathRelative : page.path; + const release = getReleaseFromPath(lookup); + if (!release) return; + const walk = (obj: Record | undefined) => { + if (!obj) return; + for (const key of Object.keys(obj)) { + const v = obj[key]; + if (typeof v === 'string') { + obj[key] = replaceReleaseTokens(v, release); + } + } + }; + walk(page.frontmatter as Record); + walk(page.routeMeta as Record); + walk(page.data as unknown as Record); + if (typeof page.title === 'string') { + page.title = replaceReleaseTokens(page.title, release); + } + }, + }, ], // Enable it with pwa diff --git a/docs/src/.vuepress/data/releases.ts b/docs/src/.vuepress/data/releases.ts new file mode 100644 index 000000000..4e2275624 --- /dev/null +++ b/docs/src/.vuepress/data/releases.ts @@ -0,0 +1,40 @@ +export interface ReleaseImage { + digest?: string; +} + +export interface Release { + tag: string; + previousTag?: string; + images: { + fhir: ReleaseImage; + fhir_proxy: ReleaseImage; + bpe: ReleaseImage; + bpe_proxy: ReleaseImage; + }; +} + +export const releases: Record = { + '2.1.0': { + tag: '2.1.0', + previousTag: '2.0.2', + images: { + fhir: { digest: 'sha256:71599af143f0262a7265aa2bc4ea5a9660f11de6248a053e060b5667070203fd' }, + fhir_proxy: { digest: 'sha256:9f11a3580c970314532f5951808be6fe72f1de7d53348e625d2dd0c95bcf1d96' }, + bpe: { digest: 'sha256:3ee7ef0ac201fc3776273fbfc2569bdc4edf724a2bb9f1b4a889eb7e13ff4049' }, + bpe_proxy: { digest: 'sha256:c67da4a1720ea75a383764db2bf25619fe70f57773b1069029f5b49588eb1ecc' }, + }, + }, +}; + +export const latestVersion = '2.1.0'; + +export function getReleaseFromPath(path: string): Release | undefined { + const versionMatch = path.match(/(?:^|\/)operations\/v(\d+\.\d+\.\d+)\//); + if (versionMatch) return releases[versionMatch[1]]; + if (/(?:^|\/)operations\/latest\//.test(path)) return releases[latestVersion]; + return undefined; +} + +export function tagUnderscored(tag: string): string { + return tag.replace(/\./g, '_'); +} diff --git a/docs/src/.vuepress/layouts/PageLayout.vue b/docs/src/.vuepress/layouts/PageLayout.vue index 3e16805ff..daab1228f 100644 --- a/docs/src/.vuepress/layouts/PageLayout.vue +++ b/docs/src/.vuepress/layouts/PageLayout.vue @@ -4,7 +4,7 @@ import { useRoute, useRouter } from "vue-router"; import { ref, onMounted } from 'vue' const version = ref(""); -const latestVersion = "v2.0.2"; +const latestVersion = "v2.1.0"; function setVersionBasedOnCurrentPath() : void { @@ -55,7 +55,8 @@ function navigateToNewVersion() {