diff options
author | Lauri Ojansivu <x@xet7.org> | 2019-04-20 15:18:33 +0300 |
---|---|---|
committer | Lauri Ojansivu <x@xet7.org> | 2019-04-20 15:18:33 +0300 |
commit | 73e265d8fd050ae3daa67472b4465a5c49d68910 (patch) | |
tree | 677b233934a43d8f873e24c794ce289d85e3a9b7 /packages/markdown/marked/test/specs/commonmark/getSpecs.js | |
parent | 6117097a93bfb11c8bd4c87a23c44a50e22ceb87 (diff) | |
download | wekan-73e265d8fd050ae3daa67472b4465a5c49d68910.tar.gz wekan-73e265d8fd050ae3daa67472b4465a5c49d68910.tar.bz2 wekan-73e265d8fd050ae3daa67472b4465a5c49d68910.zip |
Include to Wekan packages directory contents, so that meteor command would build all directly.
This also simplifies build scripts.
Thanks to xet7 !
Diffstat (limited to 'packages/markdown/marked/test/specs/commonmark/getSpecs.js')
-rw-r--r-- | packages/markdown/marked/test/specs/commonmark/getSpecs.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/packages/markdown/marked/test/specs/commonmark/getSpecs.js b/packages/markdown/marked/test/specs/commonmark/getSpecs.js new file mode 100644 index 00000000..f22e00c0 --- /dev/null +++ b/packages/markdown/marked/test/specs/commonmark/getSpecs.js @@ -0,0 +1,24 @@ +const fetch = require('node-fetch'); +const marked = require('../../../'); +const htmlDiffer = require('../../helpers/html-differ.js'); +const fs = require('fs'); + +fetch('https://raw.githubusercontent.com/commonmark/commonmark.js/master/package.json') + .then(res => res.json()) + .then(pkg => pkg.version.replace(/^(\d+\.\d+).*$/, '$1')) + .then(version => + fetch(`https://spec.commonmark.org/${version}/spec.json`) + .then(res => res.json()) + .then(specs => { + specs.forEach(spec => { + const html = marked(spec.markdown, {headerIds: false}); + if (!htmlDiffer.isEqual(html, spec.html)) { + spec.shouldFail = true; + } + }); + fs.writeFileSync(`commonmark.${version}.json`, JSON.stringify(specs, null, 2) + '\n'); + }) + ) + .catch((err) => { + console.error(err); + }); |