diff --git a/scripts/md2html/build.sh b/scripts/md2html/build.sh index f716e815bc..dcfe5b1365 100755 --- a/scripts/md2html/build.sh +++ b/scripts/md2html/build.sh @@ -2,72 +2,80 @@ # Author: @MikeRalphson -# run this script from the root of the repo. It is designed to be run by a GitHub workflow. +# run this script from the root of the repo +# It is designed to be run by a GitHub workflow + +# Usage: build.sh [version | "latest" | "src"] +# When run with no arguments, it builds artifacts for all published specification versions. +# It may also be run with a specific version argument, such as "3.1.1" or "latest" +# Finally, it may be run with "src" to build "src/oas.md" +# # It contains bashisms -mkdir -p deploy/oas -mkdir -p deploy/js - -cd scripts/md2html -mkdir -p history -cat > history/MAINTAINERS_v2.0.md < history/MAINTAINERS_v3.0.0.md < history/MAINTAINERS_v3.0.1.md -git show 3140640:MAINTAINERS.md > history/MAINTAINERS_v3.0.2.md -cp history/MAINTAINERS_v3.0.2.md history/MAINTAINERS_v3.0.3.md -cp history/MAINTAINERS_v3.0.2.md history/MAINTAINERS_v3.1.0.md -#TODO: adjust commit for 3.0.4, 3.1.1 -git show c3b88ed:EDITORS.md > history/MAINTAINERS_v3.0.4.md -cp history/MAINTAINERS_v3.0.4.md history/MAINTAINERS_v3.1.1.md -# add lines for 3.2.0, ... - -cp -p ../../node_modules/respec/builds/respec-w3c.* ../../deploy/js/ - -latest=`git describe --abbrev=0 --tags` -latestCopied=none +if [ -z "$1" ]; then + deploydir="deploy/oas" +else + deploydir="deploy-preview" +fi + +mkdir -p $deploydir/js +mkdir -p $deploydir/temp + +latest=$(git describe --abbrev=0 --tags) +latestCopied="none" lastMinor="-" -for filename in $(ls -1 ../../versions/[23456789].*.md | sort -r) ; do - version=$(basename "$filename" .md) + +if [ -z "$1" ]; then + specifications=$(ls -1 versions/[23456789].*.md | grep -v -e "\-editors" | sort -r) +elif [ "$1" = "latest" ]; then + specifications=$(ls -1 versions/$latest.md) +elif [ "$1" = "src" ]; then + specifications="src/oas.md" +else + specifications=$(ls -1 versions/$1.md) +fi + +cp -p node_modules/respec/builds/respec-w3c.* $deploydir/js/ + +for specification in $specifications; do + version=$(basename $specification .md) minorVersion=${version:0:3} - tempfile=../../deploy/oas/v$version-tmp.html - echo -e "\n=== v$version ===" + tempfile="$deploydir/temp/$version.html" - node md2html.js --maintainers ./history/MAINTAINERS_v$version.md ${filename} > $tempfile - npx respec --use-local --src $tempfile --out ../../deploy/oas/v$version.html + if [ "$1" = "src" ]; then + destination="$deploydir/$version.html" + maintainers="EDITORS.md" + else + destination="$deploydir/v$version.html" + maintainers="$(dirname $specification)/$version-editors.md" + fi + + echo === Building $version to $destination + + node scripts/md2html/md2html.js --maintainers $maintainers $specification > $tempfile + npx respec --use-local --src $tempfile --out $destination rm $tempfile + echo === Built $destination + if [ $version = $latest ]; then - if [[ ${version} != *"rc"* ]];then + if [[ ${version} != *"rc"* ]]; then # version is not a Release Candidate - pushd ../../deploy/oas - ln -sf v$version.html latest.html - popd - latestCopied=v$version + ln -sf $(basename $destination) $deploydir/latest.html + latestCopied="v$version" fi fi if [ ${minorVersion} != ${lastMinor} ] && [ ${minorVersion} != 2.0 ]; then - pushd ../../deploy/oas - ln -sf v$version.html v$minorVersion.html - popd + ln -sf $(basename $destination) $deploydir/v$minorVersion.html lastMinor=$minorVersion fi done -echo Latest tag is $latest, copied $latestCopied to latest.html -rm ../../deploy/js/respec-w3c.* +if [ "$latestCopied" != "none" ]; then + echo Latest tag is $latest, copied $latestCopied to latest.html +fi + +rm $deploydir/js/respec-w3c.* +rmdir $deploydir/js +rmdir $deploydir/temp diff --git a/scripts/md2html/md2html.js b/scripts/md2html/md2html.js index fd3ec78f69..2ddb4e335b 100644 --- a/scripts/md2html/md2html.js +++ b/scripts/md2html/md2html.js @@ -131,10 +131,7 @@ function preface(title,options) { // ReSpec preface += ''; preface += ``; - try { - preface += fs.readFileSync('./analytics/google.html','utf8'); - } - catch (ex) {} + preface += fs.readFileSync(path.resolve(__dirname, 'analytics/google.html'),'utf8'); preface += ''; preface += '

