From b9c9b05ab48828575ae2574aa46644c612d4971d Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Sun, 17 Dec 2023 02:28:31 -0700 Subject: generate docs --- generate_docs.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 generate_docs.sh (limited to 'generate_docs.sh') diff --git a/generate_docs.sh b/generate_docs.sh new file mode 100755 index 0000000..d301d04 --- /dev/null +++ b/generate_docs.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +mkdir -p docs/ + +for target in "$@" +do + echo "Generating docs for $target" + swift package --allow-writing-to-directory "$target-docs" generate-documentation --disable-indexing --transform-for-static-hosting --hosting-base-path swift-gopher --output-path "$target-docs" --target "$target" + cp -r $target-docs/* docs/ + modified_target=$(echo $target | tr '-' '_' | tr '[:upper:]' '[:lower:]') + cp -r $target-docs/index/index.json "docs/index/$modified_target.json" +done + +echo "
    " > docs/index.html + +for target in "$@" +do + cp -R $target-docs/data/documentation/* docs/data/documentation/ + cp -R $target-docs/documentation/* docs/documentation/ + rm -r "$target-docs" + modified_target=$(echo $target | tr '-' '_' | tr '[:upper:]' '[:lower:]') + echo "
  1. $target
  2. " >> docs/index.html +done + +echo "
" >> docs/index.html + +custom_javascript="window.location.pathname.split('documentation/')[1].split('/')[0]" +file_to_modify=$(ls docs/js/documentation-topic\~topic\~tutorials-overview.*.js) + +sed -i '' 's/"index.json"/window.location.pathname.split("documentation\/")[1].split("\/")[0]+".json"/g' $file_to_modify +echo "Modified $file_to_modify" -- cgit v1.2.3