aboutsummaryrefslogtreecommitdiff
path: root/subprojects/freeamo/src/make-wiki~
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/freeamo/src/make-wiki~')
-rw-r--r--subprojects/freeamo/src/make-wiki~196
1 files changed, 196 insertions, 0 deletions
diff --git a/subprojects/freeamo/src/make-wiki~ b/subprojects/freeamo/src/make-wiki~
new file mode 100644
index 0000000..d5aeb51
--- /dev/null
+++ b/subprojects/freeamo/src/make-wiki~
@@ -0,0 +1,196 @@
+#!/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 <http://www.gnu.org/licenses/>.
+
+cd "build/json/search-pages"
+
+echo -e "\\nGenerating .wiki files for https://directory.fsf.org/wiki/:"
+
+echo "{| class=\"wikitable sortable\" border=\"1\" style=\"font-size:smaller\"
+! WebExtension
+! Description
+! Claimed license
+! Users
+! Rating
+! Updated" > "$run_path/build/wiki/IceCat WebExtensions (proposed).wiki"
+
+
+pv__size=$(ls . | wc -l)
+output_file="$output_file_2";
+source "$run_path/src/main_functions"
+
+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__fsd_short_name="BSD 2Clause";
+ elif [ "$license__amo_full_name" == "GNU General Public License, version 3.0" ]; then license__fsd_short_name="GPLv3";
+ elif [ "$license__amo_full_name" == "GNU General Public License, version 2.0" ]; then license__fsd_short_name="GPLv2";
+ elif [ "$license__amo_full_name" == "GNU Lesser General Public License, version 3.0" ]; then license__fsd_short_name="LGPLv3";
+ elif [ "$license__amo_full_name" == "GNU Lesser General Public License, version 2.1" ]; then license__fsd_short_name="LGPLv2.1";
+ elif [ "$license__amo_full_name" == "MIT/X11 License" ]; then license__fsd_short_name="X11";
+ elif [ "$license__amo_full_name" == "Mozilla Public License, version 2.0" ]; then license__fsd_short_name="MPLv2.0";
+ elif [ "$license__amo_full_name" == "Mozilla Public License Version 1.1" ]; then license__fsd_short_name="MPLv1.1";
+ fi
+
+ short_description_raw=$(jq .results[$line].summary $file | sed "s|en-US|enUS|;" | jq .enUS | sed "s|^\"||; s|\"$||;" | sed "s|\\\n|\n|g; s|\\\||g;
+s|<a rel=\"nofollow\" href=\"|[|g; s|\">| |g; s|</a>|]|g; # URL issues
+s|http|\nhttp|g;
+");
+ short_description_again=$(echo "$short_description_raw" | sed "/outgoing.prod.mozaws.net/d;");
+
+ short_description=$(echo "$short_description_again" | sed ':a;N;$!ba;s/\nhttp/http/g');
+
+ full_description_raw=$(jq .results[$line].description $file | sed "s|en-US|enUS|;" | jq .enUS | sed "s|^\"||; s|\"$||;
+s|<a rel=\"nofollow\" href=\"|[|g; s|\">| |g; s|</a>|]|g; # URL issues
+");
+ full_description_again=$(echo "$full_description_raw" | sed "/outgoing.prod.mozaws.net/d;");
+
+ full_description=$(echo "$full_description_again" | sed ':a;N;$!ba;s/\nhttp/http/g');
+
+
+
+
+ homepage_url=$(jq .results[$line].homepage $file | sed "s|en-US|enUS|;" | jq .enUS | sed "s|^\"||; s|\"$||;");
+ version=$(jq .results[$line].current_version.version $file | sed "s|^\"||; s|\"$||;");
+ version_date=$(jq .results[$line].last_updated $file | sed "s|^\"||; s|\"$||;" | sed "s|T|\n|" | head -n 1 | sed "s|-|/|g");
+ version_id=$(jq .results[$line].current_version.id $file);
+ license_copyright=$(jq .results[$line].authors[].name $file | sed "s|^\"||; s|\"$||;");
+ bayesian_average=$(jq .results[$line].ratings.bayesian_average $file);
+ bayesian_average__simple=$(printf "%.1f" "$(echo "$bayesian_average" | sed "s|\.|,|")");
+
+ last_review_date=$(date +"%Y/%m/%d");
+ last_review_by="wikisysbot";
+ submitted_by="wikisysbot";
+
+ if [[ "$(jq .results[$line].current_version.compatibility.seamonkey $file)" != "null" ]]; then
+ set_seamonkey="Iceape,";
+ fi
+
+ if [[ "$(jq .results[$line].current_version.compatibility.firefox $file)" != "null" ]]; then
+ set_icecat="IceCat,";
+ fi
+
+ # if [[ "$(jq .results[$line].current_version.compatibility.android $file)" != "null" ]] || [[ "$(jq .results[$line].current_version.compatibility.mobile $file)" != "null" ]]; then
+ # set_icecatmobile="IceCatMobile,";
+ # fi
+
+ if [[ "$(jq .results[$line].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_url" | grep "github.com");
+
+ 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)";
+ # 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";
+
+ fi
+
+ if [ "$name" == "GNU LibreJS" ]; then
+
+ is_gnu="Yes";
+
+ else
+
+ is_gnu="No";
+
+ fi
+
+ support_url=$(jq .results[$line].support_url $file | sed "s|en-US|enUS|;" | jq .enUS | sed "s|^\"||; s|\"$||;");
+
+ # 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
+
+ # Dash have to be removed in jq 1.3: https://github.com/stedolan/jq/issues/341
+ # 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
+
+
+ echo "|Name=$name
+|Short description=$short_description
+|Full description=$full_description
+|Homepage URL=$homepage_url
+|Extension of=$extension_of
+|VCS checkout command=$vcs_checkout_command
+|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=2018/06/20
+|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__fsd_short_name
+|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" != "" ]];
+ then
+
+ echo "{{Resource
+|Resource audience=Users
+|Resource kind=Support
+|Resource URL=$support_url
+}}" >> "$run_path/build/wiki/$slug.wiki"
+
+ fi
+
+
+ echo "|-
+| [[$name]]
+| $short_description
+| [[License:$license__fsd_short_name|$license__fsd_short_name]]
+| $average_daily_users
+| $bayesian_average__simple
+| $version_date" >> "$run_path/build/wiki/IceCat WebExtensions (proposed).wiki"
+
+
+
+ fi
+
+ echo "foo" # Must be here to work with pv
+done < "$output_file_2" | progress
+# End template
+
+echo "|}" >> "$run_path/build/wiki/IceCat WebExtensions (proposed).wiki"