From 05c2ef93d8deee64b3670c051cb43d11a9bed1cd Mon Sep 17 00:00:00 2001 From: Simon Brooke Date: Tue, 20 May 2025 09:38:32 +0100 Subject: [PATCH] Change to git.journeyman.cc as canonical repository --- README.md | 6 +++++- src/adl_support/core.clj | 4 ++-- src/adl_support/utils.clj | 10 ++++++++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index dc6b14b..e00ae27 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # adl-support -A Clojure library designed to support auto-generated [ADL](https://github.com/simon-brooke/adl) code. This library should normally be included into projects generated by ADL, and consequently is licenced under the MIT license, which is less restrictive than the GNU General Public License which I normally use. +A Clojure library designed to support auto-generated [ADL](https://git.journeyman.cc/simon/adl) code. This library should normally be included into projects generated by ADL, and consequently is licenced under the MIT license, which is less restrictive than the GNU General Public License which I normally use. [![Clojars Project](https://img.shields.io/clojars/v/adl-support.svg)](https://clojars.org/adl-support) @@ -8,6 +8,10 @@ A Clojure library designed to support auto-generated [ADL](https://github.com/si You don't really use this; code auto-generated by ADL does. Some functions which may be more generally useful are in `adl-support.core`, q.v. +## Note: GitHub + +This project was hosted on GitHub at https://github.com/simon-brooke/adl-support. In accordance with journeyman policy the canonical repository is now [https://git.journeyman.cc/simon/adl-support](https://git.journeyman.cc/simon/adl-support). While the GitHub repository still exists it is no longer maintained and will in due course be colled. + ## License Copyright © 2018 Simon Brooke diff --git a/src/adl_support/core.clj b/src/adl_support/core.clj index bb3ae8f..bf9b068 100644 --- a/src/adl_support/core.clj +++ b/src/adl_support/core.clj @@ -37,7 +37,7 @@ `k` in map `m`, as read by read." [k m] (let [v (m k) - vr (if + vr (when (string? v) (try (json/read-str v) @@ -49,7 +49,7 @@ (number? vr) ;; there's a problem that json/read-str will read "07777 888999" as 7777 (re-matches #"^[0-9.]+$" v)) {(keyword k) vr} - true + :else {(keyword k) v}))) diff --git a/src/adl_support/utils.clj b/src/adl_support/utils.clj index d8b233e..7ce6ee6 100644 --- a/src/adl_support/utils.clj +++ b/src/adl_support/utils.clj @@ -276,7 +276,7 @@ (defn safe-name "Return a safe name for the object `o`, given the specified `convention`. `o` is expected to be either a string or an element. Recognised values for - `convention` are: #{:c :c-sharp :java :sql}" + `convention` are: #{:c :c-sharp :clojure :java :sql}" ([o] (cond (element? o) @@ -300,6 +300,7 @@ capitalised (capitalise string)] (case convention (:sql :c) (s/replace string #"[^a-zA-Z0-9_]" "_") + :clojure (s/replace string #"[^a-zA-Z0-9-]" "-") :c-sharp (s/replace capitalised #"[^a-zA-Z0-9]" "") :java (let [camel (s/replace capitalised #"[^a-zA-Z0-9]" "")] @@ -611,7 +612,12 @@ (symbol (str "db/" n)) n) (do - (*warn* "Argument passed to `list-related-query-name` was a non-entity") + (*warn* + (str "Argument " + (cond + (not (entity? nearside)) (or (-> nearside :attrs :name) nearside "nearside") + (not (entity? farside)) (or (-> farside :attrs :name) farside "farside")) + " passed to `list-related-query-name` was a non-entity")) nil)))) ([property nearside farside] (list-related-query-name property nearside farside false)))