0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-20 13:42:59 -05:00
This commit is contained in:
Florian Schroedl 2024-11-28 14:13:28 +01:00
parent a28ed69113
commit 997cb59ce3

View file

@ -183,24 +183,24 @@
(def set-separator "/") (def set-separator "/")
(defn join-set-path [set-path] (defn join-set-path [path]
(join-path set-path set-separator)) (join-path path set-separator))
(defn split-set-str-path-prefix (defn split-set-str-path-prefix
"Split set-path "Split set-path
E.g.: \"S-some-set\" -> [\"S-\" \"some-set\"] E.g.: \"S-some-set\" -> [\"S-\" \"some-set\"]
\"G-some-group\" -> [\"G-\" \"some-group\"]" \"G-some-group\" -> [\"G-\" \"some-group\"]"
[set-path] [path-str]
(some->> set-path (some->> path-str
(re-matches #"^([SG]-)(.*)") (re-matches #"^([SG]-)(.*)")
(rest))) (rest)))
(defn add-set-path-prefix [set-name] (defn add-set-path-prefix [set-name-str]
(str set-prefix set-name)) (str set-prefix set-name-str))
(defn add-set-path-group-prefix [group-path] (defn add-set-path-group-prefix [group-path-str]
(str set-group-prefix group-path)) (str set-group-prefix group-path-str))
(defn set-full-path->set-prefixed-full-path (defn set-full-path->set-prefixed-full-path
"Returns token-set paths with prefixes to differentiate between sets and set-groups. "Returns token-set paths with prefixes to differentiate between sets and set-groups.
@ -223,12 +223,12 @@
(let [path (get-path token-set set-separator)] (let [path (get-path token-set set-separator)]
(set-full-path->set-prefixed-full-path path))) (set-full-path->set-prefixed-full-path path)))
(defn set-name-string->prefixed-set-path-string [set-name-string] (defn set-name-string->prefixed-set-path-string [name-str]
(-> (set-full-name->prefixed-full-path set-name-string) (-> (set-full-name->prefixed-full-path name-str)
(join-set-path))) (join-set-path)))
(defn prefixed-set-path-string->set-name-string [set-path-string] (defn prefixed-set-path-string->set-name-string [path-str]
(->> (split-token-set-path set-path-string) (->> (split-token-set-path path-str)
(map (fn [path-part] (map (fn [path-part]
(or (-> (split-set-str-path-prefix path-part) (or (-> (split-set-str-path-prefix path-part)
(second)) (second))