Restore image display (semi-revert fb25b30)
John Smith

John Smith commited on 2022-192 01:33:58
Showing 1 changed files, with 3 additions and 7 deletions.


It only took me 3 months to figure out, but I can display images
(on my system) with a shell-call to `iv` (an image viewer),
resolving the issues with image display.
Now, cards with images are no longer filtered out.
... ...
@@ -47,11 +47,10 @@ end
47 47
 local function imgify(text, basepath)
48 48
     -- adapted from https://stackoverflow.com/a/1579673
49 49
     local PATTERN = "(.-)IMG%[([^%]]+)%]"
50
-    -- Cygwin/Mintty
50
+    -- Linux/dwm
51 51
     local DISPIMG = function(path)
52 52
         if path and #path > 0 then
53
-            io.write("\n")
54
-            os.execute(string.format("imgcat %s%s", basepath, path))
53
+            os.execute(string.format("/usr/local/bin/iv %s%s &", basepath, path))
55 54
         end
56 55
     end
57 56
     local le = 1
... ...
@@ -239,10 +238,7 @@ elseif action == "r" then
239 238
     end
240 239
     if deck then
241 240
         -- collect list of index-pairs for prompts to be reviewed this session
242
-        local ctrt = review.list(deck, function(pr)
243
-            -- exclude prompts that use images
244
-            return not ((pr.text:find("IMG%[")) or (pr.ans:find("IMG%[")))
245
-        end)
241
+        local ctrt = review.list(deck)
246 242
         io.write(string.format(
247 243
             "%d prompts are ready for review.\nHow many to review in this session? ", #ctrt
248 244
         ))
249 245