/** * Markdown Test Suite Fixer */ // this file is responsible for "fixing" // the markdown test suite. there are // certain aspects of the suite that // are strange or will make my tests // fail for reasons unrelated to // conformance. var path = require('path') , fs = require('fs') , dir = __dirname + '/tests'; // fix unencoded quotes fs.readdirSync(dir).filter(function(file) { return path.extname(file) === '.html'; }).forEach(function(file) { var file = path.join(dir, file) , html = fs.readFileSync(file, 'utf8'); html = html .replace(/='([^\n']*)'(?=[^<>\n]*>)/g, '=&__APOS__;$1&__APOS__;') .replace(/="([^\n"]*)"(?=[^<>\n]*>)/g, '=&__QUOT__;$1&__QUOT__;') .replace(/"/g, '"') .replace(/'/g, ''') .replace(/&__QUOT__;/g, '"') .replace(/&__APOS__;/g, '\''); fs.writeFileSync(file, html); }); // turn