From 4ea70060433acb8de84d19a83e34f869eaac0c42 Mon Sep 17 00:00:00 2001 From: Ivan Polyakov Date: Sat, 8 Oct 2022 01:30:42 +0300 Subject: [PATCH] doctype passing --- src/loader.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/loader.js b/src/loader.js index c0a3914..dea7cc6 100644 --- a/src/loader.js +++ b/src/loader.js @@ -18,6 +18,10 @@ const schema = { type: 'string', default: '(import sxml-serializer)(display (serialize-sxml SXML_LOADER_CONTENT))', }, + doctype: { + type: 'string', + default: '', + }, }, }; @@ -42,9 +46,13 @@ module.exports = function(content, map, meta) { expr = expr.replace('SXML_LOADER_CONTENT', content); flags.push(expr); + let doctype = schema.properties.doctype.default; + if (options.doctype) + doctype = options.doctype; + const cb = this.async(); runScheme(interpreter, flags).then(data => { - cb(null, data, map, meta); + cb(null, `${doctype}\n${data}`, map, meta); }).catch(err => { console.error(err); });