UNPKG

@notatki/core

Version:

A collection of tools for creating and syncing Anki notes from simple text files.

39 lines 1.22 kB
import {} from "@notatki/parser"; import { Output } from "./output.js"; export function printModelNodes(nodes) { const out = new Output(); for (const { name, id, cloze, fields, cards, styling } of nodes) { out.separate(); out.print(`model ${name.text}`); out.separate(); out.print(`id ${id.value}`); if (cloze != null) { out.separate(); out.print("cloze"); } out.separate(); for (const { name, required } of fields) { out.print(`field ${name.text}${required ? "" : "?"}`); } out.separate(); for (const { name, front, back } of cards) { out.print(`card ${name.text}`); out.separate(); out.print("front"); out.print(front.text); out.print("~~~"); out.separate(); out.print("back"); out.print(back.text); out.print("~~~"); out.separate(); } if (styling != null) { out.print("styling"); out.print(styling.text); out.print("~~~"); } } return String(out); } //# sourceMappingURL=print-model-nodes.js.map