Skip to content

Commit

Permalink
docs: docsgen resture output for website (#570)
Browse files Browse the repository at this point in the history
fixes #568

Signed-off-by: Jan Kowalleck <[email protected]>
  • Loading branch information
jkowalleck authored Jan 11, 2025
1 parent 19c11ba commit 1f42698
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
14 changes: 8 additions & 6 deletions docgen/json/gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)" ]
Expand All @@ -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 \
Expand All @@ -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
Expand Down
6 changes: 5 additions & 1 deletion docgen/xml/gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
}
Expand Down

0 comments on commit 1f42698

Please sign in to comment.