mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-10 02:49:40 +02:00
Fix for defect #158
This commit is contained in:
@@ -28,18 +28,24 @@ var system = require('system')
|
||||
, fs = require('fs')
|
||||
, webpage = require('webpage')
|
||||
|
||||
|
||||
var page = webpage.create()
|
||||
, files = phantom.args.slice(6, phantom.args.length)
|
||||
, files = phantom.args.slice(7, phantom.args.length)
|
||||
, options = {
|
||||
outputDir: phantom.args[0]
|
||||
, png: phantom.args[1] === 'true' ? true : false
|
||||
, svg: phantom.args[2] === 'true' ? true : false
|
||||
, css: phantom.args[3] !== '' ? phantom.args[3] : '* { margin: 0; padding: 0; }'
|
||||
, sequenceConfig: phantom.args[4]
|
||||
, verbose: phantom.args[5] === 'true' ? true : false
|
||||
, ganttConfig: phantom.args[5]
|
||||
, verbose: phantom.args[6] === 'true' ? true : false
|
||||
}
|
||||
, log = logger(options.verbose)
|
||||
|
||||
|
||||
console.log('options');
|
||||
console.log(options.ganttConfig);
|
||||
|
||||
page.content = [
|
||||
'<html>'
|
||||
, '<head>'
|
||||
@@ -68,8 +74,9 @@ files.forEach(function(file) {
|
||||
// look like it. we need to serialize then unserialize the svgContent that's
|
||||
// taken from the DOM
|
||||
svgContent = page.evaluate(executeInPage, {
|
||||
contents: contents,
|
||||
sequenceConfig: options.sequenceConfig
|
||||
contents : contents,
|
||||
ganttConfig : options.ganttConfig,
|
||||
sequenceConfig : options.sequenceConfig
|
||||
})
|
||||
oDOM = oParser.parseFromString(svgContent, "text/xml")
|
||||
|
||||
@@ -193,6 +200,7 @@ function executeInPage(data) {
|
||||
var xmlSerializer = new XMLSerializer()
|
||||
, contents = data.contents
|
||||
, sequenceConfig = data.sequenceConfig
|
||||
, ganttConfig = data.ganttConfig
|
||||
, toRemove
|
||||
, el
|
||||
, elContent
|
||||
@@ -221,6 +229,17 @@ function executeInPage(data) {
|
||||
document.body.appendChild(sc)
|
||||
}
|
||||
|
||||
if(typeof ganttConfig !== undefined && ganttConfig !== 'undefined'){
|
||||
console.log('Got ganttConfig');
|
||||
sc = document.createElement("script")
|
||||
scContent = document.createTextNode('mermaid.ganttConfig = JSON.parse(' + JSON.stringify(ganttConfig) + ');')
|
||||
sc.appendChild(scContent)
|
||||
|
||||
document.body.appendChild(sc)
|
||||
}else{
|
||||
console.log('No gantt config');
|
||||
}
|
||||
|
||||
mermaid.init();
|
||||
|
||||
svg = document.querySelector('svg')
|
||||
|
Reference in New Issue
Block a user