|  | @ -17,7 +17,7 @@ function parseDOT (data) { | 
														
													
														
															
																|  |  | } |  |  | } | 
														
													
														
															
																|  |  |  |  |  |  | 
														
													
														
															
																|  |  | // mapping of attributes from DOT (the keys) to vis.js (the values) |  |  | // mapping of attributes from DOT (the keys) to vis.js (the values) | 
														
													
														
															
																|  |  | var ATTR_MAPPING = { |  |  |  | 
														
													
														
															
																|  |  |  |  |  | var NODE_ATTR_MAPPING = { | 
														
													
														
															
																|  |  | 'fontsize': 'font.size', |  |  | 'fontsize': 'font.size', | 
														
													
														
															
																|  |  | 'fontcolor': 'font.color', |  |  | 'fontcolor': 'font.color', | 
														
													
														
															
																|  |  | 'labelfontcolor': 'font.color', |  |  | 'labelfontcolor': 'font.color', | 
														
													
												
													
														
															
																|  | @ -27,6 +27,8 @@ var ATTR_MAPPING = { | 
														
													
														
															
																|  |  | 'tooltip': 'title', |  |  | 'tooltip': 'title', | 
														
													
														
															
																|  |  | 'labeltooltip': 'title' |  |  | 'labeltooltip': 'title' | 
														
													
														
															
																|  |  | }; |  |  | }; | 
														
													
														
															
																|  |  |  |  |  | var EDGE_ATTR_MAPPING = Object.create(NODE_ATTR_MAPPING); | 
														
													
														
															
																|  |  |  |  |  | EDGE_ATTR_MAPPING.color = 'color.color'; | 
														
													
														
															
																|  |  |  |  |  |  | 
														
													
														
															
																|  |  | // token types enumeration |  |  | // token types enumeration | 
														
													
														
															
																|  |  | var TOKENTYPE = { |  |  | var TOKENTYPE = { | 
														
													
												
													
														
															
																|  | @ -769,22 +771,23 @@ function setProp(object, path, value) { | 
														
													
														
															
																|  |  |  |  |  |  | 
														
													
														
															
																|  |  | /** |  |  | /** | 
														
													
														
															
																|  |  | * Convert an object with DOT attributes to their vis.js equivalents. |  |  | * Convert an object with DOT attributes to their vis.js equivalents. | 
														
													
														
															
																|  |  | * @param {Object} attr   Object with DOT attributes |  |  |  | 
														
													
														
															
																|  |  | * @return {Object}       Returns an object with vis.js attributes |  |  |  | 
														
													
														
															
																|  |  |  |  |  | * @param {Object} attr     Object with DOT attributes | 
														
													
														
															
																|  |  |  |  |  | * @param {Object} mapping | 
														
													
														
															
																|  |  |  |  |  | * @return {Object}         Returns an object with vis.js attributes | 
														
													
														
															
																|  |  | */ |  |  | */ | 
														
													
														
															
																|  |  | function convertAttr (attr) { |  |  |  | 
														
													
														
															
																|  |  |  |  |  | function convertAttr (attr, mapping) { | 
														
													
														
															
																|  |  | var converted = {}; |  |  | var converted = {}; | 
														
													
														
															
																|  |  |  |  |  |  | 
														
													
														
															
																|  |  | for (var prop in attr) { |  |  | for (var prop in attr) { | 
														
													
														
															
																|  |  | if (attr.hasOwnProperty(prop)) { |  |  | if (attr.hasOwnProperty(prop)) { | 
														
													
														
															
																|  |  | var mapping = ATTR_MAPPING[prop]; |  |  |  | 
														
													
														
															
																|  |  | if (Array.isArray(mapping)) { |  |  |  | 
														
													
														
															
																|  |  | mapping.forEach(function (mapping_i) { |  |  |  | 
														
													
														
															
																|  |  | setProp(converted, mapping_i, attr[prop]); |  |  |  | 
														
													
														
															
																|  |  |  |  |  | var visProp = mapping[prop]; | 
														
													
														
															
																|  |  |  |  |  | if (Array.isArray(visProp)) { | 
														
													
														
															
																|  |  |  |  |  | visProp.forEach(function (visPropI) { | 
														
													
														
															
																|  |  |  |  |  | setProp(converted, visPropI, attr[prop]); | 
														
													
														
															
																|  |  | }) |  |  | }) | 
														
													
														
															
																|  |  | } |  |  | } | 
														
													
														
															
																|  |  | else if (typeof mapping === 'string') { |  |  |  | 
														
													
														
															
																|  |  | setProp(converted, mapping, attr[prop]); |  |  |  | 
														
													
														
															
																|  |  |  |  |  | else if (typeof visProp === 'string') { | 
														
													
														
															
																|  |  |  |  |  | setProp(converted, visProp, attr[prop]); | 
														
													
														
															
																|  |  | } |  |  | } | 
														
													
														
															
																|  |  | else { |  |  | else { | 
														
													
														
															
																|  |  | setProp(converted, prop, attr[prop]); |  |  | setProp(converted, prop, attr[prop]); | 
														
													
												
													
														
															
																|  | @ -817,7 +820,7 @@ function DOTToGraph (data) { | 
														
													
														
															
																|  |  | id: dotNode.id, |  |  | id: dotNode.id, | 
														
													
														
															
																|  |  | label: String(dotNode.label || dotNode.id) |  |  | label: String(dotNode.label || dotNode.id) | 
														
													
														
															
																|  |  | }; |  |  | }; | 
														
													
														
															
																|  |  | merge(graphNode, convertAttr(dotNode.attr)); |  |  |  | 
														
													
														
															
																|  |  |  |  |  | merge(graphNode, convertAttr(dotNode.attr, NODE_ATTR_MAPPING)); | 
														
													
														
															
																|  |  | if (graphNode.image) { |  |  | if (graphNode.image) { | 
														
													
														
															
																|  |  | graphNode.shape = 'image'; |  |  | graphNode.shape = 'image'; | 
														
													
														
															
																|  |  | } |  |  | } | 
														
													
												
													
														
															
																|  | @ -837,7 +840,7 @@ function DOTToGraph (data) { | 
														
													
														
															
																|  |  | from: dotEdge.from, |  |  | from: dotEdge.from, | 
														
													
														
															
																|  |  | to: dotEdge.to |  |  | to: dotEdge.to | 
														
													
														
															
																|  |  | }; |  |  | }; | 
														
													
														
															
																|  |  | merge(graphEdge, convertAttr(dotEdge.attr)); |  |  |  | 
														
													
														
															
																|  |  |  |  |  | merge(graphEdge, convertAttr(dotEdge.attr, EDGE_ATTR_MAPPING)); | 
														
													
														
															
																|  |  | graphEdge.arrows = (dotEdge.type === '->') ? 'to' : undefined; |  |  | graphEdge.arrows = (dotEdge.type === '->') ? 'to' : undefined; | 
														
													
														
															
																|  |  |  |  |  |  | 
														
													
														
															
																|  |  | return graphEdge; |  |  | return graphEdge; | 
														
													
												
													
														
															
																|  |  |