aboutsummaryrefslogtreecommitdiff
path: root/dev/database-vm.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-07-02 22:46:38 -0400
committerGitHub <noreply@github.com>2021-07-02 22:46:38 -0400
commitca97e38bd22875e23cfe6f70d1803ea31d6f0e89 (patch)
treedeb2d4c63f8ffd463031f907687c8a416a26553c /dev/database-vm.js
parenta4715935cb4d910f5b13b398ca4742cf30c8f784 (diff)
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
Diffstat (limited to 'dev/database-vm.js')
-rw-r--r--dev/database-vm.js8
1 files changed, 7 insertions, 1 deletions
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 {