plugins/raphael.export.js
[raphael] / plugins / raphael.export.js
index fc652da..bdd3b91 100644 (file)
                                                },
                                                {
                                 style: 'text-anchor: ' + (style.font.anchor ? (style.font.anchor  +';' ): 'middle;') + 
-                                    styleToString(style) + ';' }
-                                               ),
+                                    styleToString(style) + ';'
+                        }
+                                       ),
                                        node.matrix,
                                        tag('tspan',
                             {
                                reduce(
                                        node.attrs,
                                        function(initial, value, name) {
-                                               if ( name === 'path' ) name = 'd';
+                                               if ( name === 'path' ) {
+                            name = 'd';
+                        }
 
-                                               initial[name] = value.toString();
+                                               initial[name] = (typeof(value) == 'undefined') ? '' : value.toString();
 
                                                return initial;
                                        },
-                                       {}
+                    {
+                            style:  node.attrs.style
+                    }
                                ),
                                node.matrix
                                );
 
                        for ( i in node.attrs ) {
                                var name = i;
-
+                var val = node.attrs[i].toString();
                                switch ( i ) {
                                        case 'src':
                                                name = 'xlink:href';
                                                break;
                                        case 'transform':
                                                name = '';
-
                                                break;
+                    
+                    case 'stroke':
+                    case 'fill':
+                        val = Raphael.getRGB(val).hex;
+                        break;
                                }
 
                                if ( name ) {
-                                       attrs += ' ' + name + '="' + escapeXML(node.attrs[i].toString()) + '"';
+                                       attrs += ' ' + name + '="' + escapeXML(val) + '"';
                                }
                        }