From 70315f1f07fe669f4b78c5d73192234a90f55f47 Mon Sep 17 00:00:00 2001 From: david Date: Fri, 27 Jul 2018 15:25:06 +0200 Subject: FreeAMO: Evaluate and from the localization function --- subprojects/freeamo/src/main_functions | 44 ++++++++++++++++++++++++---------- subprojects/freeamo/src/make-wiki | 26 ++++++++++---------- 2 files changed, 44 insertions(+), 26 deletions(-) diff --git a/subprojects/freeamo/src/main_functions b/subprojects/freeamo/src/main_functions index 88de297..789b348 100644 --- a/subprojects/freeamo/src/main_functions +++ b/subprojects/freeamo/src/main_functions @@ -16,7 +16,7 @@ # along with this program. If not, see . function latest_debranded_trisquel_version { - + # All debranded programs starts with "i" so all of them are in Trisquels "/i/" directory wget -qO- "http://archive.trisquel.info/trisquel/pool/main/i/$debranded_package/?C=N;O=D" | sed "s|\"|\\n|g; s|-|\\n|g" | grep "$debranded_package"_ | head -n 1 | sed "s|"$debranded_package"_||" @@ -70,14 +70,6 @@ echo "####################" # Use the first avalible if English is not avaliable tmp=$(jq -r ".results[$entry].$locale_description[]" "$file" | head -n 1) || [[ $? == 141 ]] # jq causes superfluous 141 - -# David will work on this later -# if [ "$tmp" == "" ]; then -# -# # Some entries doesn't provide any `description` field but only a `summary` field. -# tmp=$(jq ".results[$entry].summary[]" "$file" | head -n 1 | sed "s|-|_|"); -# -#fi if [ "$tmp__en_US" != "null" ]; then @@ -92,7 +84,15 @@ echo "####################" elif [ "$locale_description" == "description" ]; then description="$tmp__en_US"; + + elif [ "$locale_description" == "homepage" ]; then + homepage="$tmp__en_US"; + + elif [ "$locale_description" == "support_url" ]; then + + support_url="$tmp__en_US"; + fi @@ -109,6 +109,14 @@ echo "####################" elif [ "$locale_description" == "description" ]; then description="$tmp__en_GB"; + + elif [ "$locale_description" == "homepage" ]; then + + homepage="$tmp__en_GB"; + + elif [ "$locale_description" == "support_url" ]; then + + support_url="$tmp__en_GB"; fi @@ -125,14 +133,26 @@ echo "####################" elif [ "$locale_description" == "description" ]; then description="$tmp"; + + elif [ "$locale_description" == "homepage" ]; then + + homepage="$tmp"; + + elif [ "$locale_description" == "support_url" ]; then + + support_url="$tmp"; fi fi - -echo "$name -.results[$entry].$locale_description[] $file" + # Use summary if description is not provided + if [ "$description" == "" ]; then + + description="$summary" + + fi + } # End locale code diff --git a/subprojects/freeamo/src/make-wiki b/subprojects/freeamo/src/make-wiki index 784a7a4..7114bb8 100644 --- a/subprojects/freeamo/src/make-wiki +++ b/subprojects/freeamo/src/make-wiki @@ -70,20 +70,18 @@ while IFS= read -r table; do elif [ "$license__amo_full_name" == "Mozilla Public License Version 1.1" ]; then license__fsd_short_name="MPLv1.1"; fi - # Start description code + # Start localization code source "$run_path/src/main_functions" - locale_description="summary" - do-locale - locale_description="description" - do-locale - short_description=$(echo "$summary" | format_description) - full_description=$(echo "$description" | format_description) + + locale_description="summary"; do-locale; short_description=$(echo "$summary" | format_description) + locale_description="description"; do-locale; full_description=$(echo "$description" | format_description) + locale_description="homepage"; do-locale + locale_description="support_url"; do-locale - # End description code + # End localization code # The homepage field is mandatory so let's remove "null" from it because we don't need to evaluat it - homepage_url=$(jq .results[$entry].homepage "$file" | sed "s|en-US|en_US|;" | jq -r .en_US | sed "s|null||"); license_copyright=$(jq -r .results[$entry].authors[].name "$file" ); bayesian_average=$(jq .results[$entry].ratings.bayesian_average "$file"); bayesian_average__simple=$(printf "%.1f" "${bayesian_average//./,}"); @@ -115,15 +113,15 @@ while IFS= read -r table; do - github_true=$(echo "$homepage_url" | grep "github.com") ||: # ok if grep fails + github_true=$(echo "$homepage" | grep "github.com") ||: # ok if grep fails if [[ $github_true != "" ]]; then # Always use https, and remove anchors - homepage_url__for__vcs_checkout_command="https://github.com$(echo "$github_true" | sed "s|https://github.com||; s|http://github.com||; s|#|\\n|;" | head -n 1)"; + homepage__for__vcs_checkout_command="https://github.com$(echo "$github_true" | sed "s|https://github.com||; s|http://github.com||; s|#|\\n|;" | head -n 1)"; # Remove trailing slash - homepage_url__for__vcs_checkout_command="${homepage_url__for__vcs_checkout_command%/}" - vcs_checkout_command="git clone $homepage_url__for__vcs_checkout_command.git"; + homepage__for__vcs_checkout_command="${homepage__for__vcs_checkout_command%/}" + vcs_checkout_command="git clone $homepage__for__vcs_checkout_command.git"; fi @@ -159,7 +157,7 @@ while IFS= read -r table; do echo "|Name=$name |Short description=$short_description |Full description=$full_description -|Homepage URL=$homepage_url +|Homepage URL=$homepage |Extension of=$extension_of |VCS checkout command=$vcs_checkout_command |Documentation note=Extra data (https://addons.mozilla.org/api/v$api_version/addons/addon/$slug/): -- cgit v1.2.3