Closed maurimo closed 7 years ago
Thanks @maurizio, it looks very interesting. I am currently traveling with limited access to Internet. Will try to check it by end of the week.
While I like the idea, I'd have preferred to not have to convert once again the whole kanji set. I also feel adding a Ruby dependency is a drawback. Could'nt a simple shell script do this ?
Hi Axel, Matthieu, Sadly I verified that it does not work in Anki, that was only useful point in having data loaded from iframe rather than via xhr! So I will not ask for merge, I will leave my branch there in case the idea can be recycled by someone doing something else. Regards,
On Mon, Mar 28, 2016 at 6:51 AM, Axel Bodart notifications@github.com wrote:
While I like the idea, I'd have preferred to not have to convert once again the whole kanji set. I also feel adding a Ruby dependency is a drawback. Could'nt a simple shell script do this ?
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/mbilbille/dmak/pull/19#issuecomment-202324959
Atenciosamente, Maurizio Monge
Instituto de Matemática da UFRJ, Av. Athos da Silveira Ramos 149, Centro de Tecnologia Bloco C Cidade Universitária - Ilha do Fundão Caixa Postal 68530 21941-909 Rio de Janeiro - RJ - Brasil http://poisson.phc.unipi.it/~monge/
One month late to reply... apologize :-1: First at all thanks for your work, I love the idea of having dmak in Anki!
The point here is dmak is just about rendering. It takes a JS data structure and "simply" render it. How this data structure is populated is a distinct process and you are not tie to a specific loader. The library does provide a default loader but you can easily bypass this and implement your own loader (ie: set option skipLoad
to true
).
Side note: do not plan to add more loader in dmak.js
any additional loader should be in a different repo
This was for a different purpose but few months years ago I wrote this tiny parser kvg2js which parses KanjiVG files into JS files for dmak.
Instead of using HTML files, what about loading JS files dynamically? Like below:
It was a bit hacky but I managed to make it work on the demo page.
var importScript = (function (oHead) {
function loadError (oError) {
throw new URIError("The script " + oError.target.src + " is not accessible.");
}
return function (sSrc, fOnload) {
var oScript = document.createElement("script");
oScript.type = "text\/javascript";
oScript.onerror = loadError;
if (fOnload) { oScript.onload = fOnload; }
oHead.appendChild(oScript);
oScript.src = sSrc;
}
})(document.head || document.getElementsByTagName("head")[0]);
See: https://developer.mozilla.org/en/docs/Web/API/HTMLScriptElement#Dynamically_importing_scripts
…ocal filesystem
(without having an http server running), and in particular should work in Anki cards. A script allows converting svg files into iframe-loadable html files.