11-14-2019, 06:04 AM | #1 |
Junior Member
Posts: 3
Karma: 10
Join Date: Nov 2019
Device: Samsung S7
|
tag attributes in random order
Hi!
I use the folder-out plugin to better interface with GIT. I just noted that the attributes are being saved in random order, but with same values. This makes GIT thinking that something was changed when it was not! For example: saved 2 days ago: <meta content="0.9.18" name="Sigil version"/> saved today: <meta name="Sigil version" content="0.9.18" /> You see, same info but at different order. Can someone change it to, maybe put in alphabetical order? many thanks guich |
11-14-2019, 06:18 AM | #2 |
Grand Sorcerer
Posts: 27,577
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Yes. That's because attribute order is not controllable when parsing with Gumbo. Nor is the order relevant to xhtml specifications. In short: there's nothing to be done. Diffing Sigil-saved xhtml with github is not going to get you want you want.
|
Advert | |
|
11-14-2019, 06:19 AM | #3 |
Guru
Posts: 702
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Misc
|
This is related to Metadata Editor.
If epub files is saved first time then is order: content-name. After use Metadata Editor order is changed to name-content. Fix is simply: change save order in OPFResource::AddSigilVersionMeta() (solution for OP is wait for fix) |
11-14-2019, 06:30 AM | #4 |
Grand Sorcerer
Posts: 27,577
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
That still won't guarantee all attributes will always stay in the same order. I never use the metadata editor and attributes change order.
|
11-14-2019, 06:37 AM | #5 |
Guru
Posts: 702
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Misc
|
I see. The order can be changed by some plugin, another editor or anything that "touches" the OPF file.
|
Advert | |
|
11-14-2019, 07:10 AM | #6 |
Grand Sorcerer
Posts: 27,577
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Yep. And it's not just the opf. Xhtml tag ttributes can be rearranged as well, I believe. The FolderIn/Out plugin might be able to enforce an attribute order, but I doubt Kevin would want to take on the sort of intensive processing over-head that would entail. Each file would need to be parsed and all attributes alphabetized each and every save/open.
Last edited by DiapDealer; 11-14-2019 at 07:12 AM. |
11-14-2019, 09:06 AM | #7 |
Sigil Developer
Posts: 7,683
Karma: 5433388
Join Date: Nov 2009
Device: many
|
gumbo will most likely preserve attribute order because it does not use a dictionary to store the attributes. So it is our python code that is the issue as it uses maps/dicts when parsing xml and when storing the opf, and in parsing xhtml. We can look into using a order preserving dict for python (I think one already exists), but the attribute order will still be an issue in our Qt hashes/maps that as far as I know are not order preserving.
So that would take quite a bit of work for something that already is spec, as attribute order in xml/xhtml does not depend on order. Maybe a project post Sigil 1.0. Kevin |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Changing tag browser item order? | arspr | Calibre | 4 | 09-13-2014 11:39 AM |
A questions to - Tweak: tag browser category order | MiniMouse | Library Management | 6 | 09-13-2014 08:59 AM |
Changing order of Name and Surname in Name tag | rolgiati | Recipes | 3 | 08-11-2013 08:05 PM |
Tag browser categories order | Noughty | Library Management | 11 | 08-17-2012 01:04 PM |
Random page breaks and random subscripts? | sark666 | Kobo Reader | 2 | 09-04-2010 02:25 AM |