View Single Post
Old 03-26-2018, 08:30 PM   #14
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: 22,020
Karma: 122040722
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Becky's got a point. Your plugin really should be excluding meta tags when it's doing it's processing. Those tags aren't relevant to your plugin's stated workflow after all.

Calibre/Kovid's reasons for what he does are immaterial to this issue. "name" is a valid attribute for meta tags, and "calibre:cover" violates no xhtml value character rules. Your plugin should not mangle them (or any existing meta tag)--especially since they're not in your plugin's bailiwick to begin with.

Your code is changing every "name" attribute it finds (in any tag) to an "id" attribute. That's just a bad idea.

Change:
Code:
#ensure all bookmarks have only 'id' attributes
for tag in soup.find_all(True):
    if tag.has_attr('name'):
        idref = tag['name']
        del tag['name']
        tag['id'] = idref
to:
Code:
#ensure all bookmarks have only 'id' attributes
for tag in soup.find_all(True):
    if tag.has_attr('name') and tag.name != "meta":
        idref = tag['name']
        del tag['name']
        tag['id'] = idref
and be done.

There's no reason for this plugin to be changing any meta tags.

Last edited by DiapDealer; 03-26-2018 at 09:04 PM.
DiapDealer is offline   Reply With Quote