@@ -4,17 +4,29 @@ PWD=$(pwd)
44FEATURES=" ${PWD} /features/"
55CATEGORIES=" ${PWD} /docs/modules/categories"
66VERSIONS=" ${PWD} /docs/modules/versions"
7+ PARTIALS=" ${PWD} /docs/modules/features/partials"
78GIT_COMMIT=" "
89
910echo " * xref:index.adoc[]" > " ${CATEGORIES} /nav.adoc"
1011echo " * xref:index.adoc[]" > " ${VERSIONS} /nav.adoc"
11- mkdir -p " ${PWD} /docs/modules/features/partials"
12+ rm -rf " ${PARTIALS} "
13+ mkdir -p " ${PARTIALS} "
1214
1315for FEATURE in $( find " ${FEATURES} " -name " *.adoc" -print)
1416do
1517 PAGE=$( basename " ${FEATURE} " )
1618 echo " ➡️ Processing ${PAGE} "
17- cp " ${FEATURE} " " ${PWD} /docs/modules/features/partials/${PAGE} "
19+ TARGET_PAGE=" ${PARTIALS} /${PAGE} "
20+
21+ # bail out if target page already exists
22+ if [ -f " ${TARGET_PAGE} " ];
23+ then
24+ echo " ${PAGE} is not unique. One of these must be renamed:"
25+ find " ${FEATURES} " -name " *.adoc" | grep " ${PAGE} "
26+ exit 1
27+ fi
28+
29+ cp " ${FEATURE} " " ${TARGET_PAGE} "
1830 DATABASE_CATEGORIES=$( grep " :database-category:" " ${FEATURES} /${PAGE} " )
1931 DATABASE_VERSION=$( grep " :database-version:" " ${FEATURES} /${PAGE} " | awk ' {print $2}' )
2032
3345 fi
3446
3547 # add category to list if not there already
36- CATEGORY_LISTED=$( grep " * xref:${DATABASE_CATEGORY} /index.adoc" " ${CATEGORIES} /pages/index.adoc" )
48+ CATEGORY_LISTED=$( grep " xref:${DATABASE_CATEGORY} /index.adoc" " ${CATEGORIES} /pages/index.adoc" )
3749 if [ -z " ${CATEGORY_LISTED} " ];
3850 then
3951 echo " * xref:${DATABASE_CATEGORY} /index.adoc[]" >> " ${CATEGORIES} /pages/index.adoc"
6375 fi
6476
6577 # add version to list if not there already
66- VERSION_LISTED=$( grep " * xref:${DATABASE_VERSION} /index.adoc" " ${VERSIONS} /pages/index.adoc" )
78+ VERSION_LISTED=$( grep " xref:${DATABASE_VERSION} /index.adoc" " ${VERSIONS} /pages/index.adoc" )
6779 if [ -z " ${VERSION_LISTED} " ];
6880 then
6981 echo " * xref:${DATABASE_VERSION} /index.adoc[]" >> " ${VERSIONS} /pages/index.adoc"
0 commit comments