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-23-2018, 11:45 PM   #1
AlanHK
Evangelist
AlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheese
 
AlanHK's Avatar
 
Posts: 430
Karma: 1002
Join Date: Apr 2014
Device: PW-3, Android phone
comments deleted from OPF?

I had a line in the OPF of an epub3 that kicked an epubcheck error. Not knowing how to fix it, I wondered if I could just hide it, so I commented it out with HTML comments <!-- ... -->
And it seemed fine and validated.

Then I saved the file and the line disappeared without notice.

I wanted to keep the line so I could return to puzzling it out.

Is there a way to hide lines in the OPF that will not mark them for deletion?
AlanHK is offline   Reply With Quote
Old 01-24-2018, 08:45 AM   #2
KevinH
Wizard
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: 3,071
Karma: 1931746
Join Date: Nov 2009
Device: many
No, by design the opf is kept in a parsed state so that file splitting, merging, new files added, files removed, can done, etc. There is no structure in the opf parser that supports keeping free form comments as they could be placed anywhere.

If you really need to keep something stored in the opf, you could hide it as an additional dc:description metadata field or your own custom metadata. If so, do not forget to xml escape it.
KevinH is offline   Reply With Quote
Advert
Old 01-24-2018, 10:36 PM   #3
AlanHK
Evangelist
AlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheese
 
AlanHK's Avatar
 
Posts: 430
Karma: 1002
Join Date: Apr 2014
Device: PW-3, Android phone
Quote:
Originally Posted by KevinH View Post
No, by design the opf is kept in a parsed state
OK; and explains why saving always prettifies the OPF.

But it was disconcerting to have comments, that are apparently legal and valid, be silently deleted and now lost for good. I thought that just saving a file was entirely safe.

In other cases, if I go to save a file with invalid code, Sigil either won't let me or warns me that it will "fix" it and there may be "data loss".

So if you can't preserve comments, a warning to that effect would be appreciated.
AlanHK is offline   Reply With Quote
Old 01-24-2018, 11:24 PM   #4
GrannyGrump
Obsessively Dedicated...
GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.
 
GrannyGrump's Avatar
 
Posts: 1,886
Karma: 18435619
Join Date: May 2011
Location: JAPAN (US expatriate)
Device: Sony PRS-T2, ADE on PC
@AlanHK -- It seems you can have comments in the *manifest* section, I see them all the time in Gutenberg books. But apparently not in the Metadata section.

Last edited by GrannyGrump; 01-24-2018 at 11:30 PM.
GrannyGrump is offline   Reply With Quote
Old 01-25-2018, 02:36 AM   #5
AlanHK
Evangelist
AlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheese
 
AlanHK's Avatar
 
Posts: 430
Karma: 1002
Join Date: Apr 2014
Device: PW-3, Android phone
Quote:
Originally Posted by GrannyGrump View Post
@AlanHK -- It seems you can have comments in the *manifest* section, I see them all the time in Gutenberg books. But apparently not in the Metadata section.
Well, epubcheck didn't raise a flag in either case, and it's pretty strict.

Anyway, Sigil deletes comments in the Manifest too. Does it when you open them so unless you crack the epub with another tool, you'll never know.

