When saving, double quotes in svg:script are turned to "

Bug #229359 reported by franti
2
Affects Status Importance Assigned to Milestone
Inkscape
New
Undecided
Unassigned

Bug Description

On Inkscape 0.46, the svg file also holds a text/ecmascript. It is visible in the XML editor and correctly shows like this:

function refreshInfo() {
    svgdoc.getElementById("ROTIND").firstChild.data="Rotation is : ";
}

When I save the file and reopen it inanother editor I get this :

function refreshInfo() {
    svgdoc.getElementById("ROTIND").firstChild.data="Rotation is : ";
}

This doesn't seem to occur with the single quote and could be avoided by using them instead, but remember that on many occurences it is necessary to mix the two quote styles.

This leads to a more general problem:
Inkscape currently does not preserve the original text that lies between the <script></script> tags. For example the <![CDATA[ ... ]]> tag is removed. If I add it manually inside the XML editor, it finally lands as &lt;![CDATA[ ... ]]&gt; on an external editor.

That means a lot of complications as I want to use Inkscape for graphic creation and another code editor for scripting animations. If there are several script snippets disseminated into the document we have a problem. It is urgent to fix this bug, but it should be an easy one I believe.

Thanks for your very worthy efforts.

Revision history for this message
franti (fhvill) wrote :

Script not preserved (continued).

Large scripts better be included with an attribute xlink:href="myscript.js". Sure!

Alas Inkscape eats away the xlink: part of the attribute name when it is saved. Each time I return to the external editor (HomeSite 5.5) I have to do the correction.

Revision history for this message
sas (sas-sas) wrote :

It's correct behaviour for <![CDATA[ ... ]]> in the XML editor to change to &lt;![CDATA[ ... ]]&gt; in the file - the XML editor shows plain text, not escaped text, and text that you type into it will be interpreted as plain text, not as escaped text.

Likewise, " changing to &quot; is OK (though unnecessary for element content, as opposed to attribute values).

Presumably, your objection to &quot; is that it makes the script less readable. So I'm marking this bug as a duplicate of bug 199656.

I can't reproduce the problem of Inkscape "eating" the xlink: of an xlink:href. Please file a separate bug report for that, and attach a file for which the problem happens.

Revision history for this message
franti (fhvill) wrote :

Thanks sas. I replied to your coment on the original bug report thread. I will do what you ask concerning the xlink:ref.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.