diff --git a/spec/LICENSE.md b/LICENSE.md similarity index 100% rename from spec/LICENSE.md rename to LICENSE.md diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..f6f726ad --- /dev/null +++ b/Makefile @@ -0,0 +1,75 @@ +# Build all documents and diagrams from spec/ into the build/ +# output folder. Please read RELEASE.md for more details on +# publishing the documents. +# +# Assumes python3 is installed +# Assumes npm is installed +# +# Examples of usage: +# make all +# make a clean build +# make build +# build the documents and diagrams +# make clean +# clean the build directory +# make install +# Will install bikeshed and mermaid-cli globally + +# spec/**.mmd -> build/**.svg +DIAGRAMS := $(wildcard spec/v2/diagrams/*.mmd) +DIAGRAMS := $(DIAGRAMS:spec/%.mmd=build/%.svg) +SOURCES := $(wildcard **.bs) + +# Build rule for bikeshed documents +build/%.html: spec/%.bs + @echo Check release status and version + $(eval status := $(shell sed -n 's/^Text Macro: STATUS //p' $<)) + $(eval version := $(shell sed -n 's/^Text Macro: VERSION //p' $<)) + $(eval date := $(shell sed -n 's/^Text Macro: DATE //p' $<)) + + @echo Build the document + mkdir -p $(dir $@) + bikeshed --allow-nonlocal-files spec $< $@ + + @echo Set the status in the document + @if [[ "$(status)" == "Release" ]]; then \ + echo "Release: add version to title"; \ + mv -f $@ $@.tmp; \ + sed 's/\(.*\)<\/title>/<title>\1 (Version $(version))<\/title>/g' $@.tmp > $@; \ + mv -f $@ $@.tmp; \ + sed 's/\(<h1 .*id="title">.*\)\(<\/h1>\)/\1 (Version $(version))\2/g' $@.tmp > $@; \ + elif [[ "$(status)" == "Draft" || "$(status)" == "Consultation" ]]; then \ + echo "No release: add version-date to title"; \ + mv -f $@ $@.tmp; \ + sed 's/<title>\(.*\)<\/title>/<title>\1 (Version $(version)-$(date))<\/title>/g' $@.tmp > $@; \ + mv -f $@ $@.tmp; \ + sed 's/\(<h1 .*id="title">.*\)\(<\/h1>\)/\1 (Version $(version)-$(date))\2/g' $@.tmp > $@; \ + else \ + echo "No status can be found"; \ + fi + mv -f $@ $@.tmp; \ + sed 's/\(<h2 .*id="profile-and-date">\).*\(<\/h2>\)/\1$(status)\2/g' $@.tmp > $@; \ + rm -f $@.tmp; + + +# Build rule for mermaid diagrams +build/%.svg: spec/%.mmd + mkdir -p $(dir $@) + mmdc -i $< -o $@ --theme default + +all: clean build + +install: + @echo Install Bikeshed + pip3 install bikeshed && bikeshed update + @echo Install Mermaid + npm list -g @mermaid-js/mermaid-cli || npm install -g @mermaid-js/mermaid-cli + +clean: + rm -rf build + +build: \ + build/index.html \ + build/v2/index.html \ + build/faq/index.html \ + $(DIAGRAMS) diff --git a/spec/RELEASE.md b/RELEASE.md similarity index 100% rename from spec/RELEASE.md rename to RELEASE.md diff --git a/spec/Makefile b/old/Makefile similarity index 78% rename from spec/Makefile rename to old/Makefile index 66ffd9d2..9e445061 100644 --- a/spec/Makefile +++ b/old/Makefile @@ -1,4 +1,4 @@ -OUTDIR := upload +OUTDIR := ../upload MMDC := ./node_modules/.bin/mmdc all: index.html @@ -11,7 +11,7 @@ publish: index.html cp $< $(OUTDIR) index.html: index.bs $(DIAGRAMS) - bikeshed spec $< $@ + bikeshed --allow-nonlocal-files spec $< $@ serve: bikeshed serve index.bs diff --git a/spec/faq/Makefile b/old/faq/Makefile similarity index 85% rename from spec/faq/Makefile rename to old/faq/Makefile index b47f8049..69c29501 100644 --- a/spec/faq/Makefile +++ b/old/faq/Makefile @@ -1,4 +1,4 @@ -OUTDIR := ../upload/faq +OUTDIR := ../../upload/faq all: index.html diff --git a/spec/header.include b/old/header.include similarity index 100% rename from spec/header.include rename to old/header.include diff --git a/spec/release.sh b/old/release.sh similarity index 100% rename from spec/release.sh rename to old/release.sh diff --git a/spec/v2/LICENSE.md b/old/v2/LICENSE.md similarity index 100% rename from spec/v2/LICENSE.md rename to old/v2/LICENSE.md diff --git a/spec/v2/Makefile b/old/v2/Makefile similarity index 91% rename from spec/v2/Makefile rename to old/v2/Makefile index cee70df5..ceda6cc1 100644 --- a/spec/v2/Makefile +++ b/old/v2/Makefile @@ -16,7 +16,7 @@ publish: index.html computed-metadata.include cp $^ $(OUTDIR) index.html: index.bs $(DIAGRAMS) - bikeshed spec $< $@ --md-text-macro="$(STATUS)" + bikeshed --allow-nonlocal-files spec $< $@ --md-text-macro="$(STATUS)" %.svg: %.mmd mmdc -i $< -o $@ diff --git a/spec/v2/computed-metadata.include b/old/v2/computed-metadata.include similarity index 100% rename from spec/v2/computed-metadata.include rename to old/v2/computed-metadata.include diff --git a/spec/v2/header.include b/old/v2/header.include similarity index 100% rename from spec/v2/header.include rename to old/v2/header.include diff --git a/spec/v2/header.include_release b/old/v2/header.include_release similarity index 100% rename from spec/v2/header.include_release rename to old/v2/header.include_release diff --git a/spec/.gitignore b/spec/.gitignore deleted file mode 100644 index 644844a0..00000000 --- a/spec/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*/*.svg diff --git a/spec/faq/index.bs b/spec/faq/index.bs index 69902068..da707048 100644 --- a/spec/faq/index.bs +++ b/spec/faq/index.bs @@ -11,7 +11,6 @@ Abstract: This document provides Frequently Asked Questions for PACT Technical S Repository: wbcsd/data-exchange-protocol Markup Shorthands: markdown yes, idl yes, dfn yes Boilerplate: omit copyright, omit conformance - </pre> # Frequently Asked Questions # {#faqs} diff --git a/spec/index.bs b/spec/index.bs index 511b57a5..4901dded 100644 --- a/spec/index.bs +++ b/spec/index.bs @@ -1,9 +1,11 @@ <pre class='metadata'> -Title: Technical Specifications for PCF Data Exchange +Text Macro: DATE 20230201 Text Macro: VERSION 1.0.1 -Shortname: data-exchange-protocol +Text Macro: STATUS Release +Title: Technical Specifications for PCF Data Exchange Level: 1 Status: LD +Shortname: data-exchange-protocol TR: https://wbcsd.github.io/tr/2023/data-exchange-protocol-20230201/ Mailing List: pact@wbcsd.org Editor: @@ -1384,5 +1386,5 @@ highlight: json # Appendix A: License # {#license} <pre class=include> -path: LICENSE.md +path: ../LICENSE.md </pre> diff --git a/spec/v2/index.bs b/spec/v2/index.bs index fc0b5615..1fa1f66d 100644 --- a/spec/v2/index.bs +++ b/spec/v2/index.bs @@ -1,9 +1,23 @@ +<!-- +Before publishing, make sure to: + - Add an entry to Changelog + - Update the DATE below + - STATUS can be Draft|Consultation|Release +In addition, for publishing a release: + Set STATUS Release + Update VERSION major.minor.patch + Update the Previous Version and TR links +--> <pre class='metadata'> -Title: Technical Specifications for PCF Data Exchange +Text Macro: DATE 20241024 Text Macro: VERSION 2.3.0 -Shortname: data-exchange-protocol +Text Macro: STATUS Draft +Title: Technical Specifications for PCF Data Exchange +TR: https://wbcsd.github.io/tr/2024/data-exchange-protocol-20241024/ +Previous Version: https://wbcsd.github.io/tr/2024/data-exchange-protocol-20240410/ Level: 1 Status: LD +Shortname: data-exchange-protocol Mailing List: pact@wbcsd.org Editor: Gertjan Schuurmans (WBCSD), https://www.wbcsd.org, schuurmans@wbcsd.org Former Editor: Beth Hadley (WBCSD), https://www.wbcsd.org, hadley@wbcsd.org @@ -14,7 +28,6 @@ Abstract: This document specifies a data model for GHG emission data at product Markup Shorthands: markdown yes, idl yes, dfn yes Boilerplate: omit copyright, omit conformance Local Boilerplate: header yes -Local Boilerplate: computed-metadata yes Metadata Include: This version off </pre> @@ -2792,7 +2805,7 @@ highlight: json # Appendix A: License # {#license} <pre class=include> -path: LICENSE.md +path: ../../LICENSE.md </pre> # Appendix B: Changelog # {#changelog}