Just published the preliminary tool #pdf4anki on #codeberg
https://codeberg.org/barefootstache/pdf4anki
It mainly describes how to do it and is a semi-automation tool to get PDFs into #anki.
In the current version one will still need to modify the pattern constant in the clean-html.js file to align with the PDF in use.
After spending 7 hours to publish the code while going through a 71 page PDF.
The 71 pages were reduced to 43 pages in the `clean-html.js` step. And in the next step of `create-question.js` it was expanded to 63 pages.
Most of the time I was in the cleaning phase, since this is where one can remove pages and add questions quickly without the need of either copy-pasting the wording directly to #anki or manually typing it out.
One thing that has been holding me back is not having a #LuaSnip in #NeoVim to generate snippets quickly.
The most fun I had was dealing with a a pre-existing reference as in
```
const page = { foo: 0, bar: 0};
const pageList = [];
if (someNumber > 4) {
for (let ii = 0; ii < someNumber; ii++ ) {
page.foo = ii * ii;
page.bar = ii + ii;
pageList.push(page);
}
return;
}
pageList.push(page);
```
When console logging within the for-loop everything worked as expected, but if one saved the `JSON.stringify(pageList)` then each item that was created in the for-loop equated to the last item created.
The solution is to create a `structureClone(page)` within the for-loop and reference it over `page`.