tarix/mcdsupport — pull request #4 by thjelm (2012-04-19 04:16:26+00:00)
Title: fix for Anki 2 Beta and added a feature

Howdy,

I think I have something worth pulling into the main branch. Thanks for making this plugin!

When I forked, I noticed that the plugin no longer worked with the Anki 2 Beta. Some internals in ankilib changed so I updated the code to work with the most recent build of Anki 2.

I also added a feature. It's an option to match "whole words only". It's toggled by a checkbox next to the Add button on the AddMcd dialog. I added this feature because I was using the plugin for Spanish and I didn't want partial word clozes. For example, if I had the following text:

"El Sol es una estrella del tipo espectral G2 que se encuentra en el centro del Sistema Solar y constituye la mayor fuente de energía electromagnética de este sistema planetario."

and I wanted to cloze the word "la", it would cloze out "estrel{{la}}", "So{{la}}r", "la" and "p{{la}}netario". This type of "match-all" makes sense for a language like Japanese which has thousands of unique characters and no spaces, but it doesn't work very well for a language like English or Spanish. Now I can check the "Whole words only" box and the plugin will only cloze the whole word "la".

I made a few minor changes as well. Take a look at the changesets and they should be clear. Let me know if you have any questions.

Peace,
Thomas Hjelm