Search in sources :

Example 1 with TemplateRenderOutput

use of com.ichi2.libanki.TemplateManager.TemplateRenderContext.TemplateRenderOutput in project Anki-Android by ankidroid.

the class Collection method render_output_legacy.

@NonNull
@RustCleanup("Hack for Card Template Previewer, needs review")
public TemplateRenderOutput render_output_legacy(@NonNull Card c, boolean reload, boolean browser) {
    Note f = c.note(reload);
    Model m = c.model();
    JSONObject t = c.template();
    long did;
    if (c.isInDynamicDeck()) {
        did = c.getODid();
    } else {
        did = c.getDid();
    }
    HashMap<String, String> qa;
    if (browser) {
        String bqfmt = t.getString("bqfmt");
        String bafmt = t.getString("bafmt");
        qa = _renderQA(c.getId(), m, did, c.getOrd(), f.stringTags(), f.getFields(), c.internalGetFlags(), browser, bqfmt, bafmt);
    } else {
        qa = _renderQA(c.getId(), m, did, c.getOrd(), f.stringTags(), f.getFields(), c.internalGetFlags());
    }
    return new TemplateRenderOutput(qa.get("q"), qa.get("a"), null, null, c.model().getString("css"));
}
Also used : JSONObject(com.ichi2.utils.JSONObject) TemplateRenderOutput(com.ichi2.libanki.TemplateManager.TemplateRenderContext.TemplateRenderOutput) RustCleanup(net.ankiweb.rsdroid.RustCleanup) NonNull(androidx.annotation.NonNull)

Aggregations

NonNull (androidx.annotation.NonNull)1 TemplateRenderOutput (com.ichi2.libanki.TemplateManager.TemplateRenderContext.TemplateRenderOutput)1 JSONObject (com.ichi2.utils.JSONObject)1 RustCleanup (net.ankiweb.rsdroid.RustCleanup)1