OpenAPI Specification v30.0.1

What is the OpenAPI Specification?

The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for HTTP APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

Status of This Document

The source-of-truth for this specification is the HTML file referenced above as This version.
+OpenAPI Specification v30.0.1 | Introduction, Definitions, & More + + +

OpenAPI Specification v30.0.1

What is the OpenAPI Specification?

The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for HTTP APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

Status of This Document

The source-of-truth for this specification is the HTML file referenced above as This version.

Heading 1

Text for first chapter

Version 30.0.1

diff --git a/tests/md2html/fixtures/basic-old.html b/tests/md2html/fixtures/basic-old.html index a80b4489fb..0f4463eedd 100644 --- a/tests/md2html/fixtures/basic-old.html +++ b/tests/md2html/fixtures/basic-old.html @@ -1,4 +1,12 @@ -OpenAPI Specification v30.0.1 | Introduction, Definitions, & More

OpenAPI Specification v30.0.1

What is the OpenAPI Specification?

The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for HTTP APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

Status of This Document

The source-of-truth for this specification is the HTML file referenced above as This version.
+OpenAPI Specification v30.0.1 | Introduction, Definitions, & More + + +

OpenAPI Specification v30.0.1

What is the OpenAPI Specification?

The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for HTTP APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.

Status of This Document

The source-of-truth for this specification is the HTML file referenced above as This version.

Heading 1

Text for first chapter

Version 30.0.1

