Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 01-27-2023, 10:41 AM   #1
retace1824
Junior Member
retace1824 began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jan 2023
Device: PocketBook
Editing metadata - why is this so...? - content.opf

file - content.opf
Editing the metadata gets this result:

<meta name="calibre:series" content="YOUR SERIES"/>

Press File/Save

changes:

<meta content="YOUR SERIES" name="calibre:series" />

Is it possible that these changes will not happen?
retace1824 is offline   Reply With Quote
Old 01-27-2023, 11:01 AM   #2
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,881
Karma: 198099188
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Attribute orders are unimportant. But... I'm fairly certain that Sigil was updated to retain attribute orders some time ago. Are you using an up to date version of Sigil? If not, there's not much that can be done.
DiapDealer is online now   Reply With Quote
Advert
Old 01-27-2023, 11:41 AM   #3
retace1824
Junior Member
retace1824 began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jan 2023
Device: PocketBook
Quote:
Originally Posted by DiapDealer View Post
Attribute orders are unimportant. But... I'm fairly certain that Sigil was updated to retain attribute orders some time ago. Are you using an up to date version of Sigil? If not, there's not much that can be done.
Sigil 1.9.20.

With this option, the attributes are not shown in the programs.
on devices Iphone and pocketbook.

If you hand-correct on the
<meta name="calibre:series" content="YOUR SERIES"/>
shows.

The question is why: you change one thing, you save it, it changes.
Why?
retace1824 is offline   Reply With Quote
Old 01-27-2023, 11:50 AM   #4
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,881
Karma: 198099188
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by retace1824 View Post
Sigil 1.9.20.

With this option, the attributes are not shown in the programs.
on devices Iphone and pocketbook.

If you hand-correct on the
<meta name="calibre:series" content="YOUR SERIES"/>
shows.

The question is why: you change one thing, you save it, it changes.
Why?
No. The question is why reading some apps on iPhone and pocketbook are giving relevance to attribute orders when they shouldn't be. It is the programs that are broken, not Sigil.

We will look into whether or not we can preserve that attribute order, but we're not going to put ourselves on the hook for making changes just to fix broken apps that don't follow spec.

Last edited by DiapDealer; 01-27-2023 at 11:54 AM.
DiapDealer is online now   Reply With Quote
Old 01-27-2023, 12:20 PM   #5
retace1824
Junior Member
retace1824 began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jan 2023
Device: PocketBook
Quote:
It is the programs that are broken, not Sigil.
maybe the other way around


Looked here
https://idpf.org/epub/20/spec/OPF_2....htm#Section2.3

Quote:
For example:

<metadata xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlnspf="http://www.idpf.org/2007/opf">
<dc:title>Tale of Two Cities</dc:title>
<dc:creator opf:role="aut">Charles Dickens</dc:creator>
...
<meta name="price" content="USD 19.99" />
</metadata>
version before saving is correct

<meta name="calibre:series" content="YOUR SERIES"/>

Can be made optional, at the user's choice.
retace1824 is offline   Reply With Quote
Advert
Old 01-27-2023, 12:43 PM   #6
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 6,670
Karma: 86234809
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
Quote:
Originally Posted by retace1824 View Post
Looked here
https://idpf.org/epub/20/spec/OPF_2....htm#Section2.3

version before saving is correct
That is just an example. That same specification has another example later on where the order of attributes is reversed:

Quote:
<meta content="org-example-5059463624137734586" name="dtb:uid"/>
jhowell is online now   Reply With Quote
Old 01-27-2023, 12:50 PM   #7
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,881
Karma: 198099188
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
maybe the other way around
No. It's not the other way around. The order of attributes is not relevant. Any reading system that relies on the attributes of an opf entry being in a particular order to work properly is broken.

I said we'd look into accommodating these broken programs (if we can do so easily). Don't hurt your chances of this happening by mistakenly defending your position that it's Sigil that's misbehaving here. I can assure you that it's not. Nothing in the spec you quoted supports your position.
DiapDealer is online now   Reply With Quote
Old 01-27-2023, 12:59 PM   #8
retace1824
Junior Member
retace1824 began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jan 2023
Device: PocketBook
Quote:
Originally Posted by DiapDealer View Post
I said we'd look into accommodating these broken programs (if we can do so easily). Don't hurt your chances of this happening by mistakenly defending your position that it's Sigil that's misbehaving here. I can assure you that it's not. Nothing in the spec you quoted supports your position.
Thanks
retace1824 is offline   Reply With Quote
Old 01-27-2023, 01:45 PM   #9
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: 8,090
Karma: 5450184
Join Date: Nov 2009
Device: many
Sigil changed to maintaining attribute order a while back even though the spec clearly says attribute order is not relevant. This one done to make the Checkpoint diff tool more effective. So I need help to track down which code inside Sigil is involved.

So some questions:

1. Are you hand editing the opf when editing the metadata or are you using the MetaData editor icon/menu?

2. If the opf is open in a tab can you confirm the order is correct before.

3. If an epub3, Before hitting file save can you use the Update Manifest properties (under epub3 tools) then take a look at the metadata order in the OPF tab. If epub2, use Add Sematics to change something in the opf guide, and see if the OPF tab changed.

4. Are you using an external Python with Sigil and if so what version as the Ordered dict in python was not the default in sime early versions and python is used by the metadata editing code?

