Comment 5 for bug 249445

Revision history for this message
codedread (codedread) wrote :

So I implemented SPObject types for title and desc elements. However, I'm having trouble getting Inkscape to output them using Plain SVG. As an example, let's look at sp-rect.cpp:

static Inkscape::XML::Node *
sp_rect_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
...
    if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) {
        repr = xml_doc->createElement("svg:rect");
    }
...
    if (((SPObjectClass *) parent_class)->write)
        ((SPObjectClass *) parent_class)->write(object, xml_doc, repr, flags);

    return repr;
}

As you can see, for each shape we create a new XML rect element (that does not contain its children). This is the same for other elements (path, circle, whatever).

So how to get Inkscape to copy the rect's title and desc children? Should I add code to sp-object's write function to grab its children and then duplicate and add them? If so, should I only do this for svg:title and svg:desc children? If so, then I guess I'd have to modify the code in sp-text and sp-item-group that already grab the children?

I will be in freenode's irc channel to discuss this if either of you are around today.