mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-10 19:09:44 +02:00
Changes to build environment for windows compatability
This commit is contained in:
@@ -29,6 +29,10 @@ var system = require('system')
|
||||
, webpage = require('webpage')
|
||||
|
||||
|
||||
console.log('phantom.args');
|
||||
console.log(phantom.args.length);
|
||||
console.log(JSON.stringify(phantom.args));
|
||||
|
||||
var page = webpage.create()
|
||||
, files = phantom.args.slice(8, phantom.args.length)
|
||||
, width = phantom.args[7]
|
||||
@@ -51,12 +55,12 @@ var options = {
|
||||
|
||||
// If no css is suuplied make sure a fixed witdth is given to the gant renderer
|
||||
if(phantom.args[3] !== ''){
|
||||
if(typeof options.ganttConfig === 'undefined'){
|
||||
options.ganttConfig = {};
|
||||
}
|
||||
options.ganttConfig.useWidth = 1200;
|
||||
}
|
||||
|
||||
//console.log('options');
|
||||
//console.log(options.css);
|
||||
|
||||
page.content = [
|
||||
'<html>'
|
||||
, '<head>'
|
||||
@@ -69,10 +73,17 @@ page.content = [
|
||||
, '</html>'
|
||||
].join('\n')
|
||||
|
||||
//console.log('page.content');
|
||||
//console.log(JSON.stringify(page.content));
|
||||
//console.log(phantom.args[3]);
|
||||
|
||||
page.injectJs('../dist/mermaid.js')
|
||||
page.onConsoleMessage = function(msg, lineNum, sourceId) {
|
||||
console.log('CONSOLE: ' + msg + ' (from line #' + lineNum + ' in "' + sourceId + '")');
|
||||
};
|
||||
|
||||
console.log('Num files to execute : ' + files.length)
|
||||
|
||||
files.forEach(function(file) {
|
||||
var contents = fs.read(file)
|
||||
, filename = file.split(fs.separator).slice(-1)
|
||||
@@ -80,7 +91,9 @@ files.forEach(function(file) {
|
||||
, oDOM
|
||||
, svgContent
|
||||
, allElements;
|
||||
|
||||
|
||||
console.log('ready to execute png: ' + filename + '.png')
|
||||
|
||||
// this JS is executed in this statement is sandboxed, even though it doesn't
|
||||
// look like it. we need to serialize then unserialize the svgContent that's
|
||||
// taken from the DOM
|
||||
@@ -108,9 +121,9 @@ files.forEach(function(file) {
|
||||
}
|
||||
|
||||
page.render(options.outputDir + fs.separator + filename + '.png')
|
||||
log('saved png: ' + filename + '.png')
|
||||
console.log('saved png: ' + filename + '.png')
|
||||
}
|
||||
|
||||
console.log('After png save: ' + filename + '.png')
|
||||
if (options.svg) {
|
||||
var serialize = new XMLSerializer();
|
||||
fs.write(
|
||||
@@ -236,6 +249,7 @@ function executeInPage(data) {
|
||||
el.appendChild(elContent)
|
||||
|
||||
document.body.appendChild(el)
|
||||
|
||||
mermaid.initialize({
|
||||
sequenceDiagram:{useMaxWidth:false},
|
||||
flowchart:{useMaxWidth:false}
|
||||
@@ -266,7 +280,8 @@ function executeInPage(data) {
|
||||
document.body.appendChild(sc)
|
||||
}
|
||||
|
||||
//console.log(document.head.innerHTML);
|
||||
console.log('Generated head');
|
||||
console.log(document.head.innerHTML);
|
||||
//console.log(document.body.innerHTML);
|
||||
mermaid.init();
|
||||
|
||||
@@ -300,6 +315,6 @@ function executeInPage(data) {
|
||||
)
|
||||
|
||||
svgValue = xmlSerializer.serializeToString(svg)
|
||||
|
||||
//console.log('confWidth: '+document.head.outerHTML);
|
||||
return svgValue
|
||||
}
|
||||
|
Reference in New Issue
Block a user