Skip to content

Commit f9d0524

Browse files
committed
Other versions links in frontmatter
1 parent b5ab378 commit f9d0524

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

scripts/md2html/build.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ cp -p node_modules/respec/builds/respec-w3c.* $deploydir/js/
2424

2525
latest=$(git describe --abbrev=0 --tags)
2626

27+
allVersions=$(ls -1 versions/[23456789].*.md | grep -v -e "\-editors" | sort -r)
28+
2729
if [ -z "$1" ]; then
28-
specifications=$(ls -1 versions/[23456789].*.md | grep -v -e "\-editors" | sort -r)
30+
specifications=$allVersions
2931
elif [ "$1" = "latest" ]; then
3032
specifications=$(ls -1 versions/$latest.md)
3133
elif [ "$1" = "src" ]; then
@@ -53,7 +55,7 @@ for specification in $specifications; do
5355

5456
echo === Building $version to $destination
5557

56-
node scripts/md2html/md2html.js --maintainers $maintainers $specification > $tempfile
58+
node scripts/md2html/md2html.js --maintainers $maintainers $specification "$allVersions" > $tempfile
5759
npx respec --no-sandbox --use-local --src $tempfile --out $destination
5860
rm $tempfile
5961

scripts/md2html/md2html.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ const md = require('markdown-it')({
7777
});
7878

7979
function preface(title,options) {
80+
const otherVersions = options._[1].split('\n').map(v => path.basename(v,'.md')).filter(v => v !== options.subtitle);
8081
const respec = {
8182
specStatus: "base",
8283
latestVersion: "https://spec.openapis.org/oas/latest.html",
@@ -96,6 +97,14 @@ function preface(title,options) {
9697
height: 48,
9798
url: "https://openapis.org/"}],
9899
otherLinks: [
100+
{
101+
key: "Other versions:",
102+
data: otherVersions.map(v => {
103+
return {
104+
href: `https://spec.openapis.org/oas/v${v}.html`
105+
}
106+
})
107+
},
99108
{
100109
key: "Participate",
101110
data: [

0 commit comments

Comments
 (0)