Browse Source

doctype passing

pull/2/head
Ivan Polyakov 2 years ago
parent
commit
4ea7006043
  1. 10
      src/loader.js

10
src/loader.js

@ -18,6 +18,10 @@ const schema = {
type: 'string', type: 'string',
default: '(import sxml-serializer)(display (serialize-sxml SXML_LOADER_CONTENT))', default: '(import sxml-serializer)(display (serialize-sxml SXML_LOADER_CONTENT))',
}, },
doctype: {
type: 'string',
default: '<!DOCTYPE html>',
},
}, },
}; };
@ -42,9 +46,13 @@ module.exports = function(content, map, meta) {
expr = expr.replace('SXML_LOADER_CONTENT', content); expr = expr.replace('SXML_LOADER_CONTENT', content);
flags.push(expr); flags.push(expr);
let doctype = schema.properties.doctype.default;
if (options.doctype)
doctype = options.doctype;
const cb = this.async(); const cb = this.async();
runScheme(interpreter, flags).then(data => { runScheme(interpreter, flags).then(data => {
cb(null, data, map, meta); cb(null, `${doctype}\n${data}`, map, meta);
}).catch(err => { }).catch(err => {
console.error(err); console.error(err);
}); });

Loading…
Cancel
Save