-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc: auto toctree for examples and microservices (#130)
Instead of manually maintaining the headings and toctree for examples and microservices, build the toctree using a script during doc build time that scans for directories in GenAIExamples and GenAIComps/comps. This way, if new examples or comps show up (or are renamed) they're automatically added to these index documents for github.io publishing. Signed-off-by: David B. Kinder <[email protected]>
- Loading branch information
Showing
4 changed files
with
78 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/bash | ||
# Copyright (C) 2024 Intel Corporation. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# For all directories, create a H2 title with the directory name and a | ||
# .toctree directive with the repo name and | ||
# those directory names, something like this: | ||
# | ||
# AudioQnA Application | ||
# ******************** | ||
# | ||
# .. toctree:: | ||
# :maxdepth: 1 | ||
# :glob: | ||
# | ||
# /GenAIExamples/AudioQnA/* | ||
# /GenAIExamples/AudioQnA/**/* | ||
# | ||
# ls -d1 */ returns something like this: | ||
# | ||
# AgentQnA/ | ||
# AudioQnA/ | ||
# ChatQnA/ | ||
# CodeGen/ | ||
# CodeTrans/ | ||
# DocIndexRetriever/ | ||
# | ||
# | ||
# Create a title based on the directory name and print it. | ||
# Use a gsub to turn every character in the title into an * for the | ||
# heading underline and print it. | ||
|
||
cd ../GenAIExamples | ||
|
||
ls -d1 */ | \ | ||
awk \ | ||
-v repo="GenAIExamples" \ | ||
-e '{dirname=substr($0,1,length($0)-1); title=dirname " Application"; \ | ||
print title;gsub(/./,"*",title); print title; \ | ||
print "\n.. rst-class:: rst-columns\n\n.. toctree::\n :maxdepth: 1\n :glob:\n\n /" \ | ||
repo "/" dirname "/*\n /" \ | ||
repo "/" dirname "/**/*\n";}' > ../docs/_build/rst/examples/examples.txt | ||
|
||
# | ||
# The components directory names in GenAIComps/comps are all lowercase, so uppercase | ||
# just the first character for the title. | ||
# | ||
|
||
cd ../GenAIComps/comps | ||
|
||
ls -d1 [a-zA-Z]*/ | \ | ||
awk \ | ||
-v repo="GenAIComps" \ | ||
-e '{dirname=substr($0,1,length($0)-1); title=toupper(substr(dirname,1,1)) substr(dirname,2) " Microservice"; \ | ||
print title;gsub(/./,"*",title); print title; \ | ||
print "\n.. rst-class:: rst-columns\n\n.. toctree::\n :maxdepth: 1\n :glob:\n\n /" \ | ||
repo "/comps/" dirname "/*\n /" \ | ||
repo "/comps/" dirname "/**/*\n";}' > ../../docs/_build/rst/microservices/microservices.txt | ||
|
||
|