From ca97e38bd22875e23cfe6f70d1803ea31d6f0e89 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Fri, 2 Jul 2021 22:46:38 -0400 Subject: Anki support for structured-content (#1786) * Update how glossary text is formatted * Update structured content and image generation * Pass root data to _createStructuredContentGenerator * Implement media URLs * Update documentation * Update options util * Apply styles to content * Improve HTML normalization * Update DatabaseVM.fetch function * Update test * Update test data --- dev/database-vm.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'dev') diff --git a/dev/database-vm.js b/dev/database-vm.js index 014c989f..0127bc8f 100644 --- a/dev/database-vm.js +++ b/dev/database-vm.js @@ -84,7 +84,13 @@ class Blob { } async function fetch(url2) { - const filePath = url.fileURLToPath(url2); + const extDir = path.join(__dirname, '..', 'ext'); + let filePath; + try { + filePath = url.fileURLToPath(url2); + } catch (e) { + filePath = path.resolve(extDir, url2.replace(/^[/\\]/, '')); + } await Promise.resolve(); const content = fs.readFileSync(filePath, {encoding: null}); return { -- cgit v1.2.3