From 3db93bc6f7b46bc322694e6658b8f559433a03c6 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 19 May 2022 22:23:10 +1000 Subject: Replacing the files with a haskell rewrite. --- subprojects/freeamo/src/make-wiki | 219 -------------------------------------- 1 file changed, 219 deletions(-) delete mode 100644 subprojects/freeamo/src/make-wiki (limited to 'subprojects/freeamo/src/make-wiki') diff --git a/subprojects/freeamo/src/make-wiki b/subprojects/freeamo/src/make-wiki deleted file mode 100644 index f1cb43f..0000000 --- a/subprojects/freeamo/src/make-wiki +++ /dev/null @@ -1,219 +0,0 @@ -#!/usr/bin/env bash -# This file is part of FreeAMO -# Copyright (C) 2018 David Hedlund -# -# FreeAMO is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# FreeAMO is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -cd "build/json/search-pages" || exit - -if [ "$minimum_average_daily_users" == "100000" ]; then - - echo "{| class=\"wikitable sortable\" border=\"1\" style=\"font-size:smaller\" -! WebExtension -! Description -! Claimed license -! Users -! Rating -! Updated -! Featured" > "$run_path/build/IceCat WebExtensions - Most Users (proposed).wiki" - -fi - -output_file="$output_file_2"; - -if [ "$debug" = true ]; then - - pv__size=$(cat "$output_file_2" | head -n 3 | wc -l) - -else - - pv__size=$(cat "$output_file_2" | wc -l) - -fi - -source "$run_path/src/main_functions" - -echo "Generate $pv__size .wiki pages." - -line=0 -while IFS= read -r table; do - - ((++line)) - - if [ "$debug" = true ] && [ "$line" -le "3" ] || [ "$debug" = false ] ; then - - file=$(echo "$table" | awk '{print $1}'); - entry=$(echo "$table" | awk '{print $2}'); - - source "$run_path/src/main_functions" - amo_variables - amo_variables__licenses - - if [ "$license__amo_full_name" == "BSD License" ]; then license__spdx_short_identifier="BSD-2-Clause"; - elif [ "$license__amo_full_name" == "GNU General Public License, version 3.0" ]; then license__spdx_short_identifier="GPL-3.0"; - elif [ "$license__amo_full_name" == "GNU General Public License, version 2.0" ]; then license__spdx_short_identifier="GPL-2.0"; - elif [ "$license__amo_full_name" == "GNU Lesser General Public License, version 3.0" ]; then license__spdx_short_identifier="LGPL-3.0"; - elif [ "$license__amo_full_name" == "GNU Lesser General Public License, version 2.1" ]; then license__spdx_short_identifier="LGPL-2.1"; - elif [ "$license__amo_full_name" == "MIT/X11 License" ]; then license__spdx_short_identifier="X11"; - elif [ "$license__amo_full_name" == "Mozilla Public License, version 2.0" ]; then license__spdx_short_identifier="MPL-2.0"; - elif [ "$license__amo_full_name" == "Mozilla Public License Version 1.1" ]; then license__spdx_short_identifier="MPL-1.1"; - fi - - # Start localization code - - source "$run_path/src/main_functions" - - 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 localization code - - # The homepage field is mandatory so let's remove "null" from it because we don't need to evaluat it - 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//./,}"); - - is_featured=$(jq .results[$entry].is_featured "$file"); - - last_review_date=$(date +"%Y/%m/%d"); - last_review_by="$mediawikibot__bot_password__Username"; - submitted_by="$mediawikibot__bot_password__Username"; - - if [[ "$(jq .results[$entry].current_version.compatibility.seamonkey "$file")" != "null" ]]; then - set_seamonkey="Iceape,"; - fi - - if [[ "$(jq .results[$entry].current_version.compatibility.firefox "$file")" != "null" ]]; then - set_icecat="IceCat,"; - fi - - # if [[ "$(jq .results[$entry].current_version.compatibility.android $file)" != "null" ]] || [[ "$(jq .results[$entry].current_version.compatibility.mobile $file)" != "null" ]]; then - # set_icecatmobile="IceCatMobile,"; - # fi - - if [[ "$(jq .results[$entry].current_version.compatibility.thunderbird "$file")" != "null" ]]; then - set_thunderbird="Icedove,"; - fi - - # Do not list IceCatMobile - extension_of=$(echo "$set_seamonkey$set_icecat$set_thunderbird" | sed "s|,$||;"); - - - - github_true=$(echo "$homepage" | grep "github.com") ||: # ok if grep fails - - if [[ $github_true != "" ]]; then - - # Always use https, and remove anchors - 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__for__vcs_checkout_command="${homepage__for__vcs_checkout_command%/}" - vcs_checkout_command="git clone $homepage__for__vcs_checkout_command.git"; - - fi - - if [ "$name" == "GNU LibreJS" ]; then - - is_gnu="Yes"; - - else - - is_gnu="No"; - - fi - - last_updated=$(jq -r .results[$entry].last_updated $file | sed "s|T|\n|" | head -n 1 | sed "s|-|/|g"); - - # List JSON structure: cat json/$file | js '.' - # XML value "homepage" is not always set in AMO API, but the XML require "Homepage URL" to be set: Therfore we use the AMO page itself in Homepage URL to complete the build of the repo automatically. - echo "{{Entry" > "$run_path/build/wiki/$slug.wiki" - - # Avoid specific versions since it's not compatible with all IceCat versions: - # |Version download=https://addons.mozilla.org/firefox/downloads/latest/$id/addon-$version_id-latest.xpi - # |Version identifier=$version - # |Version date=$version_date - - - # Do add these fields since we refer to the download page in the `|Version download` field that lists compatible versions - # |Version identifier=52.6.0 - # |Version date=2018/02/26 - # |Version status=stable - - echo "|Name=$name -|Short description=$short_description -|Full description=$full_description -|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/): -* Users: $average_daily_users -* Rating: $bayesian_average__simple -* Updated: $last_updated -* Featured: $is_featured -|Version download=https://addons.mozilla.org/en-US/firefox/addon/$slug/versions/ -|Last review by=$last_review_by -|Last review date=$last_review_date -|Submitted by=$submitted_by -|Submitted date= -|Is GNU=$is_gnu -}}" >> "$run_path/build/wiki/$slug.wiki" - - - - # https://addons.mozilla.org/api/v3/addons/addon/noscript/versions/1910123/ - echo "{{Project license -|License=$license__spdx_short_identifier -|License copyright=$license_copyright -|License note=\"License: $license__amo_full_name\" listed -at https://addons.mozilla.org/en-US/firefox/addon/adblock-plus/ -}}" >> "$run_path/build/wiki/$slug.wiki" - - if [ "$support_url" != "null" ]; - then - - echo "{{Resource -|Resource audience=Users -|Resource kind=Support -|Resource URL=$support_url -}}" >> "$run_path/build/wiki/$slug.wiki" - - fi - - if [ "$minimum_average_daily_users" == "100000" ]; then - - echo "|- -| [[$slug|$name]] -| $short_description -| [[License:$license__spdx_short_identifier|$license__spdx_short_identifier]] -| $average_daily_users -| $bayesian_average__simple -| $last_updated -| $is_featured" >> "$run_path/build/IceCat WebExtensions - Most Users (proposed).wiki" - - fi - - - - fi - - if ! $debug; then echo "foo"; fi # for pv -done < "$output_file_2" | pv__progress - -if [ "$minimum_average_daily_users" == "100000" ]; then - - echo "|}" >> "$run_path/build/IceCat WebExtensions - Most Users (proposed).wiki" - -fi -- cgit v1.2.3