Merge pull request #2508 from amaanq/render-space

fix(render): only output SPACE for strings that are just a space
This commit is contained in:
Amaan Qureshi 2023-08-16 14:37:18 -04:00 committed by GitHub
commit eb3c2b378a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1538,7 +1538,7 @@ impl Generator {
} else {
'special_chars: {
let replacement = match c {
' ' => "SPACE",
' ' if name.len() == 1 => "SPACE",
'~' => "TILDE",
'`' => "BQUOTE",
'!' => "BANG",
@ -1613,6 +1613,7 @@ impl Generator {
break 'special_chars;
}
'0'..='9' | 'a'..='z' | 'A'..='Z' | '_' => unreachable!(),
' ' => break 'special_chars,
};
if !result.is_empty() && !result.ends_with("_") {
result.push('_');