One I just got at random (https://www.gutenberg.org/ebooks/56410) originally had this:
Code:
<manifest>
    <!--Image: 530 x 800 size=113823 -->
    <item media-type="image/jpeg" href="@public@vhost@g@gutenberg@html@files@56410@56410-h@images@cover.jpg" id="item1"/>
In Sigil the comment is deleted and the text URL encoded, to become:

Code:
<manifest>
    <item id="item1" href="Images/%40public%40vhost%40g%40gutenberg%40html%40files%4056410%4056410-h%40images%40cover.jpg" media-type="image/jpeg"/>
Gutenberg uses pretty annoying and extremely long filenames, if I get one first thing I do is rename them all.

Last edited by AlanHK; 01-25-2018 at 02:58 AM.
AlanHK is offline   Reply With Quote
Advert
Old 01-25-2018, 03:39 AM   #6
GrannyGrump
Obsessively Dedicated...
GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.GrannyGrump ought to be getting tired of karma fortunes by now.
 
GrannyGrump's Avatar
 
Posts: 1,886
Karma: 18435619
Join Date: May 2011
Location: JAPAN (US expatriate)
Device: Sony PRS-T2, ADE on PC
@Alan --- hm, interesting. I just did a quick Gutenberg download, checked for comments, yes there they were. I even copied one into the metadata section.

Settings are PrettyPrint on save. I saved the book, re-opened, and all comments are still there. But this is Sigil version 0.8.6, which is probably why we see different results.
GrannyGrump is offline   Reply With Quote
Old 01-25-2018, 04:04 AM   #7
AlanHK
Evangelist
AlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheese
 
AlanHK's Avatar
 
Posts: 430
Karma: 1002
Join Date: Apr 2014
Device: PW-3, Android phone
Quote:
Originally Posted by GrannyGrump View Post
@Alan --- hm, interesting. I just did a quick Gutenberg download, checked for comments, yes there they were. I even copied one into the metadata section.

Settings are PrettyPrint on save. I saved the book, re-opened, and all comments are still there. But this is Sigil version 0.8.6, which is probably why we see different results.
I'm using 0.9.8.
It deletes comments anywhere in the opf on opening or saving, regardless.

Last edited by AlanHK; 01-25-2018 at 04:06 AM.
AlanHK is offline   Reply With Quote
Old 01-25-2018, 04:33 AM   #8
Maui
Connoisseur
Maui ought to be getting tired of karma fortunes by now.Maui ought to be getting tired of karma fortunes by now.Maui ought to be getting tired of karma fortunes by now.Maui ought to be getting tired of karma fortunes by now.Maui ought to be getting tired of karma fortunes by now.Maui ought to be getting tired of karma fortunes by now.Maui ought to be getting tired of karma fortunes by now.Maui ought to be getting tired of karma fortunes by now.Maui ought to be getting tired of karma fortunes by now.Maui ought to be getting tired of karma fortunes by now.Maui ought to be getting tired of karma fortunes by now.
 
Maui's Avatar
 
Posts: 57
Karma: 600000
Join Date: Jan 2018
Device: Galaxy Tab S2
Granny,

i guess if you do not do any changes Sigil will not regenerate the opf file as long as it is not necessary. Would be of interest if you apply a change which affects the opf file like renaming a file or adding a semantic.

M
Maui is offline   Reply With Quote
Old 01-25-2018, 08:17 AM   #9
KevinH
Wizard
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: 3,071
Karma: 1931746
Join Date: Nov 2009
Device: many
That is true. That said comments are legal in xml but do not provide functionality. Pieces of the opf should not be commented out to hide them for later given the opf must be completely parseable inside Sigil at all times. Simply copy that text to the clipboard and access it via the cliphistory when and if desired. This is the way Sigil has worked since Tidy was removed. The opf is kept as it was designed to be, as machine readable.
KevinH is offline   Reply With Quote
Old 01-25-2018, 08:18 AM   #10
KevinH
Wizard
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: 3,071
Karma: 1931746
Join Date: Nov 2009
Device: many
No, it will only delete comments when first parsed inside Sigil
KevinH is offline   Reply With Quote
Old 01-25-2018, 09:49 AM   #11
KevinH
Wizard
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: 3,071
Karma: 1931746
Join Date: Nov 2009
Device: many
If it would help ... I could collect comments when the opf is parsed that are located anyplace in the opf and create a new pre-parsed data structure that holds all comments together in one place.

Then when rebuilding the opf on the fly after a change, I could insert all comments in the order they were found but all relocated to be either just before the metadata section or just before the manifest section or something along those lines. In other words create a space in the rebuilt opf for all comments that once existed someplace before parsing and rebuilding.
KevinH is offline   Reply With Quote
Old 02-15-2018, 01:43 PM   #12
AlanHK
Evangelist
AlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheeseAlanHK can extract oil from cheese
 
AlanHK's Avatar
 
Posts: 430
Karma: 1002
Join Date: Apr 2014
Device: PW-3, Android phone
Quote:
Originally Posted by KevinH View Post
If it would help ... I could collect comments when the opf is parsed that are located anyplace in the opf and create a new pre-parsed data structure that holds all comments together in one place.
Thanks; preferable to silently deleting them.
But have a warning/advice stating that comments have been moved; or deleted if that still happens.
AlanHK is offline   Reply With Quote
Old 02-15-2018, 01:53 PM   #13
KevinH
Wizard
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: 3,071
Karma: 1931746
Join Date: Nov 2009
Device: many
There will be no warning. The content.opf is meant to always be machine parseable and machine generated inside Sigil.
KevinH is offline   Reply With Quote
Old 02-15-2018, 02:04 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: 18,987
Karma: 97915540
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Agreed. We're not popping warnings for moved or deleted comments in the OPF.
DiapDealer 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
Comments in content.opf with Sigil 0.9.2 turbulent Sigil 4 02-15-2016 05:29 PM
Deleting folders without OPF vs recreating OPF files wladdy Library Management 8 03-13-2015 05:50 AM
Change opf filename from content.opf to title.opf northstar7 Sigil 3 09-23-2013 12:44 PM
TWO OPF files or something like Media Queries in the OPF file for KF8 and MOBI? DHahn Kindle Formats 3 04-17-2012 04:06 AM
Can I cut and paste the Calibre opf into the ePub opf? wannabee ePub 0 07-12-2011 02:09 AM


All times are GMT -4. The time now is 10:59 AM.


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