From 1f4269832d7bdffb6864cee7af62047af0fc0b6e Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Sat, 11 Jan 2025 15:04:40 +0100 Subject: [PATCH] docs: docsgen resture output for website (#570) fixes #568 Signed-off-by: Jan Kowalleck --- docgen/json/gen.sh | 14 ++++++++------ docgen/xml/gen.sh | 6 +++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/docgen/json/gen.sh b/docgen/json/gen.sh index 19149d5b..86668905 100755 --- a/docgen/json/gen.sh +++ b/docgen/json/gen.sh @@ -7,7 +7,6 @@ DOCS_PATH="$THIS_PATH/docs" TEMPLATES_PATH="$THIS_PATH/templates" rm -f -R "$DOCS_PATH" -mkdir -p "$DOCS_PATH/"{1.2,1.3,1.4,1.5,1.6} # Check to see if generate-schema-doc is executable and is in the path. If not, install JSON Schema for Humans. if ! [ -x "$(command -v generate-schema-doc)" ] @@ -27,7 +26,10 @@ generate () { then SCHEMA_FILE="$STRICT_SCHEMA_FILE" fi - echo "$SCHEMA_FILE" + echo "SCHEMA_FILE: $SCHEMA_FILE" + + OUT_FILE="$DOCS_PATH/$version/json/index.html" + mkdir -p "$(dirname "$OUT_FILE")" generate-schema-doc \ --config no_link_to_reused_ref \ @@ -38,11 +40,11 @@ generate () { --config custom_template_path="$TEMPLATES_PATH/cyclonedx/base.html" \ --minify \ "$SCHEMA_FILE" \ - "$DOCS_PATH/$version/index.html" + "$OUT_FILE" - sed -i -e "s/\${quotedTitle}/\"$title\"/g" "$DOCS_PATH/$version/index.html" - sed -i -e "s/\${title}/$title/g" "$DOCS_PATH/$version/index.html" - sed -i -e "s/\${version}/$version/g" "$DOCS_PATH/$version/index.html" + sed -i -e "s/\${quotedTitle}/\"$title\"/g" "$OUT_FILE" + sed -i -e "s/\${title}/$title/g" "$OUT_FILE" + sed -i -e "s/\${version}/$version/g" "$OUT_FILE" } generate 1.2 diff --git a/docgen/xml/gen.sh b/docgen/xml/gen.sh index beb4b813..191f495e 100755 --- a/docgen/xml/gen.sh +++ b/docgen/xml/gen.sh @@ -15,6 +15,7 @@ rm -rf "$DOCS_PATH" SAXON_JAR="Saxon-HE-${SAXON_VERSION}.jar" if [ ! -f "$THIS_PATH/$SAXON_JAR" ]; then + echo "fetching $SAXON_JAR" curl --output-dir "$THIS_PATH" -O \ "https://repo1.maven.org/maven2/net/sf/saxon/Saxon-HE/$SAXON_VERSION/$SAXON_JAR" fi @@ -25,11 +26,14 @@ generate () { title="CycloneDX v$version XML Reference" echo "Generating: $title" + OUT_FILE="$DOCS_PATH/$version/xml/index.html" + mkdir -p "$(dirname "$OUT_FILE")" + ## docs: https://www.saxonica.com/documentation10/index.html#!using-xsl/commandline java -jar "$THIS_PATH/$SAXON_JAR" \ -s:"$SCHEMA_PATH/bom-${version}.xsd" \ -xsl:"$THIS_PATH/xs3p.xsl" \ - -o:"$DOCS_PATH/$version/index.html" \ + -o:"$OUT_FILE" \ cycloneDxVersion="$version" \ title="$title" }