82b12a5fae1c82dffe13401e09749849d116e724
lrnassar
  Fri Dec 5 17:27:44 2025 -0800
Making major changes to the markdown /docs/ directory since we are going to keep adding to it. Starting with adding more heirarchy, also had to update the makefile and staticPage.lua to reference the correct root path for the CSS. Also had to update all of the relative links in the pages so far in order to make them absolute paths for easier implementation. Lastly, adding the new hubBasics page which is the first in the new hubs subdir. Refs #28347

diff --git docs/makefile docs/makefile
index 99f4a068b63..5c657ce2bce 100644
--- docs/makefile
+++ docs/makefile
@@ -1,30 +1,42 @@
 kentSrc = ..
 include ../src/inc/common.mk
-
 rsyncOpts = --whole-file --times --recursive --omit-dir-times --cvs-exclude --exclude='makefile' --exclude='cpAndLinkToResourceFiles.pl' --exclude='style/*'
 
+# Find all .md files in tutorials/ and subdirectories
+DOCS := $(shell find . -name '*.md' -type f | sed 's|^\./||')
+
 user:
 	${MAKE} doInstall destDir=${DOCUMENTROOT}-${USER}
-
 alpha:
 	${MAKE} doInstall destDir=${DOCUMENTROOT}
-
 beta:
 	${MAKE} doInstall destDir=${DOCUMENTROOT}-beta
 	rsync ${rsyncOpts} ${DOCUMENTROOT}-beta/docs/ qateam@hgwbeta:${DOCUMENTROOT}/docs/
 
-DOCS = index gb101 gatewayTutorial page_template tableBrowserTutorial
-
-doInstall: ${DOCS:%=%_install}
-
-%_install: 
-	${MKDIR} ${destDir}/docs/
-	rm -f  ${destDir}/docs/$*.tmp.html
-	pandoc --ascii -f markdown-smart -t html5 -o ${destDir}/docs/$*.tmp.html $*.md --template staticPage.html -t staticPage.lua --lua-filter GBpandocHTMLrules.lua
-	mv -f  ${destDir}/docs/$*.tmp.html ${destDir}/docs/$*.html
-	chmod a+x ${destDir}/docs/$*.html
+doInstall: $(DOCS)
+	@for mdfile in $(DOCS); do \
+		htmlfile=$$(echo "$$mdfile" | sed 's|\.md$$|.html|'); \
+		dirpart=$$(dirname "$$htmlfile"); \
+		if [ "$$dirpart" = "." ]; then \
+			targetdir=${destDir}/docs; \
+			depth=1; \
+		else \
+			targetdir=${destDir}/docs/$$dirpart; \
+			depth=$$(echo "$$htmlfile" | tr -cd '/' | wc -c); \
+			depth=$$((depth + 1)); \
+		fi; \
+		rootpath=$$(printf '../%.0s' $$(seq 1 $$depth)); \
+		rootpath=$${rootpath%/}; \
+		mkdir -p "$$targetdir"; \
+		echo "Processing $$mdfile -> $$targetdir/$$(basename $$htmlfile) (ROOT=$$rootpath)"; \
+		rm -f "$$targetdir/$$(basename $$htmlfile).tmp"; \
+		pandoc --ascii -f markdown-smart -t html5 -o "$$targetdir/$$(basename $$htmlfile).tmp" "$$mdfile" --template staticPage.html -t staticPage.lua --lua-filter GBpandocHTMLrules.lua -V ROOT="$$rootpath"; \
+		mv -f "$$targetdir/$$(basename $$htmlfile).tmp" "$$targetdir/$$(basename $$htmlfile)"; \
+		chmod a+x "$$targetdir/$$(basename $$htmlfile)"; \
+	done
 
 testPandoc:
 	@printf "Test the following path and commands look ok\n"
-	@printf "pandoc path: %s\n" "`which pandoc`"
-	@printf "pandoc --ascii -f markdown-smart -t html5 index.md --template staticPage.html -t staticPage.lua\n" "${DOCUMENTROOT}/"
+	@printf "pandoc path: %s\n" "$$(which pandoc)"
+	@printf "Found markdown files:\n"
+	@for f in $(DOCS); do printf "  %s -> %s\n" "$$f" "$$(echo $$f | sed 's|\.md$$|.html|')"; done