MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Plugins (https://www.mobileread.com/forums/forumdisplay.php?f=268)
-   -   [Plugin] AdjustSVG (https://www.mobileread.com/forums/showthread.php?t=269537)

rubeus 01-06-2016 12:55 PM

[Plugin] AdjustSVG
 
Hi,

YASP (yet another Sigil Plugin)

When modifying images already wrapped into the SVG element like cropping or resizing you need to change the viewbox attribute values in the svg tag as well as the width and height attribute in the image tag... things a computer can do better.

The plugin will scan all html files and look for an svg element having an image element as child, checking the dimensions and corrects them if they do not match.

It requires sigil >= 0.9.1, Python >= 3.4, PIL and sigil_bs4 library. If you have enabled the internal python interpreter all this is present.

If you are running an external Python interpreter i don't know if this is working due to the required sigil_bs4 lib (Beautifulsoup derivate)

//rubeus

KevinH 01-06-2016 02:14 PM

Added to Sigil Plugin Index Sticky Thread

rubeus 01-25-2016 03:54 PM

New version 0.1.1 in #1

- some minor improvements, better testing if its really an svg wrapper
- broken image link will be detected without abend
- workaround for camelcase attribute names in the svg tag

c4warez 03-14-2016 06:17 AM

Very useful plugin... Thanks!


But... Is there a way to make the plugin change ONLY the attribute values inside the svg tag (e.g. don't change the indentation of the rest of the code of the file and the order of the elements and attributes inside the svg tag)?

It's a minor detail that doesn't impact the text itself, but is a little annoying for people like me with a little bit of OCD regarding the way the code looks onscreen.

rubeus 03-14-2016 06:57 AM

It changes only the values inside the svg and img element already. Rest is done by beautifulsoup and plugin handler - nothing i can influence.


All times are GMT -4. The time now is 08:30 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.