if (value == null || value.trim().length() == 0) {
commands.add(new ChangePropertyCommand(p, key, null));
} else if (value.startsWith(" ") || value.endsWith(" ")) {
commands.add(new ChangePropertyCommand(p, key, Tag.removeWhiteSpaces(value)));
} else if (key.startsWith(" ") || key.endsWith(" ")) {
commands.add(new ChangePropertyKeyCommand(p, key, Tag.removeWhiteSpaces(key)));
} else {
String evalue = entities.unescape(value);
if (!evalue.equals(value)) {
commands.add(new ChangePropertyCommand(p, key, evalue));
} else {
String replacementKey = spellCheckKeyData.get(key);
if (replacementKey != null) {
commands.add(new ChangePropertyKeyCommand(p, key, replacementKey));
}
}
}
}
}