]*>
/[highlight="lua"]/g' -e 's/<\/code><\/pre><\/div>/[\/highlight]\n/g' \
- -e 's//[code]/g' -e 's/<\/code><\/pre>/[\/code]\n/g' \
- -e 's//[font="monospace"]/g' -e 's/<\/code>/[\/font]/g' \
- -e 's/]*>/[url="\1"]/g' -e 's/<\/a>/\[\/url]/g' \
- -e 's/]*>/[img]\1[\/img]/g' \
- -e 's/
/_____________________________________________________________________________\n/g' \
- -e 's/<\/p>/\n/g' \
- -e '/^<[^>]\+>$/d' -e 's/<[^>]\+>//g' \
- -e 's/"/"/g' \
- -e 's/&/&/g' \
- -e 's/<//g' \
- -e "s/'/'/g" \
- | line_ending_filter > "$wowi_changelog"
- fi
-else
- if [ -n "$manual_changelog" ]; then
- echo "Warning! Could not find a manual changelog at $topdir/$changelog"
- manual_changelog=
- fi
- changelog="CHANGELOG.md"
- changelog_markup="markdown"
-
- if [ -n "$wowi_gen_changelog" ] && [ -z "$wowi_convert_changelog" ]; then
- wowi_markup="markdown"
- fi
-
- start_group "Generating changelog of commits into $changelog" "changelog"
-
- _changelog_range=
- if [ "$repository_type" = "git" ]; then
- changelog_url=
- changelog_version=
- changelog_previous="[Previous Releases](${project_github_url}/releases)"
- changelog_url_wowi=
- changelog_version_wowi=
- changelog_previous_wowi="[url=${project_github_url}/releases]Previous Releases[/url]"
- if [ -z "$previous_version" ] && [ -z "$tag" ]; then
- # no range, show all commits up to ours
- changelog_url="[Full Changelog](${project_github_url}/commits/${project_hash})"
- changelog_version="[${project_version}](${project_github_url}/tree/${project_hash})"
- changelog_url_wowi="[url=${project_github_url}/commits/${project_hash}]Full Changelog[/url]"
- changelog_version_wowi="[url=${project_github_url}/tree/${project_hash}]${project_version}[/url]"
- _changelog_range="$project_hash"
- elif [ -z "$previous_version" ] && [ -n "$tag" ]; then
- # first tag, show all commits upto it
- changelog_url="[Full Changelog](${project_github_url}/commits/${tag})"
- changelog_version="[${project_version}](${project_github_url}/tree/${tag})"
- changelog_url_wowi="[url=${project_github_url}/commits/${tag}]Full Changelog[/url]"
- changelog_version_wowi="[url=${project_github_url}/tree/${tag}]${project_version}[/url]"
- _changelog_range="$tag"
- elif [ -n "$previous_version" ] && [ -z "$tag" ]; then
- # compare between last tag and our commit
- changelog_url="[Full Changelog](${project_github_url}/compare/${previous_version}...${project_hash})"
- changelog_version="[$project_version](${project_github_url}/tree/${project_hash})"
- changelog_url_wowi="[url=${project_github_url}/compare/${previous_version}...${project_hash}]Full Changelog[/url]"
- changelog_version_wowi="[url=${project_github_url}/tree/${project_hash}]${project_version}[/url]"
- _changelog_range="$previous_version..$project_hash"
- elif [ -n "$previous_version" ] && [ -n "$tag" ]; then
- # compare between last tag and our tag
- changelog_url="[Full Changelog](${project_github_url}/compare/${previous_version}...${tag})"
- changelog_version="[$project_version](${project_github_url}/tree/${tag})"
- changelog_url_wowi="[url=${project_github_url}/compare/${previous_version}...${tag}]Full Changelog[/url]"
- changelog_version_wowi="[url=${project_github_url}/tree/${tag}]${project_version}[/url]"
- _changelog_range="$previous_version..$tag"
- fi
- # lazy way out
- if [ -z "$project_github_url" ]; then
- changelog_url=
- changelog_version=$project_version
- changelog_previous=
- changelog_url_wowi=
- changelog_version_wowi="[color=orange]${project_version}[/color]"
- changelog_previous_wowi=
- elif [ -z "$github_token" ]; then
- # not creating releases :(
- changelog_previous=
- changelog_previous_wowi=
- fi
- changelog_date=$( TZ='' printf "%(%Y-%m-%d)T" "$project_timestamp" )
-
- cat <<- EOF | line_ending_filter > "$pkgdir/$changelog"
- # $project
-
- ## $changelog_version ($changelog_date)
- $changelog_url $changelog_previous
-
- EOF
- git -C "$topdir" log "$_changelog_range" --pretty=format:"###%B" \
- | sed -e 's/^/ /g' -e 's/^ *$//g' -e 's/^ ###/- /g' -e 's/$/ /' \
- -e 's/\([a-zA-Z0-9]\)_\([a-zA-Z0-9]\)/\1\\_\2/g' \
- -e 's/\[ci skip\]//g' -e 's/\[skip ci\]//g' \
- -e '/git-svn-id:/d' -e '/^[[:space:]]*This reverts commit [0-9a-f]\{40\}\.[[:space:]]*$/d' \
- -e '/^[[:space:]]*$/d' \
- | line_ending_filter >> "$pkgdir/$changelog"
-
- # WoWI uses BBCode, generate something usable to post to the site
- # the file is deleted on successful upload
- if [ -n "$addonid" ] && [ -n "$tag" ] && [ -n "$wowi_gen_changelog" ] && [ "$wowi_markup" = "bbcode" ]; then
- wowi_changelog="$releasedir/WOWI-$project_version-CHANGELOG.txt"
- cat <<- EOF | line_ending_filter > "$wowi_changelog"
- [size=5]${project}[/size]
- [size=4]${changelog_version_wowi} (${changelog_date})[/size]
- ${changelog_url_wowi} ${changelog_previous_wowi}
- [list]
- EOF
- git -C "$topdir" log "$_changelog_range" --pretty=format:"###%B" \
- | sed -e 's/^/ /g' -e 's/^ *$//g' -e 's/^ ###/[*]/g' \
- -e 's/\[ci skip\]//g' -e 's/\[skip ci\]//g' \
- -e '/git-svn-id:/d' -e '/^[[:space:]]*This reverts commit [0-9a-f]\{40\}\.[[:space:]]*$/d' \
- -e '/^[[:space:]]*$/d' \
- | line_ending_filter >> "$wowi_changelog"
- echo "[/list]" | line_ending_filter >> "$wowi_changelog"
- fi
-
- elif [ "$repository_type" = "svn" ]; then
- if [ -n "$previous_revision" ]; then
- _changelog_range="-r$project_revision:$previous_revision"
- else
- _changelog_range="-rHEAD:1"
- fi
- changelog_date=$( TZ='' printf "%(%Y-%m-%d)T" "$project_timestamp" )
-
- cat <<- EOF | line_ending_filter > "$pkgdir/$changelog"
- # $project
-
- ## $project_version ($changelog_date)
-
- EOF
- svn log "$topdir" "$_changelog_range" --xml \
- | awk '//,/<\/msg>/' \
- | sed -e 's//###/g' -e 's/<\/msg>//g' \
- -e 's/^/ /g' -e 's/^ *$//g' -e 's/^ ###/- /g' -e 's/$/ /' \
- -e 's/\([a-zA-Z0-9]\)_\([a-zA-Z0-9]\)/\1\\_\2/g' \
- -e 's/\[ci skip\]//g' -e 's/\[skip ci\]//g' \
- -e '/^[[:space:]]*$/d' \
- | line_ending_filter >> "$pkgdir/$changelog"
-
- # WoWI uses BBCode, generate something usable to post to the site
- # the file is deleted on successful upload
- if [ -n "$addonid" ] && [ -n "$tag" ] && [ -n "$wowi_gen_changelog" ] && [ "$wowi_markup" = "bbcode" ]; then
- wowi_changelog="$releasedir/WOWI-$project_version-CHANGELOG.txt"
- cat <<- EOF | line_ending_filter > "$wowi_changelog"
- [size=5]${project}[/size]
- [size=4][color=orange]${project_version}[/color] (${changelog_date})[/size]
-
- [list]
- EOF
- svn log "$topdir" "$_changelog_range" --xml \
- | awk '//,/<\/msg>/' \
- | sed -e 's//###/g' -e 's/<\/msg>//g' \
- -e 's/^/ /g' -e 's/^ *$//g' -e 's/^ ###/[*]/g' \
- -e 's/\[ci skip\]//g' -e 's/\[skip ci\]//g' \
- -e '/^[[:space:]]*$/d' \
- | line_ending_filter >> "$wowi_changelog"
- echo "[/list]" | line_ending_filter >> "$wowi_changelog"
- fi
-
- elif [ "$repository_type" = "hg" ]; then
- if [ -n "$previous_revision" ]; then
- _changelog_range="::$project_revision - ::$previous_revision - filelog(.hgtags)"
- else
- _changelog_range="."
- fi
- changelog_date=$( TZ='' printf "%(%Y-%m-%d)T" "$project_timestamp" )
-
- cat <<- EOF | line_ending_filter > "$pkgdir/$changelog"
- # $project
-
- ## $project_version ($changelog_date)
-
- EOF
- hg --cwd "$topdir" log -r "$_changelog_range" --template '- {fill(desc|strip, 76, "", " ")}\n' | line_ending_filter >> "$pkgdir/$changelog"
-
- # WoWI uses BBCode, generate something usable to post to the site
- # the file is deleted on successful upload
- if [ -n "$addonid" ] && [ -n "$tag" ] && [ -n "$wowi_gen_changelog" ] && [ "$wowi_markup" = "bbcode" ]; then
- wowi_changelog="$releasedir/WOWI-$project_version-CHANGELOG.txt"
- cat <<- EOF | line_ending_filter > "$wowi_changelog"
- [size=5]${project}[/size]
- [size=4][color=orange]${project_version}[/color] (${changelog_date})[/size]
-
- [list]
- EOF
- hg --cwd "$topdir" log "$_changelog_range" --template '[*]{desc|strip|escape}\n' | line_ending_filter >> "$wowi_changelog"
- echo "[/list]" | line_ending_filter >> "$wowi_changelog"
- fi
- fi
-
- echo "$(<"$pkgdir/$changelog")"
- end_group "changelog"
-fi
-
-###
-### Process .pkgmeta to perform move-folders actions.
-###
-
-if [ -f "$pkgmeta_file" ]; then
- yaml_eof=
- while [ -z "$yaml_eof" ]; do
- IFS='' read -r yaml_line || yaml_eof="true"
- # Skip commented out lines.
- if [[ $yaml_line =~ ^[[:space:]]*\# ]]; then
- continue
- fi
- # Strip any trailing CR character.
- yaml_line=${yaml_line%$carriage_return}
-
- case $yaml_line in
- [!\ ]*:*)
- # Split $yaml_line into a $yaml_key, $yaml_value pair.
- yaml_keyvalue "$yaml_line"
- # Set the $pkgmeta_phase for stateful processing.
- pkgmeta_phase=$yaml_key
- ;;
- " "*)
- yaml_line=${yaml_line#"${yaml_line%%[! ]*}"} # trim leading whitespace
- case $yaml_line in
- "- "*)
- ;;
- *:*)
- # Split $yaml_line into a $yaml_key, $yaml_value pair.
- yaml_keyvalue "$yaml_line"
- case $pkgmeta_phase in
- move-folders)
- srcdir="$releasedir/$yaml_key"
- destdir="$releasedir/$yaml_value"
- if [[ -d "$destdir" && -z "$overwrite" && "$srcdir" != "$destdir/"* ]]; then
- rm -fr "$destdir"
- fi
- if [ -d "$srcdir" ]; then
- if [ ! -d "$destdir" ]; then
- mkdir -p "$destdir"
- fi
- echo "Moving $yaml_key to $yaml_value"
- mv -f "$srcdir"/* "$destdir" && rm -fr "$srcdir"
- contents="$contents $yaml_value"
- # Check to see if the base source directory is empty
- _mf_basedir=${srcdir%$(basename "$yaml_key")}
- if [ ! "$( ls -A "$_mf_basedir" )" ]; then
- echo "Removing empty directory ${_mf_basedir#$releasedir/}"
- rm -fr "$_mf_basedir"
- fi
- fi
- # update external dir
- nolib_exclude=${nolib_exclude//$srcdir/$destdir}
- ;;
- esac
- ;;
- esac
- ;;
- esac
- done < "$pkgmeta_file"
- if [ -n "$srcdir" ]; then
- echo
- fi
-fi
-
-###
-### Create the final zipfile for the addon.
-###
-
-if [ -z "$skip_zipfile" ]; then
- archive_version="$project_version"
- archive_name="$( filename_filter "$file_name" ).zip"
- archive_label="$archive_version"
- if [[ "${file_name}" == *"{game-type}"* ]] || [[ "$game_type" != "retail" && "${file_name}" == *"{classic}"* ]]; then
- # append the game-type for clarity
- archive_label="$archive_version-$game_type"
- if [[ "$game_type" == "classic" && "${project_version,,}" == *"-classic"* ]] || [[ "$game_type" == "bcc" && "${project_version,,}" == *"-bcc"* ]]; then
- # this is mostly for BigWigs projects that tag classic separately (eg, v10-classic)
- # to prevent the extra -classic without changing all our workflows
- archive_label="$archive_version"
- fi
- fi
- archive="$releasedir/$archive_name"
-
- if [ -n "$GITHUB_ACTIONS" ]; then
- echo "::set-output name=archive_path::${archive}"
- fi
-
- nolib_archive_version="${project_version}-nolib"
- nolib_archive_name="$( nolib=true filename_filter "$file_name" ).zip"
- if [ "$archive_name" = "$nolib_archive_name" ]; then
- # someone didn't include {nolib} and they're forcing nolib creation
- nolib_archive_name="${nolib_archive_name#.zip}-nolib.zip"
- fi
- nolib_archive_label="${archive_label}-nolib"
- nolib_archive="$releasedir/$nolib_archive_name"
-
- if [ -n "$nolib" ]; then
- archive_version="$nolib_archive_version"
- archive_name="$nolib_archive_name"
- archive_label="$nolib_archive_label"
- archive="$nolib_archive"
- nolib_archive=
- fi
-
- start_group "Creating archive: $archive_name" "archive"
- if [ -f "$archive" ]; then
- rm -f "$archive"
- fi
- #( cd "$releasedir" && zip -X -r "$archive" $contents )
- ( cd "$releasedir" && 7z a -bso0 -sns- -r "$archive" $contents )
-
- if [ ! -f "$archive" ]; then
- exit 1
- fi
- end_group "archive"
-
- # Create nolib version of the zipfile
- if [ -n "$enable_nolib_creation" ] && [ -z "$nolib" ] && [ -n "$nolib_exclude" ]; then
- # run the nolib_filter
- find "$pkgdir" -type f \( -name "*.xml" -o -name "*.toc" \) -print | while read -r file; do
- case $file in
- *.toc) _filter="toc_filter no-lib-strip true" ;;
- *.xml) _filter="xml_filter no-lib-strip" ;;
- esac
- $_filter < "$file" > "$file.tmp" && mv "$file.tmp" "$file"
- done
-
- # make the exclude paths relative to the release directory
- nolib_exclude=${nolib_exclude//$releasedir\//}
-
- start_group "Creating no-lib archive: $nolib_archive_name" "archive.nolib"
- if [ -f "$nolib_archive" ]; then
- rm -f "$nolib_archive"
- fi
- # set noglob so each nolib_exclude path gets quoted instead of expanded
- ( set -f; cd "$releasedir" && zip -X -r -q "$nolib_archive" $contents -x $nolib_exclude )
-
- if [ ! -f "$nolib_archive" ]; then
- exit_code=1
- fi
- end_group "archive.nolib"
- fi
-
- ###
- ### Deploy the zipfile.
- ###
-
- upload_curseforge=$( [[ -z "$skip_upload" && -z "$skip_cf_upload" && -n "$slug" && -n "$cf_token" && -n "$project_site" ]] && echo true )
- upload_wowinterface=$( [[ -z "$skip_upload" && -n "$tag" && -n "$addonid" && -n "$wowi_token" ]] && echo true )
- upload_wago=$( [[ -z "$skip_upload" && -n "$wagoid" && -n "$wago_token" ]] && echo true )
- upload_github=$( [[ -z "$skip_upload" && -n "$tag" && -n "$project_github_slug" && -n "$github_token" ]] && echo true )
-
- if [[ -n "$upload_curseforge" || -n "$upload_wowinterface" || -n "$upload_github" || -n "$upload_wago" ]] && ! hash jq &>/dev/null; then
- echo "Skipping upload because \"jq\" was not found."
- echo
- upload_curseforge=
- upload_wowinterface=
- upload_wago=
- upload_github=
- exit_code=1
- fi
-
- if [ -n "$upload_curseforge" ]; then
- _cf_versions=$( curl -s -H "x-api-token: $cf_token" $project_site/api/game/versions )
- if [ -n "$_cf_versions" ]; then
- _cf_game_version="$game_version"
- if [ -n "$_cf_game_version" ]; then
- _cf_game_version_id=$( echo "$_cf_versions" | jq -c --argjson v "[\"${game_version//,/\",\"}\"]" 'map(select(.name as $x | $v | index($x)) | .id) | select(length > 0)' 2>/dev/null )
- if [ -n "$_cf_game_version_id" ]; then
- # and now the reverse, since an invalid version will just be dropped
- _cf_game_version=$( echo "$_cf_versions" | jq -r --argjson v "$_cf_game_version_id" 'map(select(.id as $x | $v | index($x)) | .name) | join(",")' 2>/dev/null )
- fi
- fi
- if [ -z "$_cf_game_version_id" ]; then
- case $game_type in
- retail) _cf_game_type_id=517 ;;
- classic) _cf_game_type_id=67408 ;;
- bcc) _cf_game_type_id=73246 ;;
- esac
- _cf_game_version_id=$( echo "$_cf_versions" | jq -c --argjson v "$_cf_game_type_id" 'map(select(.gameVersionTypeID == $v)) | max_by(.id) | [.id]' 2>/dev/null )
- _cf_game_version=$( echo "$_cf_versions" | jq -r --argjson v "$_cf_game_type_id" 'map(select(.gameVersionTypeID == $v)) | max_by(.id) | .name' 2>/dev/null )
- fi
- fi
- if [ -z "$_cf_game_version_id" ]; then
- echo "Error fetching game version info from $project_site/api/game/versions"
- echo
- echo "Skipping upload to CurseForge."
- echo
- upload_curseforge=
- exit_code=1
- fi
- fi
-
- # Upload to CurseForge.
- if [ -n "$upload_curseforge" ]; then
- _cf_payload=$( cat <<-EOF
- {
- "displayName": "$archive_label",
- "gameVersions": $_cf_game_version_id,
- "releaseType": "$file_type",
- "changelog": $( jq --slurp --raw-input '.' < "$pkgdir/$changelog" ),
- "changelogType": "$changelog_markup"
- }
- EOF
- )
- _cf_payload_relations=
- for i in "${!relations[@]}"; do
- _cf_payload_relations="$_cf_payload_relations{\"slug\":\"$i\",\"type\":\"${relations[$i]}\"},"
- done
- if [[ -n $_cf_payload_relations ]]; then
- _cf_payload_relations="{\"relations\":{\"projects\":[${_cf_payload_relations%,}]}}"
- _cf_payload=$( echo "$_cf_payload $_cf_payload_relations" | jq -s -c '.[0] * .[1]' )
- fi
-
- echo "Uploading $archive_name ($_cf_game_version $file_type) to $project_site/projects/$slug"
- resultfile="$releasedir/cf_result.json"
- result=$( echo "$_cf_payload" | curl -sS --retry 3 --retry-delay 10 \
- -w "%{http_code}" -o "$resultfile" \
- -H "x-api-token: $cf_token" \
- -F "metadata=<-" \
- -F "file=@$archive" \
- "$project_site/api/projects/$slug/upload-file"
- ) && {
- case $result in
- 200) echo "Success!" ;;
- 302)
- echo "Error! ($result)"
- # don't need to ouput the redirect page
- exit_code=1
- ;;
- 404)
- echo "Error! No project for \"$slug\" found."
- exit_code=1
- ;;
- *)
- echo "Error! ($result)"
- if [ -s "$resultfile" ]; then
- echo "$(<"$resultfile")"
- fi
- exit_code=1
- ;;
- esac
- } || {
- exit_code=1
- }
- echo
-
- rm -f "$resultfile" 2>/dev/null
- fi
-
- if [ -n "$upload_wowinterface" ]; then
- _wowi_game_version=
- _wowi_versions=$( curl -s -H "x-api-token: $wowi_token" https://api.wowinterface.com/addons/compatible.json )
- if [ -n "$_wowi_versions" ]; then
- # Multiple versions, match on game version
- if [[ "$game_version" == *","* ]]; then
- _wowi_game_version=$( echo "$_wowi_versions" | jq -r --argjson v "[\"${game_version//,/\",\"}\"]" 'map(select(.id as $x | $v | index($x)) | .id) | join(",")' 2>/dev/null )
- fi
- # TOC matching
- if [ -z "$_wowi_game_version" ]; then
- _wowi_game_version=$( echo "$_wowi_versions" | jq -r --arg toc "$toc_version" '.[] | select(.interface == $toc and .default == true) | .id' 2>/dev/null )
- fi
- if [ -z "$_wowi_game_version" ]; then
- _wowi_game_version=$( echo "$_wowi_versions" | jq -r --arg toc "$toc_version" 'map(select(.interface == $toc))[0] | .id // empty' 2>/dev/null )
- fi
- # Handle delayed support (probably don't really need this anymore)
- if [ -z "$_wowi_game_version" ] && [ "$game_type" != "retail" ]; then
- _wowi_game_version=$( echo "$_wowi_versions" | jq -r --arg toc $((toc_version - 1)) '.[] | select(.interface == $toc) | .id' 2>/dev/null )
- fi
- if [ -z "$_wowi_game_version" ]; then
- _wowi_game_version=$( echo "$_wowi_versions" | jq -r '.[] | select(.default == true) | .id' 2>/dev/null )
- fi
- fi
- if [ -z "$_wowi_game_version" ]; then
- echo "Error fetching game version info from https://api.wowinterface.com/addons/compatible.json"
- echo
- echo "Skipping upload to WoWInterface."
- echo
- upload_wowinterface=
- exit_code=1
- fi
- fi
-
- # Upload tags to WoWInterface.
- if [ -n "$upload_wowinterface" ]; then
- _wowi_args=()
- if [ -f "$wowi_changelog" ]; then
- _wowi_args+=("-F changelog=<$wowi_changelog")
- elif [ -n "$manual_changelog" ] || [ "$wowi_markup" = "markdown" ]; then
- _wowi_args+=("-F changelog=<$pkgdir/$changelog")
- fi
- if [ -z "$wowi_archive" ]; then
- _wowi_args+=("-F archive=No")
- fi
-
- echo "Uploading $archive_name ($_wowi_game_version) to https://www.wowinterface.com/downloads/info$addonid"
- resultfile="$releasedir/wi_result.json"
- result=$( curl -sS --retry 3 --retry-delay 10 \
- -w "%{http_code}" -o "$resultfile" \
- -H "x-api-token: $wowi_token" \
- -F "id=$addonid" \
- -F "version=$archive_version" \
- -F "compatible=$_wowi_game_version" \
- "${_wowi_args[@]}" \
- -F "updatefile=@$archive" \
- "https://api.wowinterface.com/addons/update"
- ) && {
- case $result in
- 202)
- echo "Success!"
- if [ -f "$wowi_changelog" ]; then
- rm -f "$wowi_changelog" 2>/dev/null
- fi
- ;;
- 401)
- echo "Error! No addon for id \"$addonid\" found or you do not have permission to upload files."
- exit_code=1
- ;;
- 403)
- echo "Error! Incorrect api key or you do not have permission to upload files."
- exit_code=1
- ;;
- *)
- echo "Error! ($result)"
- if [ -s "$resultfile" ]; then
- echo "$(<"$resultfile")"
- fi
- exit_code=1
- ;;
- esac
- } || {
- exit_code=1
- }
- echo
-
- rm -f "$resultfile" 2>/dev/null
- fi
-
- # Upload to Wago
- if [ -n "$upload_wago" ] ; then
- _wago_support_property=""
- for type in "${!game_versions[@]}"; do
- if [[ "$type" == "bcc" ]]; then
- _wago_support_property+="\"supported_bc_patch\": \"${game_versions[$type]}\", "
- else
- _wago_support_property+="\"supported_${type}_patch\": \"${game_versions[$type]}\", "
- fi
- done
-
- _wago_stability="$file_type"
- if [ "$file_type" = "release" ]; then
- _wago_stability="stable"
- fi
-
- _wago_payload=$( cat <<-EOF
- {
- "label": "$archive_label",
- $_wago_support_property
- "stability": "$_wago_stability",
- "changelog": $( jq --slurp --raw-input '.' < "$pkgdir/$changelog" )
- }
- EOF
- )
-
- echo "Uploading $archive_name ($game_version $file_type) to Wago"
- resultfile="$releasedir/wago_result.json"
- result=$( echo "$_wago_payload" | curl -sS --retry 3 --retry-delay 10 \
- -w "%{http_code}" -o "$resultfile" \
- -H "authorization: Bearer $wago_token" \
- -H "accept: application/json" \
- -F "metadata=<-" \
- -F "file=@$archive" \
- "https://addons.wago.io/api/projects/$wagoid/version"
- ) && {
- case $result in
- 200|201) echo "Success!" ;;
- 302)
- echo "Error! ($result)"
- # don't need to ouput the redirect page
- exit_code=1
- ;;
- 404)
- echo "Error! No Wago project for id \"$wagoid\" found."
- exit_code=1
- ;;
- *)
- echo "Error! ($result)"
- if [ -s "$resultfile" ]; then
- echo "$(<"$resultfile")"
- fi
- exit_code=1
- ;;
- esac
- } || {
- exit_code=1
- }
- echo
-
- rm -f "$resultfile" 2>/dev/null
- fi
-
- # Create a GitHub Release for tags and upload the zipfile as an asset.
- if [ -n "$upload_github" ]; then
- upload_github_asset() {
- _ghf_release_id=$1
- _ghf_file_name=$2
- _ghf_file_path=$3
- _ghf_resultfile="$releasedir/gh_asset_result.json"
- _ghf_content_type="application/${_ghf_file_name##*.}" # zip or json
-
- # check if an asset exists and delete it (editing a release)
- asset_id=$( curl -sS \
- -H "Accept: application/vnd.github.v3+json" \
- -H "Authorization: token $github_token" \
- "https://api.github.com/repos/$project_github_slug/releases/$_ghf_release_id/assets" \
- | jq --arg file "$_ghf_file_name" '.[] | select(.name? == $file) | .id'
- )
- if [ -n "$asset_id" ]; then
- curl -s \
- -X DELETE \
- -H "Accept: application/vnd.github.v3+json" \
- -H "Authorization: token $github_token" \
- "https://api.github.com/repos/$project_github_slug/releases/assets/$asset_id" &>/dev/null
- fi
-
- echo -n "Uploading $_ghf_file_name... "
- result=$( curl -sS --retry 3 --retry-delay 10 \
- -w "%{http_code}" -o "$_ghf_resultfile" \
- -H "Accept: application/vnd.github.v3+json" \
- -H "Authorization: token $github_token" \
- -H "Content-Type: $_ghf_content_type" \
- --data-binary "@$_ghf_file_path" \
- "https://uploads.github.com/repos/$project_github_slug/releases/$_ghf_release_id/assets?name=$_ghf_file_name"
- ) && {
- if [ "$result" = "201" ]; then
- echo "Success!"
- else
- echo "Error ($result)"
- if [ -s "$_ghf_resultfile" ]; then
- echo "$(<"$_ghf_resultfile")"
- fi
- exit_code=1
- fi
- } || {
- exit_code=1
- }
-
- rm -f "$_ghf_resultfile" 2>/dev/null
- return 0
- }
-
- _gh_metadata='{ "filename": "'"$archive_name"'", "nolib": false, "metadata": ['
- for type in "${!game_versions[@]}"; do
- _gh_metadata+='{ "flavor": "'"${game_flavors[$type]}"'", "interface": '"$toc_version"' },'
- done
- _gh_metadata=${_gh_metadata%,}
- _gh_metadata+='] }'
- if [ -f "$nolib_archive" ]; then
- _gh_metadata+=',{ "filename": "'"$nolib_archive_name"'", "nolib": true, "metadata": ['
- for type in "${!game_versions[@]}"; do
- _gh_metadata+='{ "flavor": "'"${game_flavors[$type]}"'", "interface": '"$toc_version"' },'
- done
- _gh_metadata=${_gh_metadata%,}
- _gh_metadata+='] }'
- fi
- _gh_metadata='{ "releases": ['"$_gh_metadata"'] }'
-
- versionfile="$releasedir/release.json"
- jq -c '.' <<< "$_gh_metadata" > "$versionfile" || echo "There was an error creating release.json" >&2
-
- _gh_payload=$( cat <<-EOF
- {
- "tag_name": "$tag",
- "name": "$tag",
- "body": $( jq --slurp --raw-input '.' < "$pkgdir/$changelog" ),
- "draft": false,
- "prerelease": $( [[ "$file_type" != "release" ]] && echo true || echo false )
- }
- EOF
- )
- resultfile="$releasedir/gh_result.json"
-
- release_id=$( curl -sS \
- -H "Accept: application/vnd.github.v3+json" \
- -H "Authorization: token $github_token" \
- "https://api.github.com/repos/$project_github_slug/releases/tags/$tag" \
- | jq '.id // empty'
- )
- if [ -n "$release_id" ]; then
- echo "Updating GitHub release: https://github.com/$project_github_slug/releases/tag/$tag"
- _gh_release_url="-X PATCH https://api.github.com/repos/$project_github_slug/releases/$release_id"
-
- # combine version info
- _gh_metadata_url=$( curl -sS \
- -H "Accept: application/vnd.github.v3+json" \
- -H "Authorization: token $github_token" \
- "https://api.github.com/repos/$project_github_slug/releases/$release_id/assets" \
- | jq -r '.[] | select(.name? == "release.json") | .url // empty'
- )
- if [ -n "$_gh_metadata_url" ]; then
- _gh_previous_metadata=$( curl -sSL --fail \
- -H "Accept: application/octet-stream" \
- -H "Authorization: token $github_token" \
- "$_gh_metadata_url"
- ) && {
- jq -sc '.[0].releases + .[1].releases | unique_by(.filename) | { releases: [.[]] }' <<< "${_gh_previous_metadata} ${_gh_metadata}" > "$versionfile"
- } || {
- echo "Warning: Unable to update release.json ($?)"
- }
- fi
- else
- echo "Creating GitHub release: https://github.com/$project_github_slug/releases/tag/$tag"
- _gh_release_url="https://api.github.com/repos/$project_github_slug/releases"
- fi
- result=$( echo "$_gh_payload" | curl -sS --retry 3 --retry-delay 10 \
- -w "%{http_code}" -o "$resultfile" \
- -H "Accept: application/vnd.github.v3+json" \
- -H "Authorization: token $github_token" \
- -d @- \
- $_gh_release_url
- ) && {
- if [ "$result" = "200" ] || [ "$result" = "201" ]; then # edited || created
- if [ -z "$release_id" ]; then
- release_id=$( jq '.id' < "$resultfile" )
- fi
- upload_github_asset "$release_id" "$archive_name" "$archive"
- if [ -f "$nolib_archive" ]; then
- upload_github_asset "$release_id" "$nolib_archive_name" "$nolib_archive"
- fi
- if [ -s "$versionfile" ]; then
- upload_github_asset "$release_id" "release.json" "$versionfile"
- fi
- else
- echo "Error! ($result)"
- if [ -s "$resultfile" ]; then
- echo "$(<"$resultfile")"
- fi
- exit_code=1
- fi
- } || {
- exit_code=1
- }
-
- rm -f "$resultfile" 2>/dev/null
- [ -z "$CI" ] && rm -f "$versionfile" 2>/dev/null
- echo
- fi
-fi
-
-# All done.
-
-echo
-echo "Packaging complete."
-echo
-
-exit $exit_code
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9c0ff52..943f3c0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## Version 1.1.4 - 2022-09-28
+### Changed
+- typos in descriptions
+- ambiguous variable definitions
+- bumped version for all versions of WoW (Classic Era, WotLK, Retail)
+
## Version 1.1.3 - 2021-10-06
### Changed
- bumped version for all versions of WoW (Classic Era, Season of Mastery, BCC, Retail)
@@ -131,7 +137,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Version 0.3.0 - 2020-05-27
### Fixed
-- fixed DB storange and debug printing
+- fixed DB storage and debug printing
## Version 0.2.2 (unreleased) - 2020-05-26
### Added
diff --git a/Grichelde.toc b/Grichelde.toc
index 481631e..144a02b 100644
--- a/Grichelde.toc
+++ b/Grichelde.toc
@@ -1,37 +1,16 @@
-## Interface: 11401
-## Interface-Classic: 11401
-## Interface-BCC: 20502
-## Interface-Retail: 90100
+## Interface: 90207
## Title: Grichelde
## Notes: Replaces characters of your chat input line before sending.
## Notes-de: Ersetzt eingegebene Zeichen in der Chat-Zeile vor dem Versenden.
-#@debug@
-## Version: 1.1.3
-#@end-debug@
-#@non-debug@
-# ## Version: @project-version@
-#@end-non-debug@
+## Version: 1.1.4
## Author: Teilzeit-Jedi
## eMail: tj@teilzeit-jedi.de
-#@version-classic@
-## X-Build: Classic
-## X-Compatible: 20502
-## X-Compatible: 90100
-#@end-version-classic@
-#@non-version-classic@
-#@version-bcc@
-# ## X-Build: BCC
-# ## X-Compatible: 11401
-# ## X-Compatible: 90100
-#@end-version-bcc@
-#@version-retail@
-# ## X-Build: Retail
-# ## X-Compatible: 11401
-# ## X-Compatible: 20502
-#@end-version-retail@
-#@end-non-version-classic@
+## X-Build: Retail
+## X-Compatible: 11403
+## X-Compatible: 20504
+## X-Compatible: 30400
## X-Curse-Project-ID: 385480
## X-License: GPLv3
@@ -42,7 +21,6 @@
## OptionalDeps: LibStub, CallbackHandler, Ace3, LibDataBroker, LibDBIcon
## SavedVariables: GricheldeDB
-#@no-lib-strip@
Libs\LibStub\LibStub.lua
Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml
Libs\AceAddon-3.0\AceAddon-3.0.xml
@@ -56,7 +34,6 @@ Libs\AceGUI-3.0\AceGUI-3.0.xml
Libs\AceConfig-3.0\AceConfig-3.0.xml
Libs\LibDataBroker-1.1\LibDataBroker-1.1.lua
Libs\LibDBIcon-1.0\LibDBIcon-1.0.lua
-#@end-no-lib-strip@
Grichelde.lua
GricheldeConstants.lua
@@ -69,7 +46,3 @@ GricheldeUpgrade.lua
GricheldeOptions.lua
GricheldeMinimap.lua
GricheldeChat.lua
-
-#@do-not-package@
-GricheldeTest.lua
-#@end-do-not-package@
\ No newline at end of file
diff --git a/GricheldeChat.lua b/GricheldeChat.lua
index ef2c482..2ce9ccb 100644
--- a/GricheldeChat.lua
+++ b/GricheldeChat.lua
@@ -2,9 +2,9 @@
local _G = _G
local Grichelde = _G.Grichelde or {}
-local IsAddOnLoaded, assert, nilOrEmpty, pairs, ipairs, spairs, tContains, tFilter, tInsert, tConcat, tSize, tIsEmpty, find, sub, gsub, gmatch, getNextCharUtf8, isLetter, isUpper, isLower, toUpper, toLower, capitalize, bytes2Char, trim, length, lengthUtf8
- = Grichelde.F.IsAddOnLoaded, Grichelde.F.assert, Grichelde.F.nilOrEmpty, Grichelde.F.pairs, Grichelde.F.ipairs, Grichelde.F.spairs, Grichelde.F.tContains, Grichelde.F.tFilter, Grichelde.F.tInsert, Grichelde.F.tConcat, Grichelde.F.tSize, Grichelde.F.tIsEmpty,
- Grichelde.F.find, Grichelde.F.sub, Grichelde.F.gsub, Grichelde.F.gmatch, Grichelde.F.getNextCharUtf8, Grichelde.F.isLetter, Grichelde.F.isUpper, Grichelde.F.isLower, Grichelde.F.toUpper, Grichelde.F.toLower, Grichelde.F.capitalize, Grichelde.F.bytes2Char, Grichelde.F.trim, Grichelde.F.length, Grichelde.F.lengthUtf8
+local IsAddOnLoaded, assert, nilOrEmpty, pairs, ipairs, spairs, tContains, tFilter, tInsert, tIsEmpty, find, sub, gsub, getNextCharUtf8, isUtf8MultiByte, getUtf8Sequence, isUpper, isLower, toUpper, toLower, bytes2Char, trim, length, lengthUtf8
+ = Grichelde.F.IsAddOnLoaded, Grichelde.F.assert, Grichelde.F.nilOrEmpty, Grichelde.F.pairs, Grichelde.F.ipairs, Grichelde.F.spairs, Grichelde.F.tContains, Grichelde.F.tFilter, Grichelde.F.tInsert, Grichelde.F.tIsEmpty,
+ Grichelde.F.find, Grichelde.F.sub, Grichelde.F.gsub, Grichelde.F.getNextCharUtf8, Grichelde.F.isUtf8MultiByte, Grichelde.F.getUtf8Sequence, Grichelde.F.isUpper, Grichelde.F.isLower, Grichelde.F.toUpper, Grichelde.F.toLower, Grichelde.F.bytes2Char, Grichelde.F.trim, Grichelde.F.length, Grichelde.F.lengthUtf8
--- Splits a long text in longest possible chunks of <= 255 length, split at last available space
-- @param text string
@@ -58,7 +58,6 @@ function Grichelde:SplitText(text)
-- must not enforce UTF-8 support here, as the positions are used
while ((length(newText) > 0) and (escape < Grichelde.ENDLESS_LOOP_LIMIT)) do
escape = escape + 1
- local previousChar = currentChar
local first, textAhead = getNextCharUtf8(newText)
currentChar = first
self:DebugPrint("SplitText : currentChar, escape: %s, %s", currentChar, escape)
@@ -154,6 +153,24 @@ function Grichelde:SendChunkifiedChatMessage(message, ...)
end
function Grichelde:ReplaceCharacters(text, replName, replTable, consolidate, replacedTexts)
+ local function convertToCaseInsensitivePatternGroup(p)
+ local upperP, lowerP = toUpper(p), toLower(p)
+--[[
+ if (isUtf8MultiByte(p)) then
+ local sequence = nil
+ for _, byteSequence in spairs(getUtf8Table(upperP)) do
+ sequence = sequence .. byteSequence
+ end
+ else
+]]
+ if (upperP ~= lowerP) then
+ return upperP .. lowerP
+ else
+ return p
+ end
+ --end
+ end
+
local function convertToCaseInsensitivePattern(pattern)
local ciPattern = ""
local ignored = {'^', '$', '(', ')', '.'}
@@ -184,18 +201,13 @@ function Grichelde:ReplaceCharacters(text, replName, replTable, consolidate, rep
ciPattern = ciPattern .. "%" .. p
end
else
- local upperP, lowerP = toUpper(p), toLower(p)
- if (upperP ~= lowerP) then
- ciPattern = ciPattern .. upperP .. lowerP
- else
- ciPattern = ciPattern .. p
- end
+ ciPattern = ciPattern .. convertToCaseInsensitivePatternGroup(p)
end
p, patRest = getNextCharUtf8(patRest)
end
ciPattern = ciPattern .. "]"
else
- ciPattern = ciPattern .. "[" .. Grichelde.F.toUpper(p) .. Grichelde.F.toLower(p) .. "]"
+ ciPattern = ciPattern .. "[" .. convertToCaseInsensitivePatternGroup(p) .. "]"
end
p, patRest = getNextCharUtf8(patRest)
@@ -204,9 +216,9 @@ function Grichelde:ReplaceCharacters(text, replName, replTable, consolidate, rep
return ciPattern
end
- local function replaceCaptures(text, replaceText, captures)
+ local function replaceCaptures(txt, replaceText, captures)
local replText = replaceText
- self:TracePrint("replaceCaptures : text: %s, #captures: %d", text, #captures)
+ self:TracePrint("replaceCaptures : txt: %s, #captures: %d", txt, #captures)
if (#captures > 0) then
for i, cap in ipairs(captures) do
@@ -285,9 +297,6 @@ function Grichelde:ReplaceCharacters(text, replName, replTable, consolidate, rep
self:TracePrint("ReplaceCharacters : pos1: %d, pos2: %d", pos1, pos2)
self:TracePrint("ReplaceCharacters : cap1: %s, cap2: %s, cap3: %s, cap4: %s, cap5: %s, cap6: %s, cap7: %s, cap8: %s, cap9: %s", cap1, cap2, cap3, cap4, cap5, cap6, cap7, cap8, cap9)
while (pos1 ~= nil) and (pos2 ~= nil) and (pos1 <= pos2) do
- -- continue from that position later
- pos = pos2 + 1
-
if doStopOnMatch then
stopOnMatch = true
end
@@ -297,6 +306,24 @@ function Grichelde:ReplaceCharacters(text, replName, replTable, consolidate, rep
local post = sub(result, pos2 + 1)
local wordStart = sub(pre, -1, -1)
local wordEnd = sub(post, 1, 1)
+ self:TracePrint("ReplaceCharacters : result: %s", result)
+ self:TracePrint("ReplaceCharacters : pre: %s, match: %s, post: %s, wordStart: %s, wordEnd: %s", pre, match, post, wordStart, wordEnd)
+
+--[[
+ self:TracePrint("ReplaceCharacters : pos2: %d, isChar: %s", pos2, isChar(match))
+ while (not isChar(match) and pos2 < length(result)) do
+ pos2 = pos2 + 1
+ pre = sub(result, 1, pos1 - 1)
+ match = sub(result, pos1, pos2)
+ post = sub(result, pos2 + 1)
+ wordStart = sub(pre, -1, -1)
+ wordEnd = sub(post, 1, 1)
+ self:TracePrint("ReplaceCharacters : pos2: %d, isChar: %s", pos2, isChar(match))
+ end
+]]
+
+ -- continue from that position later
+ pos = pos2 + 1
-- additional checks for word boundaries
local doesMatchWhen = false
@@ -441,8 +468,8 @@ end
-- @param text string
-- @param replacements table of mappings
-- @return string
-function Grichelde:ReplaceAndConsolidate(text, replacements)
- local replacements = replacements or self.db.profile.replacements or {}
+function Grichelde:ReplaceAndConsolidate(text, _replacements)
+ local replacements = _replacements or self.db.profile.replacements or {}
self:TracePrint("ReplaceAndConsolidate : replacements")
self:TracePrint(replacements)
@@ -531,7 +558,6 @@ function Grichelde:CheckForLink(text, currentChar)
for _, pattern in ipairs(Grichelde.IGNORE_PATTERNS.LINKS) do
local pos1, pos2 = find(text, "^" .. pattern)
if (pos1 == 1) and (pos2 ~= nil) then
- local match = sub(text, pos1, pos2)
self:DebugPrint("CheckForLink : Found link or texture pattern \"%s\" at (%d, %d)", pattern, pos1, pos2)
return pos2
end
@@ -590,10 +616,10 @@ function Grichelde:CheckForRaidTargetMarkers(text, currentChar)
local translation = toLower(self.L["IgnorePattern_" .. localizedRT])
local localizedPattern = "^{" .. translation .. "}"
self:TracePrint("CheckForPreversableText : localizedPattern:", localizedPattern)
- local pos1, pos2 = find(lowerText, localizedPattern)
- if (pos1 == 1) and (pos2 ~= nil) then
- self:DebugPrint("CheckForPreversableText : Found localized raid target marker \"%s\" at (%d, %d)", localizedPattern, pos1, pos2)
- return pos2
+ local p1, p2 = find(lowerText, localizedPattern)
+ if (p1 == 1) and (p2 ~= nil) then
+ self:DebugPrint("CheckForPreversableText : Found localized raid target marker \"%s\" at (%d, %d)", localizedPattern, p1, p2)
+ return p2
end
end
end
@@ -636,9 +662,9 @@ end
-- @param previousChar string(1) previous character of the text, otherwise unreachable
-- @param preserveEmotes boolean ignore replacements for emotes, for testing purposes
-- @return number
-function Grichelde:CheckForPreversableText(text, currentChar, previousChar, replaceEmotes)
+function Grichelde:CheckForPreversableText(text, currentChar, previousChar, _replaceEmotes)
self:DebugPrint("CheckForPreversableText : text:", text)
- local replaceEmotes = replaceEmotes or self.db.profile.channels.emote or false
+ local replaceEmotes = _replaceEmotes or self.db.profile.channels.emote or false
local linkPos = self:CheckForLink(text, currentChar)
if (linkPos ~= nil) then
@@ -679,11 +705,11 @@ end
-- @param text string the text to apply the mappings on
-- @param preserveEmotes boolean ignore replacements for emotes, for testing purposes
-- @return string
-function Grichelde:ReplaceText(text, replacements, replaceEmotes)
+function Grichelde:ReplaceText(text, _replacements, _replaceEmotes)
local lookAheads = { '|', '*', '<', '%', '{', '(', 'o' }
local newText = text
- local preserveEmotes = replaceEmotes or self.db.profile.channels.emote or false
- local replacements = replacements or self.db.profile.replacements or {}
+ local preserveEmotes = _replaceEmotes or self.db.profile.channels.emote or false
+ local replacements = _replacements or self.db.profile.replacements or {}
local finalText, replaceText = "", ""
local currentChar
local escape = 0
diff --git a/GricheldeConstants.lua b/GricheldeConstants.lua
index c4682fe..e1074d5 100644
--- a/GricheldeConstants.lua
+++ b/GricheldeConstants.lua
@@ -5,7 +5,9 @@ local Grichelde = _G.Grichelde or {}
-- constants and upvalues
Grichelde.LOG_LEVEL = { DEBUG = 1, TRACE = 2 }
+-- chat input in client is limited to 255 bytes (unicode length is less)
Grichelde.INPUT_LIMIT = 255
+-- safety measure in case malformed user input causes infinite loops on string parsing
Grichelde.ENDLESS_LOOP_LIMIT = 10000
Grichelde.MAPPING_OFFSET = 10
Grichelde.MINIMAP_ENABLED = 1.0
@@ -169,11 +171,11 @@ local function nilOrEmpty(s)
return s == nil or s:trim() == ""
end
-local function spairs(t, orderFunc)
+local function spairs(tbl, orderFunc)
-- collect the keys
local sortedKeys = {}
-- for every non-nil value
- for key, _ in Grichelde.F.pairs(t) do
+ for key, _ in Grichelde.F.pairs(tbl) do
Grichelde.F.tInsert(sortedKeys, key)
end
@@ -189,22 +191,22 @@ local function spairs(t, orderFunc)
return function()
it = it + 1
if (sortedKeys[it] ~= nil) then
- return sortedKeys[it], t[sortedKeys[it]]
+ return sortedKeys[it], tbl[sortedKeys[it]]
else
return nil
end
end
end
-local function tFilter(t, condition, extract)
+local function tFilter(type, condition, extract)
local filtered = {}
- for key, value in Grichelde.F.pairs(t) do
+ for key, value in Grichelde.F.pairs(type) do
local cond = false
if (condition) then
- local t = Grichelde.F.type(condition)
- if (t == "function") then
- cond = condition(t, key, value)
- elseif (t == "string") or (t == "number") then
+ local typ = Grichelde.F.type(condition)
+ if (typ == "function") then
+ cond = condition(typ, key, value)
+ elseif (typ == "string") or (typ == "number") then
cond = (value == condition)
end
end
@@ -212,7 +214,7 @@ local function tFilter(t, condition, extract)
if (cond) then
local val = value
if (extract and (Grichelde.F.type(extract) == "function")) then
- val = extract(t, key, value)
+ val = extract(type, key, value)
end
Grichelde.F.tInsert(filtered, val)
end
@@ -220,20 +222,20 @@ local function tFilter(t, condition, extract)
return filtered
end
-local function tSize(t)
+local function tSize(tbl)
local size = 0
- if (t ~= nil) then
+ if (tbl ~= nil) then
-- for every non-nil value
- for _, _ in Grichelde.F.pairs(t) do
+ for _, _ in Grichelde.F.pairs(tbl) do
size = size + 1
end
end
return size
end
-local function tIsEmpty(t)
- if (not t) then return true end
- return Grichelde.F.tNext(t) == nil
+local function tIsEmpty(tbl)
+ if (not tbl) then return true end
+ return Grichelde.F.tNext(tbl) == nil
end
local function tClone(orig)
@@ -323,11 +325,11 @@ local function isCapital(word)
return false
else
local first, rest = Grichelde.F.getNextCharUtf8(word)
- local isCapital = Grichelde.F.isUpper(first)
+ local isCap = Grichelde.F.isUpper(first)
if (rest ~= nil) then
- return isCapital and Grichelde.F.isLower(rest)
+ return isCap and Grichelde.F.isLower(rest)
else
- return isCapital
+ return isCap
end
end
end
@@ -346,8 +348,8 @@ local function capitalize(word)
end
end
-local function color(color, text)
- return color .. text .. Grichelde.COLOR_CODES.CLOSE
+local function color(colour, text)
+ return colour .. text .. Grichelde.COLOR_CODES.CLOSE
end
local function cPrefix(text)
diff --git a/GricheldeDatabase.lua b/GricheldeDatabase.lua
index 846b54b..d0e8fb8 100644
--- a/GricheldeDatabase.lua
+++ b/GricheldeDatabase.lua
@@ -2,8 +2,8 @@
local _G = _G
local Grichelde = _G.Grichelde or {}
-local pairs, tInsert, tClone, tWipe, unpack, join, toString
- = Grichelde.F.pairs, Grichelde.F.tInsert, Grichelde.F.tClone, Grichelde.F.tWipe, Grichelde.F.unpack, Grichelde.F.join, Grichelde.F.toString
+local pairs, tInsert, tClone, unpack, join, toString
+ = Grichelde.F.pairs, Grichelde.F.tInsert, Grichelde.F.tClone, Grichelde.F.unpack, Grichelde.F.join, Grichelde.F.toString
function Grichelde.getDefaultConfig()
return {
diff --git a/GricheldeMinimap.lua b/GricheldeMinimap.lua
index 51de63f..a588d96 100644
--- a/GricheldeMinimap.lua
+++ b/GricheldeMinimap.lua
@@ -2,8 +2,8 @@
local _G = _G
local Grichelde = _G.Grichelde or {}
-local cPrefix, cGreen, cRed
- = Grichelde.F.cPrefix, Grichelde.F.cGreen, Grichelde.F.cRed
+local cGreen, cRed
+ = Grichelde.F.cGreen, Grichelde.F.cRed
--- add Minimap button
diff --git a/GricheldeTest.lua b/GricheldeTest.lua
index 67c05c9..46f8f18 100644
--- a/GricheldeTest.lua
+++ b/GricheldeTest.lua
@@ -2,7 +2,7 @@
local _G = _G
local Grichelde = _G.Grichelde or {}
-local find, pairs, tSize, cRed, cGreen, format = Grichelde.F.find, Grichelde.F.pairs, Grichelde.F.tSize, Grichelde.F.cRed, Grichelde.F.cGreen, Grichelde.F.format
+local find, pairs, tSize, cRed, cGreen = Grichelde.F.find, Grichelde.F.pairs, Grichelde.F.tSize, Grichelde.F.cRed, Grichelde.F.cGreen
function Grichelde:TestMatch(text, pattern)
-- disable debug print out for testing
@@ -17,6 +17,7 @@ function Grichelde:TestMatch(text, pattern)
Grichelde.logLevel = oldLogLevel
end
+--- Invoke ingame with /run Grichelde:RunTests()
function Grichelde:RunTests()
local function test(name, replacements, testData, replaceEmotes)
local i, ok, size = 0, 0, tSize(testData)
@@ -778,7 +779,7 @@ function Grichelde:RunTests()
if (ok == all) then
self:PrefixedPrint("All %d tests %s", all, cGreen("passed"))
else
- self:PrefixedPrint("%d test %s, %d tests %s", all - ok, cRed("failed"), ok, cGreen("passed"))
+ self:PrefixedPrint("%d test%s %s, %d tests %s", all - ok, all - ok > 1 and "s" or "", cRed("failed"), ok, cGreen("passed"))
end
-- restore old loglevel
diff --git a/GricheldeUpgrade.lua b/GricheldeUpgrade.lua
index 43676ef..a10a3b5 100644
--- a/GricheldeUpgrade.lua
+++ b/GricheldeUpgrade.lua
@@ -2,8 +2,8 @@
local _G = _G
local Grichelde = _G.Grichelde or {}
-local pairs, tSize, tClone, find, sub, cGreen, cOrange, cRed, toNumber
- = Grichelde.F.pairs, Grichelde.F.tSize,Grichelde.F.tClone, Grichelde.F.find, Grichelde.F.sub, Grichelde.F.cGreen, Grichelde.F.cOrange, Grichelde.F.cRed, Grichelde.F.toNumber
+local pairs, tClone, find, sub, cGreen, cOrange, cRed, toNumber
+ = Grichelde.F.pairs, Grichelde.F.tClone, Grichelde.F.find, Grichelde.F.sub, Grichelde.F.cGreen, Grichelde.F.cOrange, Grichelde.F.cRed, Grichelde.F.toNumber
function Grichelde:Upgrade_To_v060()
self:PrefixedPrint(self.L.Upgrade_ToVersion, cOrange("0.6.0"))
diff --git a/Grichelde_TBC.toc b/Grichelde_TBC.toc
new file mode 100644
index 0000000..9f949a9
--- /dev/null
+++ b/Grichelde_TBC.toc
@@ -0,0 +1,48 @@
+## Interface: 20504
+
+## Title: Grichelde
+## Notes: Replaces characters of your chat input line before sending.
+## Notes-de: Ersetzt eingegebene Zeichen in der Chat-Zeile vor dem Versenden.
+## Version: 1.1.4
+## Author: Teilzeit-Jedi
+## eMail: tj@teilzeit-jedi.de
+
+## X-Build: BCC
+## X-Compatible: 11403
+## X-Compatible: 30400
+## X-Compatible: 90207
+
+## X-Curse-Project-ID: 385480
+## X-License: GPLv3
+## X-Category: Chat/Communication
+## X-Credits: Teilzeit-Jedi
+## X-Embeds: LibStub, CallbackHandler, Ace3, LibDataBroker, LibDBIcon
+
+## OptionalDeps: LibStub, CallbackHandler, Ace3, LibDataBroker, LibDBIcon
+## SavedVariables: GricheldeDB
+
+Libs\LibStub\LibStub.lua
+Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml
+Libs\AceAddon-3.0\AceAddon-3.0.xml
+Libs\AceLocale-3.0\AceLocale-3.0.xml
+Libs\AceEvent-3.0\AceEvent-3.0.xml
+Libs\AceHook-3.0\AceHook-3.0.xml
+Libs\AceConsole-3.0\AceConsole-3.0.xml
+Libs\AceDB-3.0\AceDB-3.0.xml
+Libs\AceDBOptions-3.0\AceDBOptions-3.0.xml
+Libs\AceGUI-3.0\AceGUI-3.0.xml
+Libs\AceConfig-3.0\AceConfig-3.0.xml
+Libs\LibDataBroker-1.1\LibDataBroker-1.1.lua
+Libs\LibDBIcon-1.0\LibDBIcon-1.0.lua
+
+Grichelde.lua
+GricheldeConstants.lua
+
+localisation.xml
+
+GricheldeUtils.lua
+GricheldeDatabase.lua
+GricheldeUpgrade.lua
+GricheldeOptions.lua
+GricheldeMinimap.lua
+GricheldeChat.lua
diff --git a/Grichelde_Vanilla.toc b/Grichelde_Vanilla.toc
new file mode 100644
index 0000000..4a2165d
--- /dev/null
+++ b/Grichelde_Vanilla.toc
@@ -0,0 +1,48 @@
+## Interface: 11403
+
+## Title: Grichelde
+## Notes: Replaces characters of your chat input line before sending.
+## Notes-de: Ersetzt eingegebene Zeichen in der Chat-Zeile vor dem Versenden.
+## Version: 1.1.4
+## Author: Teilzeit-Jedi
+## eMail: tj@teilzeit-jedi.de
+
+## X-Build: Classic
+## X-Compatible: 20504
+## X-Compatible: 30400
+## X-Compatible: 90207
+
+## X-Curse-Project-ID: 385480
+## X-License: GPLv3
+## X-Category: Chat/Communication
+## X-Credits: Teilzeit-Jedi
+## X-Embeds: LibStub, CallbackHandler, Ace3, LibDataBroker, LibDBIcon
+
+## OptionalDeps: LibStub, CallbackHandler, Ace3, LibDataBroker, LibDBIcon
+## SavedVariables: GricheldeDB
+
+Libs\LibStub\LibStub.lua
+Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml
+Libs\AceAddon-3.0\AceAddon-3.0.xml
+Libs\AceLocale-3.0\AceLocale-3.0.xml
+Libs\AceEvent-3.0\AceEvent-3.0.xml
+Libs\AceHook-3.0\AceHook-3.0.xml
+Libs\AceConsole-3.0\AceConsole-3.0.xml
+Libs\AceDB-3.0\AceDB-3.0.xml
+Libs\AceDBOptions-3.0\AceDBOptions-3.0.xml
+Libs\AceGUI-3.0\AceGUI-3.0.xml
+Libs\AceConfig-3.0\AceConfig-3.0.xml
+Libs\LibDataBroker-1.1\LibDataBroker-1.1.lua
+Libs\LibDBIcon-1.0\LibDBIcon-1.0.lua
+
+Grichelde.lua
+GricheldeConstants.lua
+
+localisation.xml
+
+GricheldeUtils.lua
+GricheldeDatabase.lua
+GricheldeUpgrade.lua
+GricheldeOptions.lua
+GricheldeMinimap.lua
+GricheldeChat.lua
diff --git a/Grichelde_Wrath.toc b/Grichelde_Wrath.toc
new file mode 100644
index 0000000..1d521dd
--- /dev/null
+++ b/Grichelde_Wrath.toc
@@ -0,0 +1,48 @@
+## Interface: 30400
+
+## Title: Grichelde
+## Notes: Replaces characters of your chat input line before sending.
+## Notes-de: Ersetzt eingegebene Zeichen in der Chat-Zeile vor dem Versenden.
+## Version: 1.1.4
+## Author: Teilzeit-Jedi
+## eMail: tj@teilzeit-jedi.de
+
+## X-Build: WotLK
+## X-Compatible: 11403
+## X-Compatible: 20504
+## X-Compatible: 90207
+
+## X-Curse-Project-ID: 385480
+## X-License: GPLv3
+## X-Category: Chat/Communication
+## X-Credits: Teilzeit-Jedi
+## X-Embeds: LibStub, CallbackHandler, Ace3, LibDataBroker, LibDBIcon
+
+## OptionalDeps: LibStub, CallbackHandler, Ace3, LibDataBroker, LibDBIcon
+## SavedVariables: GricheldeDB
+
+Libs\LibStub\LibStub.lua
+Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml
+Libs\AceAddon-3.0\AceAddon-3.0.xml
+Libs\AceLocale-3.0\AceLocale-3.0.xml
+Libs\AceEvent-3.0\AceEvent-3.0.xml
+Libs\AceHook-3.0\AceHook-3.0.xml
+Libs\AceConsole-3.0\AceConsole-3.0.xml
+Libs\AceDB-3.0\AceDB-3.0.xml
+Libs\AceDBOptions-3.0\AceDBOptions-3.0.xml
+Libs\AceGUI-3.0\AceGUI-3.0.xml
+Libs\AceConfig-3.0\AceConfig-3.0.xml
+Libs\LibDataBroker-1.1\LibDataBroker-1.1.lua
+Libs\LibDBIcon-1.0\LibDBIcon-1.0.lua
+
+Grichelde.lua
+GricheldeConstants.lua
+
+localisation.xml
+
+GricheldeUtils.lua
+GricheldeDatabase.lua
+GricheldeUpgrade.lua
+GricheldeOptions.lua
+GricheldeMinimap.lua
+GricheldeChat.lua
diff --git a/Libs/LibStub/LibStub.toc b/Libs/LibStub/LibStub.toc
new file mode 100644
index 0000000..4d9130c
--- /dev/null
+++ b/Libs/LibStub/LibStub.toc
@@ -0,0 +1,9 @@
+## Interface: 20400
+## Title: Lib: LibStub
+## Notes: Universal Library Stub
+## Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel
+## X-Website: http://jira.wowace.com/browse/LS
+## X-Category: Library
+## X-License: Public Domain
+
+LibStub.lua
diff --git a/README.md b/README.md
index 42779dc..18cf606 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Grichelde - Text replacer
-Grichelde is a WoW Addon for Classic, Burning Crusade Classic and Retail (Shadowlands) that replaces any characters or words you typed in a chat input line according to your replacement rules.
+Grichelde is a WoW Addon for Classic, Wrath of the Lich King Classic and Retail (Shadowlands) that replaces any characters or words you typed in a chat input line according to your replacement rules.
The replacement is done **before** the text is send to other players/in the target channel. It does **not** change text other players have written in the chat, but the text they will see **from you**.
Its purpose is to simulate a speaking disability of your toon and hereby strengthen immersion in roleplay.