7676# --------------------------------------------------------------------
7777# Make the latest docs
7878# --------------------------------------------------------------------
79- cd docs
79+ if [[ $1 == * -recipes ]]; then
80+ # Any of: dev-recipes, dev-clean-recipes, dev-scrub-recipes,
81+ # latest-recipes, archive-recipes
82+ is_recipes=true
83+ cd recipes-docs
84+ else
85+ # Non-recipes variants: dev, dev-clean, dev-scrub, latest, archive
86+ is_recipes=false
87+ cd docs
88+ fi
89+
8090# if [[ $1 = "latest" ]] || [[ $1 = "archive" ]] || [[ $1 = "dev-clean" ]] ; the#n
8191# rm -fr $dir/.doctrees
8292# fi
@@ -86,12 +96,14 @@ mkdir -p $dir/_downloads
8696# # Force recreation of recipes
8797# rm source/recipes/*.md5
8898# fi
99+
100+ recipes_source=source/recipes
89101if [[ $1 = " dev-recipes-scrub" ]] ; then
90102 # Force recreation of recipes
91- rm source/recipes /* .md5
92- rm source/recipes /* .ipynb
93- rm source/recipes /* _codeobj.pickle
94- rm source/recipes /* _recipe.rst
103+ rm $recipes_source /* .md5
104+ rm $recipes_source /* .ipynb
105+ rm $recipes_source /* _codeobj.pickle
106+ rm $recipes_source /* _recipe.rst
95107fi
96108
97109export CF_DOCS_MODE=$1
@@ -103,62 +115,68 @@ if [[ $rc != 0 ]]; then
103115 exit $rc
104116fi
105117
106- cp -pv source/sample_files/cf_tutorial_files.zip source/tutorial.py source/field_analysis.py $dir /_downloads
107118
108- for download_file in cf_tutorial_files.zip tutorial.py field_analysis.py cheatsheet.pdf
109- do
110- # Remove the hash string component added by GitHub to the link
111- # where the resources are hosted (GH changes it to something like
112- # '_downloads/4cd32e1c6bdf28fb61e15ffab2a8d84e/download_file')
113- sed -i " s/\(href=._downloads\).*\($download_file \)/\1\/\2/" \
114- $dir /tutorial.html \
115- $dir /analysis.html \
116- $dir /cheat_sheet.html
117- # all pages referencing these resources must be added to this list
118- done
119+ if [[ ! $is_recipes ]]; then
120+ echo " Processing download files."
121+ cp -pv source/sample_files/cf_tutorial_files.zip source/tutorial.py source/field_analysis.py $dir /_downloads
122+
123+ for download_file in cf_tutorial_files.zip tutorial.py field_analysis.py cheatsheet.pdf
124+ do
125+ # Remove the hash string component added by GitHub to the link
126+ # where the resources are hosted (GH changes it to something like
127+ # '_downloads/4cd32e1c6bdf28fb61e15ffab2a8d84e/download_file')
128+ sed -i " s/\(href=._downloads\).*\($download_file \)/\1\/\2/" \
129+ $dir /tutorial.html \
130+ $dir /analysis.html \
131+ $dir /cheat_sheet.html
132+ # all pages referencing these resources must be added to this list
133+ done
134+ fi
119135
120136# --------------------------------------------------------------------
121137# Process recipes
122138# --------------------------------------------------------------------
123- recipes_dir=" source/recipes"
124- recipes_files=( " ${recipes_dir} " /* _{recipe,helper}.{ipynb,py} )
125-
126- files_to_copy=(
127- " ${recipes_dir} /recipes_jupyter.zip"
128- " ${recipes_dir} /recipes_python.zip"
129- " ${recipes_files[@]} "
130- )
131-
132- destination_dir=" $dir /_downloads"
133-
134- cp -pv " ${files_to_copy[@]} " " $destination_dir "
135-
136- html_files=(
137- " $dir /recipes/index.html"
138- " $dir /recipes/" * .html
139- )
140-
141- for html_file in " ${html_files[@]} " ; do
142- for recipe_file in " ${files_to_copy[@]} " ; do
143- sed -i " s|href=\" .*\/${recipe_file##*/ } \" |href=\" ../_downloads/${recipe_file##*/ } \" |g" " $html_file "
144- done
145- done
146-
147- # Recipe filters
148- while IFS= read -r href; do
149- IFS= read -r div
150- awk -v href=" $href " -v div=" $div " '
151- {
152- if ($0 ~ href) {
153- gsub("<div class=\"sphx-glr-thumbcontainer\"[^>]*>", div, prev)
139+ if [[ $is_recipes ]]; then
140+ echo " Setting up for the recipes docs build."
141+ recipes_source=" source/recipes"
142+ recipes_files=( " ${recipes_source} " /* _{recipe,helper}.{ipynb,py} )
143+
144+ files_to_copy=(
145+ " ${recipes_source} /recipes_jupyter.zip"
146+ " ${recipes_source} /recipes_python.zip"
147+ " ${recipes_files[@]} "
148+ )
149+
150+ destination_dir=" $dir /_downloads"
151+
152+ cp -pv " ${files_to_copy[@]} " " $destination_dir "
153+
154+ html_files=(
155+ " $dir /recipes/index.html"
156+ " $dir /recipes/" * .html
157+ )
158+
159+ for html_file in " ${html_files[@]} " ; do
160+ for recipe_file in " ${files_to_copy[@]} " ; do
161+ sed -i " s|href=\" .*\/${recipe_file##*/ } \" |href=\" ../_downloads/${recipe_file##*/ } \" |g" " $html_file "
162+ done
163+ done
164+
165+ # Recipe filters
166+ while IFS= read -r href; do
167+ IFS= read -r div
168+ awk -v href=" $href " -v div=" $div " '
169+ {
170+ if ($0 ~ href) {
171+ gsub("<div class=\"sphx-glr-thumbcontainer\"[^>]*>", div, prev)
172+ }
173+ print prev
174+ prev = $0
154175 }
155- print prev
156- prev = $0
157- }
158- END {print prev}
159- ' $dir /recipes/index.html > temp && mv temp $dir /recipes/index.html
160- done < source/recipes/recipe_list.txt
161-
176+ END {print prev}
177+ ' $dir /recipes/index.html > temp && mv temp $dir /recipes/index.html
178+ done < source/recipes/recipe_list.txt
179+ fi
162180
163181# --------------------------------------------------------------------
164182# Process styles and templates
0 commit comments