Add asterisk to supported extensions if they have special requirements

pull/135/head
Michele Locati 2020-03-03 14:25:20 +01:00
parent 237901a2c2
commit dbfc017114
No known key found for this signature in database
GPG Key ID: 98B7CE2E7234E28B
1 changed files with 13 additions and 3 deletions

View File

@ -87,6 +87,7 @@ sortVersionList() {
#
# Arguments:
# $1: the path to the data file
# $2: the path to the special requirements data file
#
# Output:
# the markdown table
@ -95,6 +96,11 @@ generateExtensionsTable() {
generateExtensionsTable_extensions="$(getExtensionList "$1")"
generateExtensionsTable_versions="$(getVersionList "$1")"
generateExtensionsTable_count=0
if test -f "$2"; then
generateExtensionsTable_specialReqExt=$(cat "$2" | cut -d' ' -f1)
else
generateExtensionsTable_specialReqExt=''
fi
printf '| Extension |'
IFS=' '
for generateExtensionsTable_version in $generateExtensionsTable_versions; do
@ -109,7 +115,11 @@ generateExtensionsTable() {
IFS=' '
for generateExtensionsTable_extension in $generateExtensionsTable_extensions; do
generateExtensionsTable_count=$((generateExtensionsTable_count + 1))
printf '| %s |' "$generateExtensionsTable_extension"
printf '| %s' "$generateExtensionsTable_extension"
if stringInList "$generateExtensionsTable_extension" "$generateExtensionsTable_specialReqExt"; then
printf '[*](#special-requirements-for-%s)' "$generateExtensionsTable_extension"
fi
printf ' |'
IFS=' '
for generateExtensionsTable_version in $generateExtensionsTable_versions; do
printf ' '
@ -178,7 +188,7 @@ generateSpecialRequirementsTable() {
printf '|---|---|\n'
generateSpecialRequirementsTable_started=1
fi
printf '| %s | %s |\n' "$generateSpecialRequirementsTable_extension" "$generateSpecialRequirementsTable_requirements"
printf '| <a name="special-requirements-for-%s"></a>%s | %s |\n' "$generateSpecialRequirementsTable_extension" "$generateSpecialRequirementsTable_extension" "$generateSpecialRequirementsTable_requirements"
fi
done
}
@ -214,7 +224,7 @@ generateReadme() {
printf '<!-- # EDIT THE data/supported-extensions FILE INSTEAD # -->\n'
printf '<!-- # # -->\n'
printf '<!-- ########################################################### -->\n'
generateExtensionsTable "$2"
generateExtensionsTable "$2" "$3"
elif test "$generateReadme_line" = "$generateReadme_ph_SpecialStart"; then
generateReadme_skip='y'
printf '<!-- ########################################################### -->\n'