diff --git a/.github/workflows/respec.yaml b/.github/workflows/respec.yaml index 5bd1f90..eb7da2a 100644 --- a/.github/workflows/respec.yaml +++ b/.github/workflows/respec.yaml @@ -11,7 +11,7 @@ name: respec on: push: paths: - - "versions/**" + - "versions/[0-9].[0-9].[0-9].md" branches: - main workflow_dispatch: {} diff --git a/.gitignore b/.gitignore index fadcdf5..f3ff4ab 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ target atlassian-ide-plugin.xml node_modules/ deploy/ +deploy-preview/ coverage/ history Gemfile.lock diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f59e90c..7a56a9f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,7 +43,7 @@ The `main` branch holds Other branches are usually short-lived, for example and for maintaining utility scripts. -## Build the HTML version to publish +## Build the HTML versions locally We use ReSpec to render the markdown specification as HTML for publishing and easier reading. These instructions explain how you can build the HTML locally. @@ -56,13 +56,17 @@ Install dependencies: npm install ``` -Produce stand-alone HTML files in the local `deploy/overlay` folder: +Produce stand-alone HTML files for all final specifications in the local `deploy/overlay` folder: ```sh npm run build ``` -Note that Linux users may need to add `--no-sandbox` to run `npx respec` as found in the `scripts/md2html/build.sh` file. +Produce stand-alone HTML files for all work-in-progress specifications in the local `deploy-preview` folder: + +```sh +npm run build-dev +``` ## Style guide for Overlay Specification diff --git a/EDITORS.md b/EDITORS.md index 42189b6..5efa0e9 100644 --- a/EDITORS.md +++ b/EDITORS.md @@ -2,10 +2,14 @@ ## Active +* Lorna Mitchell [@lornajane](https://github.com/lornajane) +* Mike Kistler [@mikekistler](https://github.com/mikekistler) +* Vincent Biret [@baywet](https://github.com/baywet) + +## Emeritus + * Darrel Miller [@darrelmiller](https://github.com/darrelmiller) * Greg Dennis [@gregsdennis](https://github.com/gregsdennis) * Kevin Swiber [@kevinswiber](https://github.com/kevinswiber) -* Lorna Mitchell [@lornajane](https://github.com/lornajane) -* Mike Kistler [@mikekistler](https://github.com/mikekistler) * Mike Ralphson [@MikeRalphson](https://github.com/MikeRalphson) * Ron Ratovsky [@webron](https://github.com/webron) diff --git a/package.json b/package.json index 7b4b578..ceafab5 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ ], "scripts": { "build": "bash ./scripts/md2html/build.sh", + "build-dev": "bash ./scripts/md2html/build.sh dev", "format-markdown": "bash ./scripts/format-markdown.sh ./versions/*.md", "test": "c8 --100 vitest run --coverage" } diff --git a/scripts/md2html/build.sh b/scripts/md2html/build.sh index 9f3fa97..3d28566 100755 --- a/scripts/md2html/build.sh +++ b/scripts/md2html/build.sh @@ -2,47 +2,83 @@ # Author: @ralfhandl (inspired by the work of @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" | "dev"] +# 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 "1.0.0" or "latest" +# Finally, it may be run with "dev" to build "versions/*-dev.md" +# # It contains bashisms -mkdir -p deploy/overlay -mkdir -p deploy/js +if [ "$1" = "dev" ]; then + deploydir="deploy-preview" +else + deploydir="deploy/overlay" +fi + +mkdir -p $deploydir/js +mkdir -p $deploydir/temp +cp -p node_modules/respec/builds/respec-w3c.* $deploydir/js/ -cd scripts/md2html -mkdir -p history -cp ../../EDITORS.md history/EDITORS_v1.0.0.md +latest=$(git describe --abbrev=0 --tags) -# temporarily copy installed version of respec into build directory -cp -p ../../node_modules/respec/builds/respec-w3c.* ../../deploy/js/ +if [ -z "$1" ]; then + specifications=$(ls -1 versions/[1-9].[0-9].[0-9].md | sort -r) +elif [ "$1" = "latest" ]; then + specifications=$(ls -1 versions/$latest.md) +elif [ "$1" = "dev" ]; then + specifications=$(ls -1 versions/[1-9].[0-9].[0-9]-dev.md | sort -r) +else + specifications=$(ls -1 versions/$1.md) +fi -# latest=`git describe --abbrev=0 --tags` -- introduce after release tags created -latest=1.0.0 -latestCopied=none +latestCopied="none" lastMinor="-" -for filename in $(ls -1 ../../versions/[1-9].[0-9].[0-9].md | sort -r) ; do - version=$(basename "$filename" .md) + +for specification in $specifications; do + version=$(basename "$specification" .md) + + destination="$deploydir/v$version.html" + if [ "$1" = "dev" ]; then + maintainers="EDITORS.md" + else + maintainers="$(dirname $specification)/$version-editors.md" + fi + minorVersion=${version:0:3} - tempfile=../../deploy/overlay/v$version-tmp.html - echo -e "\n=== v$version ===" + tempfile="$deploydir/temp/$version.html" + tempfile2="$deploydir/temp/$version-2.html" + + echo === Building $version to $destination - node md2html.js --maintainers ./history/EDITORS_v$version.md ${filename} > $tempfile - npx respec --use-local --src $tempfile --out ../../deploy/overlay/v$version.html - rm $tempfile + node scripts/md2html/md2html.js --maintainers $maintainers $specification "$allVersions" > $tempfile + npx respec --no-sandbox --use-local --src $tempfile --out $tempfile2 + # remove unwanted Google Tag Manager and Google Analytics scripts + sed -e 's/'; - preface += ``; - try { - preface += fs.readFileSync('./analytics/google.html','utf8'); - } - catch (ex) {} - preface += '
'; + preface += `\n`; + preface += '\n'; preface += '