Last edited by KevinH; 01-27-2023 at 01:47 PM.
KevinH is offline   Reply With Quote
Old 01-27-2023, 01:53 PM   #10
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,881
Karma: 198099188
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
I can confirm that it happens when editing the opf file manually. I don't even have to do a file/save. Just clicking on a file in the Book Browser makes the opf change from the inserted:

Code:
<meta name="calibre:series" content="YOUR SERIES"/>
to

Code:
<meta content="YOUR SERIES" name="calibre:series"/>
Inserting the metadata and switching to a different Code View tab and then going back has the same effect.

This being on Windows 10 with Sigil 1.9.20

Last edited by DiapDealer; 01-27-2023 at 01:55 PM.
DiapDealer is online now   Reply With Quote
Old 01-27-2023, 02:02 PM   #11
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,881
Karma: 198099188
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Clicking on any menu item in Sigil also immediately causes the opf entry to change. With both EPUB3 and EPUB2.
DiapDealer is online now   Reply With Quote
Old 01-27-2023, 02:09 PM   #12
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: 8,090
Karma: 5450184
Join Date: Nov 2009
Device: many
So something is wrong with the OPF parsing code. It uses TagAtts.h which is definitely ordered. Probably something in inside the BS4 lxml repair parser which is invoked.

I will try to add a bunch of opf debug code to try to see where this is happening. Hopefully not deep inside lxml.
KevinH is offline   Reply With Quote
Old 01-27-2023, 02:13 PM   #13
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,635
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
IMHO, this is a non-issue.
  • That particular metadata entry is only used by Calibre and Calibre-adjacent software.
  • The Calibre metadata parser doesn't require any particular attribute order.

Spoiler:
Code:
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
	<dc:creator opf:file-as="Doe, John">John Doe</dc:creator>
	<dc:language>en</dc:language>
	<dc:title>Nitpicking for dummies</dc:title>
	<meta content="Nitpicking for dummies" name="calibre:title_sort"/>
	<meta content="The art of nitpicking" name="calibre:series"/>
	<meta content="1" name="calibre:series_index"/>
	<dc:date opf:event="modification" xmlns:opf="http://www.idpf.org/2007/opf">2023-01-27</dc:date>
	<dc:identifier id="BookId" opf:scheme="UUID">urn:uuid:d420bc81-9545-4313-b490-8bc75822cda2</dc:identifier>
</metadata>
Attached Thumbnails
Click image for larger version

Name:	nit.png
Views:	97
Size:	14.6 KB
ID:	199283  
Attached Files
File Type: epub meta_test.epub (2.3 KB, 99 views)
Doitsu is offline   Reply With Quote
Old 01-27-2023, 02:24 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: 27,881
Karma: 198099188
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by Doitsu View Post
IMHO, this is a non-issue.
  • That particular metadata entry is only used by Calibre and Calibre-adjacent software.
  • The Calibre metadata parser doesn't require any particular attribute order.

Spoiler:
Code:
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
	<dc:creator opf:file-as="Doe, John">John Doe</dc:creator>
	<dc:language>en</dc:language>
	<dc:title>Nitpicking for dummies</dc:title>
	<meta content="Nitpicking for dummies" name="calibre:title_sort"/>
	<meta content="The art of nitpicking" name="calibre:series"/>
	<meta content="1" name="calibre:series_index"/>
	<dc:date opf:event="modification" xmlns:opf="http://www.idpf.org/2007/opf">2023-01-27</dc:date>
	<dc:identifier id="BookId" opf:scheme="UUID">urn:uuid:d420bc81-9545-4313-b490-8bc75822cda2</dc:identifier>
</metadata>
I'd normally agree. But the reason we changed Sigil to maintain attribute order was so that doing diffs and checkpoints would reveal accurate -- useful -- changes that had been made to an epub.

So we'd probably be looking at this even if it had nothing to do with calibre series metadata. The fact that it affects some broken reading systems is secondary here. Even though metadata order should be irrelevant, we made a decision that Sigil should maintain attribute order as entered. This runs afoul of that.

Last edited by DiapDealer; 01-27-2023 at 02:27 PM.
DiapDealer is online now   Reply With Quote
Old 01-27-2023, 02:27 PM   #15
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: 8,090
Karma: 5450184
Join Date: Nov 2009
Device: many
Okay, I tracked this down to running the CleanSource::ProcessXML() routine which is done every time the OPF is loaded (and on any other xml files) to make sure they are sane and parseable. A broken OPF is not something anyone wants to happen.

Of course this damn code uses python and lxml deep inside of our bs4 code.

So I will have to see where something misses the change to OrderedDict() which was made in all python code we use.

I am on it.
KevinH is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Update CONTENT.OPF. Use metadata fr calibreDB GOROW Library Management 1 04-13-2021 11:57 AM
Problem with different metadata editing in opf homura_no_ko Library Management 3 03-10-2018 07:26 PM
Calibre changing metadata in content.opf? ChipSuey Editor 2 08-09-2016 02:16 PM
Editing content.opf with clips; Editing visibility varlog Sigil 45 04-24-2016 07:55 AM
Order of metadata in content.opf SIRSteiner Library Management 4 10-08-2013 06:11 PM


All times are GMT -4. The time now is 01:06 PM.


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