< and > not correctly parsed

Bug #517064 reported by jazzynico
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Scour
Fix Released
Critical
Unassigned

Bug Description

Hi,

< and > are sometimes used in Inkscape's tutorials (tracing, tips...).
But when I scour that text:
<flowDiv xml:space="preserve">One of the features in Inkscape is a tool for tracing a bitmap image
into a &lt;path&gt; element for your SVG drawing. These short notes
should help you become acquainted with how it works.
</flowDiv>

&lt; is replaced with < and I get:
<flowDiv xml:space="preserve">One of the features in Inkscape is a tool for tracing a bitmap image
into a <path&gt; element for your SVG drawing. These short notes
should help you become acquainted with how it works.
</flowDiv>

And Inkscape returns an error if I try to open it.

Commenting the following lines:
 # encode > as &gt; (TODO: is this necessary?)
 if str.find('>') != -1:
  newstr = str.replace('>', '&gt;')

in def makeWellFormed(str) fixes this issue.

But can &lt;MyText> considered valid?

Regards.

Revision history for this message
codedread (codedread) wrote :

Thanks for catching this, Nico!

I have fixed this in my local copy. Will checkin tonight, but for now you can replace the makeWellFormed() function with this:

def makeWellFormed(str):
 newstr = ''
 xml_ents = { '<':'&lt;', '>':'&gt;', '&':'&amp;', "'":'&apos;', '"':'&quot;'}
 for c in str:
  if c in xml_ents:
   newstr += xml_ents[c]
  else:
   newstr += c

 return newstr

Sorry about the trouble.

Changed in scour:
status: New → Confirmed
importance: Undecided → Critical
Revision history for this message
codedread (codedread) wrote :

Ok, pushed in r158.

Changed in scour:
status: Confirmed → Fix Committed
codedread (codedread)
Changed in scour:
status: Fix Committed → Fix Released
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.