diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-09-29 11:33:23 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-09-29 11:33:23 +0200 |
commit | c5f5affda8c323d27f9120f6b860202e1dc068b7 (patch) | |
tree | a6e11fdd211070363a1f9c03e6ec9564546b9c65 | |
parent | feat(new/chapter): Improve `\include` and `\includeonly` generation (diff) | |
download | lpm-c5f5affda8c323d27f9120f6b860202e1dc068b7.tar.gz lpm-c5f5affda8c323d27f9120f6b860202e1dc068b7.zip |
fix(MangledName): Also replace `"` and `'`
-rw-r--r-- | src/new/mod.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/new/mod.rs b/src/new/mod.rs index 0c4114c..fed4ff3 100644 --- a/src/new/mod.rs +++ b/src/new/mod.rs @@ -12,13 +12,18 @@ pub struct MangledName(String); impl MangledName { pub fn new(name: &str) -> Self { - let safe_name = name + let new_name = deunicode(&name.to_case(Case::Snake)); + + let safe_name = new_name // TeX fails to include/input stuff with a colon in it. .replace(':', "_") // This obviously creates weird extra directories - .replace('/', "_"); + .replace('/', "_") + // These are just difficult to use on the command line + .replace('"', "_") + .replace('\'', "_"); - let ascii_name = deunicode(&safe_name.to_case(Case::Snake)).to_case(Case::Snake); + let ascii_name = safe_name.to_case(Case::Snake); Self(ascii_name) } |