Skip to content

Commit

Permalink
Use Unicode.normalize in _preprocess_name
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRoniOne committed Apr 7, 2024
1 parent cd3469b commit 222e1fb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ version = "1.0.6"
[deps]
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

[compat]
PrettyTables = "1, 2"
Tables = "1"
Unicode = "1"
julia = "1.6"
5 changes: 3 additions & 2 deletions src/polish_names.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using Base: String
using Unicode: normalize

struct Style{T} end

Style(s::Symbol) = Style{s}()

const SPECIAL_CHARS = r"[\s\-\.\_\/\:\\\*\?\"\'\>\<\|]"
const SPECIAL_CHARS = r"[\s\-\.\_\/\:\\\*\?\"\'\>\<\|\!\,\$\@\^\[\]\{\}]"

"""
polish_names!(table::CleanTable; style::Symbol=:snake_case)
Expand Down Expand Up @@ -78,7 +79,7 @@ function generate_polished_names(names, ::Style)
end

function _preprocess_name(name)
preprocessed = String(name)
preprocessed = normalize(String(name), stripmark=true)

matched = match(r"^[[:upper:]]+$", preprocessed)
if matched !== nothing
Expand Down

0 comments on commit 222e1fb

Please sign in to comment.