metabase.logger); make sure this is loaded since we use clojure.tools.logging here
(:importclojure.lang.Keyword
...
...
@@ -19,6 +20,7 @@
InetSocketAddress
InetAddress)
(java.sqlSQLExceptionTimestamp)
(java.textNormalizerNormalizer$Form)
(java.utilCalendarDateTimeZone)
javax.xml.bind.DatatypeConverter
org.joda.time.DateTime
...
...
@@ -663,21 +665,44 @@
(when(seqmore)
(applystrict-extendatypemore)))
(defnremove-diacritical-marks
"Return a version of S with diacritical marks removed."
^String[^Strings]
(when(seqs)
(s/replace
;; First, "decompose" the characters. e.g. replace 'LATIN CAPITAL LETTER A WITH ACUTE' with 'LATIN CAPITAL LETTER A' + 'COMBINING ACUTE ACCENT'
;; See http://docs.oracle.com/javase/8/docs/api/java/text/Normalizer.html
(Normalizer/normalizesNormalizer$Form/NFD)
;; next, remove the combining diacritical marks -- this SO answer explains what's going on here best: http://stackoverflow.com/a/5697575/1198455
;; The closest thing to a relevant JavaDoc I could find was http://docs.oracle.com/javase/7/docs/api/java/lang/Character.UnicodeBlock.html#COMBINING_DIACRITICAL_MARKS
#"\p{Block=CombiningDiacriticalMarks}+"
"")))
(def^:private^:constslugify-valid-chars
"Valid *ASCII* characters for URL slugs generated by `slugify`."