eyeinsky / org-anki

Sync org notes to Anki via AnkiConnect
BSD 3-Clause "New" or "Revised" License
180 stars 28 forks source link

org-anki-import-deck doesn't handle single quotes properly #47

Closed gsingh93 closed 1 year ago

gsingh93 commented 2 years ago

If a card in Anki has a single quote in it, running org-anki-import-deck results in the following error message being inserted into the buffer:

* /bin/bash: -c: line 1: unexpected EOF while looking for matching `''
:PROPERTIES:
:ANKI_NOTE_ID: 1657610704952
:END:
/bin/bash: -c: line 2: syntax error: unexpected end of file

I think we need to add shell-quote-argument here: https://github.com/eyeinsky/org-anki/blob/master/org-anki.el#L680

eyeinsky commented 2 years ago

Thanks! Pushed a fix and bumped the version here 4c3b27efe8eed9a9c8b5636fb15b86975ef7e00e.

I wonder if the more better fix would be to launch pandoc directly -- it would be more efficient as going through a shell isn't required, and also there wouldn't be any fear of not escaping the input html properly.

gsingh93 commented 2 years ago

Yea, I think that's a good idea. I like the org-anki-import-deck feature but it's a little slow, and I think executing it directly will help.

And a minor improvement suggestion while you're working on this, it would be good if you can gracefully handle when pandoc doesn't exist and report this to the user. Currently it will fill your buffer with a "pandoc command not found" message for every card it tries to import.

eyeinsky commented 2 years ago

@gsingh93 Is there a good public deck to test performance on and how long does it take at the moment?