Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 01-24-2016, 02:17 PM   #16
rubeus
Banned
rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.
 
Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
Its not only the PreserveAspectRatio but the viewbox <=> viewBox) attribute true. If i'm changing them back to mixed case after the plugin run its fine again.
While developing and testing i rembered that i've had too look/search the attrubutes they were already in lower case, so i guess its more the soup and not the serialize call.
rubeus is offline   Reply With Quote
Old 01-24-2016, 02:24 PM   #17
rubeus
Banned
rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.
 
Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
Turning on debugmode in the plugin:

Code:
{'height': '100%', 
'version': '1.1', 
'xmlns:xlink': 'http://www.w3.org/1999/xlink', 
'xmlns': 'http://www.w3.org/2000/svg', 
'width': '100%', 
'viewbox': '0 0 600 800', 
'preserveaspectratio': 'xMidYMid meet'}
one can clearly see that the lowercase attributes are generated already by building the soup.
rubeus is offline   Reply With Quote
Advert
Old 01-24-2016, 02:35 PM   #18
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,463
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Yes, I have a feeling our sigil_bs4 will need to be made aware of those few, special, case-sensitive attributes.
DiapDealer is offline   Reply With Quote
Old 01-24-2016, 02:39 PM   #19
rubeus
Banned
rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.
 
Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
Here is the proof:

Code:
           
            html = soup.serialize_xhtml()
            html = html.replace('viewbox', 'viewBox')
            html = html.replace('preserveaspectratio', 'preserveAspectRatio')
and everything is fine.

On one hand its fine you found the root cause, on the other hand its a pity it has nothing to with the ignorance of changes sometimes.

I will publish a workaround for this til the new version is out and maybe its a good idea to move the thread to the plugin subforum.

Last edited by rubeus; 01-24-2016 at 02:49 PM.
rubeus is offline   Reply With Quote
Old 01-24-2016, 03:05 PM   #20
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,506
Karma: 5433350
Join Date: Nov 2009
Device: many
Wow! Good catch. Yes, The svg attributes are case sensitive but most serializers will lowercase them. Gumbo handles this right but it looks like either bs4 or lxml or whatever is not setting them properly. I will take a look at it. We can always fix this in bs4 if it turns out to be the issue.

Kevin
KevinH is offline   Reply With Quote
Advert
Old 01-24-2016, 03:10 PM   #21
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,506
Karma: 5433350
Join Date: Nov 2009
Device: many
I see from your plugin you are just using the default parser for soup. You may want to set it to either use gumbo or html5lib and see if they are better about keeping the case of attributes.
KevinH is offline   Reply With Quote
Old 01-24-2016, 03:23 PM   #22
rubeus
Banned
rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.
 
Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
html5lib is tampering the doctype and gumbo is producing a runtime error that it cant be found
rubeus is offline   Reply With Quote
Old 01-24-2016, 05:14 PM   #23
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,506
Karma: 5433350
Join Date: Nov 2009
Device: many
You use the gumbo_bs4_adapter.py not soup directly. I will run a test to see how it handles it.

Here is an example of using it:
Code:
    # examples for using the bs4/gumbo parser to process xhtml
    import sigil_bs4
    import sigil_gumbo_bs4_adapter as gumbo_bs4

    samp = """
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml/" xml:lang="en" lang="en-US">
<head><title>testing & entities</title></head>
<body>
  <p class="first second">this is the <i><b>copyright</i></b> symbol "©"</p>
  <p xmlns:xlink="http://www.w3.org/xlink" class="second" xlink:href="http://www.ggogle.com">this used to test atribute namespaces</p>
</body>
</html>
"""

    soup = gumbo_bs4.parse(samp)
    for node in soup.find_all(attrs={'class':'second'}):
        print(node)
    print(soup.serialize_xhtml());”

Last edited by KevinH; 01-24-2016 at 05:28 PM.
KevinH is offline   Reply With Quote
Old 01-24-2016, 06:26 PM   #24
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,506
Karma: 5433350
Join Date: Nov 2009
Device: many
Hi rubeus,

Don't bother testing with sigil gumbo_bs4. It has two typos which I just now fixed that prevent it from working with foreign namespaced attributes well. Once I did fix those typos and adjusted your AdjustSVG code to use it, it worked like a charm. The correct SVG attribute names (mixed case) were used.

So the bug is not in sigil_bs4. It just serializes what it is given. The bug is in the default "html" parser which incorrectly changed the case of the svg attributes (and maybe even tag names). It is not properly keeping the mixed case attribute names. Once fixed, sigil_gumb_bs4_adapter works correctly with no changes in sigil_bs4.

If BS4 with html5lib messes with your doctype (that is strange), the only solution is to do what you are doing now and fix them after the fact using a regular expression replacement to make sure they are inside tags and not just a word in the text. Or alternatively strip off the doctype pass it to html5lib to parser and fix and then put it back at the end.

When Sigil-0.9.3 is released, I can post the adjusted code for using it which has no need of changing the attribute names after the fact.

Take care,

KevinH
KevinH is offline   Reply With Quote
Old 01-25-2016, 03:33 AM   #25
rubeus
Banned
rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.rubeus ought to be getting tired of karma fortunes by now.
 
Posts: 272
Karma: 1224588
Join Date: Sep 2014
Device: Sony PRS 650
The replace method was only a quick proof of concept. It is unlikely that there other words like viewBox or presereAspectRatio are used, but Murphy tells us that this wont happen if you take care of, the probability will raise to 100% if you dont take care of
rubeus is offline   Reply With Quote
Old 01-25-2016, 10:34 AM   #26
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,689
Karma: 54369090
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by rubeus View Post
The replace method was only a quick proof of concept. It is unlikely that there other words like viewBox or presereAspectRatio are used, but Murphy tells us that this wont happen if you take care of, the probability will raise to 100% if you dont take care of
Ain't that the truth
theducks is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
epubcheck plugin for Sigil Doitsu Plugins 502 02-20-2024 06:58 AM
[Plugin] ePub3-itizer - epub3 output plugin for Sigil KevinH Plugins 435 01-19-2023 09:46 PM
icarus Sigil plugin AlPe Plugins 26 12-05-2017 10:03 AM
smoothRemove_v010 plugin for Sigil kbanelas Plugins 15 01-27-2017 05:51 PM
How do I change Plugin Images/Icons? Steppa Plugins 8 01-22-2013 06:37 PM


All times are GMT -4. The time now is 04:43 PM.


MobileRead.com is a privately owned, operated and funded community.