Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement an 'Anki Card' type #24

Open
NiloCK opened this issue Jul 19, 2018 · 1 comment
Open

Implement an 'Anki Card' type #24

NiloCK opened this issue Jul 19, 2018 · 1 comment

Comments

@NiloCK
Copy link
Owner

NiloCK commented Jul 19, 2018

Anki displays cards as a function of

  • its 'card type', a template for the front and back of the card
  • the 'note data', individual data points meant to hydrate these templates

A view should exist to render anki cards from these input dataShapes, in order to facilitate imports from anki.

CrowdAnki exports anki decks to json files, where the shape of each of these parameters is as folllows:

/* Two different templates */
{
            "__type__": "NoteModel", 
            "crowdanki_uuid": "383671d6-79af-11e8-94bb-40f02f569107", 
            "css": ".card {\n font-family: arial;\n font-size: 40px;\n text-align: center;\n color: black;\n background-color: white;\n}\n", 
            "flds": [
                {
                    "font": "Arial", 
                    "media": [], 
                    "name": "Front", 
                    "ord": 0, 
                    "rtl": false, 
                    "size": 20, 
                    "sticky": false
                }, 
                {
                    "font": "Arial", 
                    "media": [], 
                    "name": "Back", 
                    "ord": 1, 
                    "rtl": false, 
                    "size": 20, 
                    "sticky": false
                }
            ], 
            "latexPost": "\\end{document}", 
            "latexPre": "\\documentclass[12pt]{article}\n\\special{papersize=3in,5in}\n\\usepackage[utf8]{inputenc}\n\\usepackage{amssymb,amsmath}\n\\pagestyle{empty}\n\\setlength{\\parindent}{0in}\n\\begin{document}\n", 
            "name": "SiteWord-cef25", 
            "req": [
                [
                    0, 
                    "all", 
                    [
                        0
                    ]
                ]
            ], 
            "sortf": 0, 
            "tags": [], 
            "tmpls": [
                {
                    "afmt": "{{FrontSide}}\n\n<hr id=answer>\n\n{{Back}}\n\n", 
                    "bafmt": "", 
                    "bqfmt": "", 
                    "did": null, 
                    "name": "Card 1", 
                    "ord": 0, 
                    "qfmt": "{{Front}}\n\n<br>\n<br>\n\n<div id=\"pips\"></div>\n\n<script>\nvar div = document.getElementById(\"pips\");\nsetTimeout(function(){\n  //div.innerHTML = div.innerHTML + \"*\";\n}, 3000);\n</script>"
                }
            ], 
            "type": 0, 
            "vers": []
        }, 
        {
            "__type__": "NoteModel", 
            "crowdanki_uuid": "38364ac0-79af-11e8-b58c-40f02f569107", 
            "css": ".card {\n font-family: arial;\n font-size: 20px;\n text-align: center;\n color: black;\n background-color: white;\n}", 
            "flds": [
                {
                    "font": "Arial", 
                    "media": [], 
                    "name": "Front", 
                    "ord": 0, 
                    "rtl": false, 
                    "size": 20, 
                    "sticky": false
                }, 
                {
                    "font": "Arial", 
                    "media": [], 
                    "name": "Back", 
                    "ord": 1, 
                    "rtl": false, 
                    "size": 20, 
                    "sticky": false
                }
            ], 
            "latexPost": "\\end{document}", 
            "latexPre": "\\documentclass[12pt]{article}\n\\special{papersize=3in,5in}\n\\usepackage[utf8]{inputenc}\n\\usepackage{amssymb,amsmath}\n\\pagestyle{empty}\n\\setlength{\\parindent}{0in}\n\\begin{document}\n", 
            "name": "Basic-cef25", 
            "req": [
                [
                    0, 
                    "all", 
                    [
                        0
                    ]
                ]
            ], 
            "sortf": 0, 
            "tags": [], 
            "tmpls": [
                {
                    "afmt": "{{FrontSide}}\n\n<hr id=answer>\n\n{{Back}}", 
                    "bafmt": "", 
                    "bfont": "Arial", 
                    "bqfmt": "", 
                    "bsize": 12, 
                    "did": null, 
                    "name": "Card 1", 
                    "ord": 0, 
                    "qfmt": "{{Front}}"
                }
            ], 
            "type": 0, 
            "vers": []
        }
/* A note. */
        {
            "__type__": "Note", 
            "data": "", 
            "fields": [
                "the", 
                "[sound:ankidroid_audiorec-2010477767.3gp]"
            ], 
            "flags": 0, 
            "guid": "PpaY6", 
            "note_model_uuid": "38364ac0-79af-11e8-b58c-40f02f569107", 
            "tags": [
                "marked"
            ]
        }
@NiloCK
Copy link
Owner Author

NiloCK commented Jul 25, 2018

Waiting on #29 so that media-attachments will be transferable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant