summaryrefslogtreecommitdiff
path: root/src/weepinbell/migration.clj
diff options
context:
space:
mode:
authoreltrac <hi@eltr.ac>2026-10-30 11:21:33 +0800
committereltrac <hi@eltr.ac>2026-10-30 11:21:33 +0800
commitae0fda1ee522cf04f7b843d4cb2803435546cfb8 (patch)
tree7734cc3a45f36348dae24a7b6174d880c60ccf55 /src/weepinbell/migration.clj
parentbccd5b715ba24a483270536d64826f8bac13d08f (diff)
test, migration: test edn-jf2ify; test throwable handling during migration
Diffstat (limited to 'src/weepinbell/migration.clj')
-rw-r--r--src/weepinbell/migration.clj7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/weepinbell/migration.clj b/src/weepinbell/migration.clj
index c029b56..c59910a 100644
--- a/src/weepinbell/migration.clj
+++ b/src/weepinbell/migration.clj
@@ -42,11 +42,16 @@
(println (.getMessage e))))))))
(println "Done")))
+(defn- file? [file]
+ (or (string? file)
+ (instance? java.io.File file)
+ (instance? java.net.URL file)))
+
(defn edn-jf2ify
"Given an EDN file with deprecated microformats data, converts
microformats to jf2 and generate a new file in new format."
[old-edn new-edn]
- {:pre [(string? old-edn) (string? new-edn)]}
+ {:pre [(file? old-edn) (file? new-edn)]}
(io/make-parents new-edn)
(.createNewFile (io/file new-edn))
(with-open [rdr (io/reader old-edn)]