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-wiki103
1 files changed, 68 insertions, 35 deletions
diff --git a/subprojects/freeamo/src/make-wiki b/subprojects/freeamo/src/make-wiki
index 19e782f..118f257 100644
--- a/subprojects/freeamo/src/make-wiki
+++ b/subprojects/freeamo/src/make-wiki
@@ -15,20 +15,23 @@
# 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"
+cd "build/json/search-pages" || exit
-echo -e "\\nGenerating .wiki files for https://directory.fsf.org/wiki/:"
+if [ "$minimum_average_daily_users" == "100000" ]; then
-echo "{| class=\"wikitable sortable\" border=\"1\" style=\"font-size:smaller\"
+ 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"
+! Updated
+! Featured" > "$run_path/build/IceCat WebExtensions - Most Users (proposed).wiki"
+fi
-pv__size=$(ls . | wc -l)
+
+pv__size=$(find . -not -name . | wc -l)
output_file="$output_file_2";
source "$run_path/src/main_functions"
@@ -38,8 +41,8 @@ while IFS= read -r table; do
if [ "$debug" = true ] && [ "$line" -le "3" ] || [ "$debug" = false ] ; then
- file=$(echo $table | awk '{print $1}');
- entry=$(echo $table | awk '{print $2}');
+ file=$(echo "$table" | awk '{print $1}');
+ entry=$(echo "$table" | awk '{print $2}');
source "$run_path/src/main_functions"
amo_variables
@@ -55,27 +58,35 @@ 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
+
source "$run_path/src/main_functions"
- full_description=$(jq .results[$entry].description $file | sed "s|en-US|enUS|;" | jq .enUS | sed "s|^\"||; s|\"$||;" | html_to_mediawiki)
- short_description=$(jq .results[$entry].summary $file | sed "s|en-US|enUS|;" | jq .enUS | sed "s|^\"||; s|\"$||;" | html_to_mediawiki)
+ locale_description="summary"
+ locale_description
+ locale_description="description"
+ locale_description
+ short_description=$(echo "$summary" | format_description)
+ full_description=$(echo "$description" | format_description)
+
+ # End description code
- homepage_url=$(jq .results[$entry].homepage $file | sed "s|en-US|enUS|;" | jq .enUS | sed "s|^\"||; s|\"$||;");
- version=$(jq .results[$entry].current_version.version $file | sed "s|^\"||; s|\"$||;");
- version_date=$(jq .results[$entry].last_updated $file | sed "s|^\"||; s|\"$||;" | sed "s|T|\n|" | head -n 1 | sed "s|-|/|g");
- version_id=$(jq .results[$entry].current_version.id $file);
- license_copyright=$(jq .results[$entry].authors[].name $file | sed "s|^\"||; s|\"$||;");
- bayesian_average=$(jq .results[$entry].ratings.bayesian_average $file);
- bayesian_average__simple=$(printf "%.1f" "$(echo "$bayesian_average" | sed "s|\.|,|")");
+ # 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|enUS|;" | jq .enUS | sed "s|^\"||; s|\"$||;" | sed "s|null||");
+ license_copyright=$(jq .results[$entry].authors[].name "$file" | sed "s|^\"||; s|\"$||;");
+ 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="wikisysbot";
- submitted_by="wikisysbot";
+ last_review_by="$mediawikibot__bot_password__Username";
+ submitted_by="$mediawikibot__bot_password__Username";
- if [[ "$(jq .results[$entry].current_version.compatibility.seamonkey $file)" != "null" ]]; then
+ 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
+ if [[ "$(jq .results[$entry].current_version.compatibility.firefox "$file")" != "null" ]]; then
set_icecat="IceCat,";
fi
@@ -83,7 +94,7 @@ while IFS= read -r table; do
# set_icecatmobile="IceCatMobile,";
# fi
- if [[ "$(jq .results[$entry].current_version.compatibility.thunderbird $file)" != "null" ]]; then
+ if [[ "$(jq .results[$entry].current_version.compatibility.thunderbird "$file")" != "null" ]]; then
set_thunderbird="Icedove,";
fi
@@ -97,7 +108,7 @@ while IFS= read -r table; do
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_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";
@@ -114,11 +125,12 @@ while IFS= read -r table; do
fi
- support_url=$(jq .results[$entry].support_url $file | sed "s|en-US|enUS|;" | jq .enUS | sed "s|^\"||; s|\"$||;");
+ support_url=$(jq .results[$entry].support_url "$file" | sed "s|en-US|enUS|;" | jq .enUS | sed "s|^\"||; s|\"$||;");
+ last_updated=$(jq .results[$entry].last_updated $file | sed "s|^\"||; s|\"$||;" | 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
+ 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:
@@ -126,20 +138,30 @@ while IFS= read -r table; do
# |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_url
|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=2018/06/20
+|Submitted date=
|Is GNU=$is_gnu
-}}" >> $run_path/build/wiki/$slug.wiki
+}}" >> "$run_path/build/wiki/$slug.wiki"
@@ -149,9 +171,9 @@ while IFS= read -r table; do
|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
+}}" >> "$run_path/build/wiki/$slug.wiki"
- if [[ "$support_url" != "" ]];
+ if [ "$support_url" != "null" ];
then
echo "{{Resource
@@ -162,19 +184,30 @@ at https://addons.mozilla.org/en-US/firefox/addon/adblock-plus/
fi
-
+ if [ "$minimum_average_daily_users" == "100000" ]; then
+
echo "|-
-| [[$name]]
+| [[$slug|$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"
+| $last_updated
+| $is_featured" >> "$run_path/build/IceCat WebExtensions - Most Users (proposed).wiki"
+
+ fi
+
+
fi
- echo "foo" # Must be here to work with pv
-done < "$output_file_2" | progress
+ echo "foo" # Must be here to work with pv
+done < "$output_file_2" | pv__progress
# End template
-echo "|}" >> "$run_path/build/wiki/IceCat WebExtensions (proposed).wiki"
+
+if [ "$minimum_average_daily_users" == "100000" ]; then
+
+ echo "|}" >> "$run_path/build/IceCat WebExtensions - Most Users (proposed).wiki"
+
+fi