![]() |
#1 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Conditional code for Previewer conversion
I create books in ePub using Sigil and then convert to mobi using the Kindle Previewer.
Some things work in ePub but not in Kindle (cover links for one, since the conversion deletes the cover page). It's tedious and error prone to create a special epub for conversion every time, so I wonder if conditional code can detect if it's in a mobi or epub file and display the appropriate code. |
![]() |
![]() |
![]() |
#2 |
mostly an observer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,518
Karma: 987654
Join Date: Dec 2012
Device: Kindle
|
Alan, I upload the identical epub to the KDP. (I buy a copy as soon as the book goes lives, just in case the double-cover problem arises, as it occasionally does.)
I've never experienced a failure, and believe me, I check. I always buy the book, and if I revise it, I ask for the new version to be "pushed" to my Kindle archives. Though I work in epub, I consider the "mobi" the more important format, since Amazon sells 85-90 percent of my books, up from 80 percent a few years ago. |
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,689
Karma: 24031401
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
For more information, see Appendix C of the Kindle Publishing Guidelines. |
|
![]() |
![]() |
![]() |
#4 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Quote:
For these books the client is a Mac person and serves the epub from his own site for iBooks, and also wants Kindle for Amazon, though I suspect sells very few. Thanks. I'll see if I can work them out. Last edited by AlanHK; 04-11-2016 at 10:18 AM. |
|
![]() |
![]() |
![]() |
#5 | ||
Bookmaker & Cat Slave
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,503
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
Quote:
As I mentioned, the cover-on-the-TOC thing is moot. Doesn't work in MOBI (in fact, if you leave it in, as you've coded it, you can encounter the dreaded double cover problem); and if your client is a Mac/iPad person, that particular TOC item won't show up on the TOC, either. So, why put it on the TOC? If you don't, you solve two issues at once. Can you advise exactly what you're trying to avoid? What step? Hitch |
||
![]() |
![]() |
Advert | |
|
![]() |
#6 | |||||
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Quote:
Try not to assume, or at least not to imply, that I'm an idiot. Quote:
Quote:
Quote:
Quote:
Last edited by AlanHK; 04-14-2016 at 03:52 AM. |
|||||
![]() |
![]() |
![]() |
#7 |
mostly an observer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,518
Karma: 987654
Join Date: Dec 2012
Device: Kindle
|
I'd tell the client that since the 15th century books have done without a TOC listing for the cover, and now is no time to start.
|
![]() |
![]() |
![]() |
#8 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
If you look at section 17.3.2 of the Kindle Publishing Guidelines, they give some CSS + HTML examples of using display:none + Media Queries.
You would just add a class around your "Cover" text in the TOC, and tell it to not display in KF8/MOBI. Side Note: I am also in the camp of not having a link to the Cover in the TOC... along with links to other Front Matter (Title Page, Frontispiece, Copyright Page, Dedication, Acknowledgments, [...]). It just makes no sense! Semi-Related Note: There was another topic about six months ago discussing the "Cover in TOC" (Hitch also answered there): https://www.mobileread.com/forums/sho...d.php?t=263591 Semi-Related Note: Here was a topic where we discussed the Front Matter + layout of ebooks: https://www.mobileread.com/forums/sho...d.php?t=228927 Definitely try to crack an egg of wisdom on the client's head instead. ![]() Quote:
![]() Last edited by Tex2002ans; 04-14-2016 at 08:41 PM. |
|
![]() |
![]() |
![]() |
#9 | ||||||
Bookmaker & Cat Slave
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,503
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
Quote:
Quote:
Quote:
Quote:
The other quesion is, can you put AMZN media queries in an ePUB and stil have it pass ePUBcheck? Our experiences with AMZ media queries has been that normally, they affect the ePUB vis-a-vis ePUBcheck. Quote:
Hitch |
||||||
![]() |
![]() |
![]() |
#10 | ||
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 681
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Quote:
Quote:
As for the reader, I'm not trying to force them to read all the copyright notices and such, but a few lines in the TOC won't hurt them and it reminds them that these pages exist, as they may skip directly to the main text on opening and never see a hint of their existence otherwise. Of course that isn't necessary in a printed book, 15th century or 21st. Last edited by AlanHK; 04-14-2016 at 11:28 PM. |
||
![]() |
![]() |
![]() |
#11 | ||
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
Quote:
Side Note: I never really looked too deeply into it until today (so take this as all educated guesswork). To my knowledge, if there is display: none, the content goes poof (and doesn't exist) in the resultant MOBI HTML. I ran the example EPUB below using KindleGen, then checked the HTML from KindleUnpack. It looks as if the display: none code doesn't appear in the MOBI7 at all. It does appear in the KF8 though, and is marked with a new attribute: data-AmznRemoved="mobi7" Side Note on the Side Note: I wonder if this also falls into our discussion on "Page Numbers"/"Locations" in ebooks. ![]() Quote:
I attached a sample EPUB that has Kindle Media Queries + passes epubcheck 3.0 with zero complaints. I just grabbed a simple Media Query Dropcap example from somewhere, and just added some code to it to make sure the media queries were working. This code in the TOC: Code:
<h2>Table of Contents</h2> <p class="nokf8"><a href="../Text/cover.xhtml">Cover (Everything non-KF8)</a></p> <p class="nomobi"><a href="../Text/TOC.xhtml">Table of Contents (Everything non-MOBI)</a></p> <p><a href="../Text/Chapter1.xhtml">Chapter 1 (Everything)</a></p> Code:
span.dropcaps { font-weight: normal; font-style : italic; font-size: 2em; float: left; } p.nomobi, p.nokf8 { /* This should make sure it displays on everything else */ display: block; } /* Kindle-specific CSS */ @media amzn-kf8 { span.dropcaps { font-weight: normal; font-style: normal; font-size: 320%; float: left; margin-top: -0.3225em; margin-bottom: -0.3245em; } p.nokf8 { display: none; } } @media amzn-mobi { span.dropcaps { font-size: 3em; font-weight: bold; } p.nomobi { display: none; } } |
||
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
From Sigil to Kindle Previewer Conversion Problems! | oiver55 | Sigil | 33 | 03-09-2015 07:57 PM |
css code ignored in conversion | barrytatt | Conversion | 2 | 12-26-2014 06:41 AM |
How to do conditional literal in plugboard? | calvin-c | Devices | 8 | 08-20-2013 09:08 AM |
Conditional CSS rules | Jellby | ePub | 10 | 01-20-2009 08:32 AM |