diff --git a/README.md b/README.md index 1c13464a..c88dd637 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ CONFIG_DEFAULT_DEFLOPT=true Pokemon sprite filenames are in a 1-to-1 correspondence with the Pokemon's name, for ease of processing. Filenames may be directly substituted in shell commands without escaping. This naming scheme means that some of the filenames in `src/` are a little awkward looking to humans, but it means that no additional data beyond what is encoded in the filesystem is required to determine the correct name for any given Pokémon. -- Filenames must conform to the POSIX portable filename character set, `[0-9a-zA-Z-._]`. To ensure this, we encode filenames according to the following rules. Characters in `[0-9a-zA-Z-.]` are left as-is. Spaces are converted to an underscore. Other characters are escaped using two underscores and four hex characters, similar to JavaScript Unicode escapes. (example: `Flabébé` -> `Flabe__0301be__0301`) +- Filenames must conform to the POSIX portable filename character set plus tilde, `[0-9a-zA-Z-._~]`. To ensure this, we encode filenames according to the following rules. Characters in `[0-9a-zA-Z-.~]` are left as-is. Spaces are converted to an underscore. Other characters are escaped using two underscores and four hex characters, similar to JavaScript Unicode escapes. (example: `Flabébé` -> `Flabe__0301be__0301`) The following JS functions may be useful: ```javascript @@ -106,9 +106,9 @@ Pokemon sprite filenames are in a 1-to-1 correspondence with the Pokemon's name, } ``` -- Formes are separated with two dashes from their base. (example: `Necrozma--Dawn-Wings`) +- Pokemon filenames are of the form `---`. Each component has `-` escaped as `~`. (example: `0006-001-Charizard-Mega~X`) -- Cosmetic female formes are `--Female` instead of `--F`, so that you may distinguish it from Unown. +- Cosmetic female formes are `-Female` instead of `-F`, so that you may distinguish it from Unown. ## Gotchas diff --git a/tools/deploy/util.js b/tools/deploy/util.js index 3a7a042b..6b80c8b6 100644 --- a/tools/deploy/util.js +++ b/tools/deploy/util.js @@ -4,7 +4,7 @@ export function decode(s) { } export function decomposeName(name) { - const [num, formeNum, base, forme=null] = name.split("--"); + const [num, formeNum, base, forme=null] = name.split("-").map(s => s.replace(/~/g, "-")); return {num: parseInt(num, 10), formeNum: parseInt(formeNum, 10), base, forme}; } @@ -26,7 +26,6 @@ export function toPSSpriteID(name) { export function toSmogonAlias(name) { return name.toLowerCase(). - replace("--", "-"). replace(/[ _]+/, "-"). replace(/[^a-z0-9-]+/g, ''); }