Skip to content

Commit

Permalink
docs: capitalize schema titles & add stix bundle docs to overview page
Browse files Browse the repository at this point in the history
  • Loading branch information
clemiller committed Oct 22, 2024
1 parent ee39e0b commit 0b6cbee
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions generate-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ find $SCHEMA_DIR -name "*.schema.ts" | while read schemaFile; do

# skip stix-bundle for now
if [[ "${fileName}" == "stix-bundle.schema.ts" ]]; then
# add to overview
echo "| STIX Bundle | SDO | [Schema](/docs/sdo/stix-bundle.schema) |" >> $OVERVIEW
continue
fi

Expand All @@ -32,13 +34,14 @@ find $SCHEMA_DIR -name "*.schema.ts" | while read schemaFile; do

# get schema title
title=$(sed -e 's/-/ /g' <<< "${fileName%%.*}")
title="$(tr '[:lower:]' '[:upper:]' <<< "${title:0:1}")${title:1}"
title=$(echo "$title" | awk '{for(i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) tolower(substr($i,2))}1')
# title="$(tr '[:lower:]' '[:upper:]' <<< "${title:0:1}")${title:1}"

# set output file path
outputFile="$OUTPUT_DIR/${relativePath/.ts/.md}"

# convert zod schemas to md
npx zod2md --entry $schemaFile --title "$title schema" --output "$outputFile"
npx zod2md --entry $schemaFile --title "$title Schema" --output "$outputFile"

# add schema to overview table
schemaLink="${relativePath/.ts/.md}"
Expand Down

0 comments on commit 0b6cbee

Please sign in to comment.