diff --git a/versions/2.0-editors.md b/versions/2.0-editors.md new file mode 100644 index 0000000000..de30bb5d63 --- /dev/null +++ b/versions/2.0-editors.md @@ -0,0 +1,5 @@ +## Active +* Jeremy Whitlock [@whitlockjc](https://github.com/whitlockjc) +* Marsh Gardiner [@earth2marsh](https://github.com/earth2marsh) +* Ron Ratovsky [@webron](https://github.com/webron) +* Tony Tam [@fehguy](https://github.com/fehguy) diff --git a/versions/3.0.0-editors.md b/versions/3.0.0-editors.md new file mode 100644 index 0000000000..7278a62ab5 --- /dev/null +++ b/versions/3.0.0-editors.md @@ -0,0 +1,8 @@ +## Active +* Jeremy Whitlock [@whitlockjc](https://github.com/whitlockjc) +* Marsh Gardiner [@earth2marsh](https://github.com/earth2marsh) +* Ron Ratovsky [@webron](https://github.com/webron) +* Tony Tam [@fehguy](https://github.com/fehguy) + +## Emeritus +* Jason Harmon [@jharmn](https://github.com/jharmn) diff --git a/versions/3.0.1-editors.md b/versions/3.0.1-editors.md new file mode 100644 index 0000000000..05849e61f5 --- /dev/null +++ b/versions/3.0.1-editors.md @@ -0,0 +1,9 @@ +## Active +* Darrel Miller [@darrelmiller](https://github.com/darrelmiller) +* Jeremy Whitlock [@whitlockjc](https://github.com/whitlockjc) +* Marsh Gardiner [@earth2marsh](https://github.com/earth2marsh) +* Ron Ratovsky [@webron](https://github.com/webron) + +## Emeritus +* Jason Harmon [@jharmn](https://github.com/jharmn) +* Tony Tam [@fehguy](https://github.com/fehguy) diff --git a/versions/3.0.2-editors.md b/versions/3.0.2-editors.md new file mode 100644 index 0000000000..34421f2c62 --- /dev/null +++ b/versions/3.0.2-editors.md @@ -0,0 +1,11 @@ +## Active +* Darrel Miller [@darrelmiller](https://github.com/darrelmiller) +* Jeremy Whitlock [@whitlockjc](https://github.com/whitlockjc) +* Marsh Gardiner [@earth2marsh](https://github.com/earth2marsh) +* Mike Ralphson [@MikeRalphson](https://github.com/MikeRalphson) +* Ron Ratovsky [@webron](https://github.com/webron) +* Uri Sarid [@usarid](https://github.com/usarid) + +## Emeritus +* Jason Harmon [@jharmn](https://github.com/jharmn) +* Tony Tam [@fehguy](https://github.com/fehguy) diff --git a/versions/3.0.3-editors.md b/versions/3.0.3-editors.md new file mode 100644 index 0000000000..34421f2c62 --- /dev/null +++ b/versions/3.0.3-editors.md @@ -0,0 +1,11 @@ +## Active +* Darrel Miller [@darrelmiller](https://github.com/darrelmiller) +* Jeremy Whitlock [@whitlockjc](https://github.com/whitlockjc) +* Marsh Gardiner [@earth2marsh](https://github.com/earth2marsh) +* Mike Ralphson [@MikeRalphson](https://github.com/MikeRalphson) +* Ron Ratovsky [@webron](https://github.com/webron) +* Uri Sarid [@usarid](https://github.com/usarid) + +## Emeritus +* Jason Harmon [@jharmn](https://github.com/jharmn) +* Tony Tam [@fehguy](https://github.com/fehguy) diff --git a/versions/3.0.4-editors.md b/versions/3.0.4-editors.md new file mode 100644 index 0000000000..678e911b2b --- /dev/null +++ b/versions/3.0.4-editors.md @@ -0,0 +1,18 @@ +# OpenAPI Specification Editors + +## Active +* Darrel Miller [@darrelmiller](https://github.com/darrelmiller) +* Henry Andrews [@handrews](https://github.com/handrews) +* Jeremy Whitlock [@whitlockjc](https://github.com/whitlockjc) +* Lorna Mitchell [@lornajane](https://github.com/lornajane) +* Marsh Gardiner [@earth2marsh](https://github.com/earth2marsh) +* Miguel Quintero [@miqui](https://github.com/miqui) +* Mike Kistler [@mikekistler](https://github.com/mikekistler) +* Ralf Handl [@ralfhandl](https://github.com/ralfhandl) +* Ron Ratovsky [@webron](https://github.com/webron) + +## Emeritus +* Mike Ralphson [@MikeRalphson](https://github.com/MikeRalphson) +* Uri Sarid [@usarid](https://github.com/usarid) +* Jason Harmon [@jharmn](https://github.com/jharmn) +* Tony Tam [@fehguy](https://github.com/fehguy) diff --git a/versions/3.1.0-editors.md b/versions/3.1.0-editors.md new file mode 100644 index 0000000000..34421f2c62 --- /dev/null +++ b/versions/3.1.0-editors.md @@ -0,0 +1,11 @@ +## Active +* Darrel Miller [@darrelmiller](https://github.com/darrelmiller) +* Jeremy Whitlock [@whitlockjc](https://github.com/whitlockjc) +* Marsh Gardiner [@earth2marsh](https://github.com/earth2marsh) +* Mike Ralphson [@MikeRalphson](https://github.com/MikeRalphson) +* Ron Ratovsky [@webron](https://github.com/webron) +* Uri Sarid [@usarid](https://github.com/usarid) + +## Emeritus +* Jason Harmon [@jharmn](https://github.com/jharmn) +* Tony Tam [@fehguy](https://github.com/fehguy) diff --git a/versions/3.1.1-editors.md b/versions/3.1.1-editors.md new file mode 100644 index 0000000000..678e911b2b --- /dev/null +++ b/versions/3.1.1-editors.md @@ -0,0 +1,18 @@ +# OpenAPI Specification Editors + +## Active +* Darrel Miller [@darrelmiller](https://github.com/darrelmiller) +* Henry Andrews [@handrews](https://github.com/handrews) +* Jeremy Whitlock [@whitlockjc](https://github.com/whitlockjc) +* Lorna Mitchell [@lornajane](https://github.com/lornajane) +* Marsh Gardiner [@earth2marsh](https://github.com/earth2marsh) +* Miguel Quintero [@miqui](https://github.com/miqui) +* Mike Kistler [@mikekistler](https://github.com/mikekistler) +* Ralf Handl [@ralfhandl](https://github.com/ralfhandl) +* Ron Ratovsky [@webron](https://github.com/webron) + +## Emeritus +* Mike Ralphson [@MikeRalphson](https://github.com/MikeRalphson) +* Uri Sarid [@usarid](https://github.com/usarid) +* Jason Harmon [@jharmn](https://github.com/jharmn) +* Tony Tam [@fehguy](https://github.com/fehguy)