View Single Post
Old 02-15-2012, 06:34 PM   #1
codrutoctavian
Enthusiast
codrutoctavian began at the beginning.
 
Posts: 37
Karma: 10
Join Date: Jul 2009
Location: Bucharest, Romania
Device: Kindle 3
<svg> to <img> tags conversion

I am trying to convert epub -> mobi and the result is bad. I have to manually edit the html files and convert these tags:

<p id="d17437503631">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="100%" version="1.1" viewBox="0 0 516 338" width="100%">
<rect fill="#000007" height="338" width="516" x="0" y="0"/>
<image height="338" transform="translate(0 0)" width="516" xlink:href="images/9781569755730-text_0033_005.jpg"/>
</svg>
</p>

to:

<div class="center"><img src="images/9781569755730-text_0033_005.jpg" width="516" height="338" /></div>

there are hundreds of them.

As you can see I take from the <svg> tag the values of:

xlink:href="images/9781569755730-text_0033_005.jpg"

and the value of:

viewBox="0 0 516 338"

from which I take the 3rd and 4th values and use them to construct the <img> tag.

I know that this is difficult, but is there by chance a script which can interpret text and do this for me automatically?

Thanks
codrutoctavian is offline   Reply With Quote