Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > Kindle Formats

Notices

Reply
 
Thread Tools Search this Thread
Old 01-26-2015, 01:45 PM   #1
Macsurfcat
Enthusiast
Macsurfcat began at the beginning.
 
Posts: 29
Karma: 10
Join Date: Apr 2013
Location: New Jersey
Device: Kindle, Nook
Kindle Media Query

I think this is a revisit to an old topic, but I suppose I'm hoping for a better outcome. I've tried every form of Kindle conversion, and in every case, it appears Calibre is stripping out media queries targeting specific Kindle devices.
  • Is this happening?
  • Is there a work around?
Macsurfcat is offline   Reply With Quote
Old 01-26-2015, 03:39 PM   #2
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Sounds like you may want to use kindlegen...
eschwartz is offline   Reply With Quote
Advert
Old 02-03-2015, 01:21 PM   #3
Macsurfcat
Enthusiast
Macsurfcat began at the beginning.
 
Posts: 29
Karma: 10
Join Date: Apr 2013
Location: New Jersey
Device: Kindle, Nook
actually, we are in the middle of a dispute as to whether or not media queries of the form "@media amzn-mobi" will work using Kindle Previewer/kindlegen. When we add them to our CSS, they have no effect whatsoever, unless we use the form "@media amzn-kf8".

We have tested this many times, always with the same result:

"mobi" queries has no discernible effect on the output, either in a previewer or a kindle device

"kf8" will be incorporated in the generated CSS, and will effect the output for both an early Kindle, and a Fire type

when the kindle output file is "unpacked", a "mobi" type output will contain nothing in its style sheets that pertains to the query

Main CSS: epub selector:

.num00
{
font-size:small;
margin-top:1.3em;
margin-bottom:0em;
text-indent:-1.8em;
margin-left:3.5em;
margin-right:1.5em;
text-align:justify;
font-weight:normal;
}

Media Query: epub

@media amzn-mobi {
.num00
{
font-size:small;
margin-top:1.3em;
margin-bottom:0em;
text-indent:-3.8em;
margin-left:0em;
margin-right:1.5em;
text-align:justify;
font-weight:normal;
}
}

Unpacked Kindle file

style 0001.css [kindle file unpacked]

.num00
{
font-size:small;
margin-top:1.3em;
margin-bottom:0em;
text-indent:-1.8em;
margin-left:3.5em;
margin-right:1.5em;
text-align:justify;
font-weight:normal;
}

Last edited by Macsurfcat; 02-03-2015 at 01:27 PM.
Macsurfcat is offline   Reply With Quote
Old 02-03-2015, 09:20 PM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,857
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
MOBI files support no CSS at all. Any CSS you specify is converted to the "equivalent" HTML 3.2 by both calibre and kindlegen.

As for amazon media queries, kindlegen is the only tool that uses/supports them. I never use kindlegen, so I have no idea as to the details of its media query support. The MOBI forum might be a better place to ask.
kovidgoyal is online now   Reply With Quote
Old 02-04-2015, 09:56 AM   #5
Macsurfcat
Enthusiast
Macsurfcat began at the beginning.
 
Posts: 29
Karma: 10
Join Date: Apr 2013
Location: New Jersey
Device: Kindle, Nook
Yes, but when you unpack a mobi a CSS is output that accompanies the new epub generated by kindlegen. If the original epub used a media query of the form "amzn-kf8", the CSS of the new, kindlegen output epub, will include the media query in this form:


"@media all {
.num00
{
font-size:small;
margin-top:1.3em;
margin-bottom:0em;
text-indent:-3.8em;
margin-left:0em;
margin-right:1.5em;
text-align:justify;
font-weight:normal;
}
}

This is, in fact, a NEW media query exactly duplicating the original media query of form "amzn-kf8", in the original epub. Unless I'm greatly mistaken, the epub CREATED by kindlegen from our original epub is the file from which the mobi is created, and that is why the media query styles are incorporated in the final output.

Mobis don't use a CSS, but they incorporate the styles that are specified within, and if the media query is in an acceptable form, the styles enclosed within the query tag will be passed on to the mobi.

So, my original question stands, I think . . .
Macsurfcat is offline   Reply With Quote
Advert
Old 02-04-2015, 10:05 AM   #6
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,857
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
No, If you use kindlegen to produce a MOBI, the resulting MOBI will have

1) The old MOBi
2) The book in KF8 (new mobi) format
3) Optionally, the original epub

Depending on what tool you use to "unpack" the mobi what you get can come from any of those 3 sources. If you are seeing a CSS file it is definitely not from (1)
kovidgoyal is online now   Reply With Quote
Old 02-04-2015, 10:11 AM   #7
Macsurfcat
Enthusiast
Macsurfcat began at the beginning.
 
Posts: 29
Karma: 10
Join Date: Apr 2013
Location: New Jersey
Device: Kindle, Nook
to "kovidgoyal":

I will take your advice, and continue this thread in MOBI.

thanks for your comments, and I LOVE Calibre, by the way
Macsurfcat is offline   Reply With Quote
Old 02-04-2015, 10:13 AM   #8
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 71,506
Karma: 306214458
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage
Quote:
Originally Posted by Macsurfcat View Post
Yes, but when you unpack a mobi a CSS is output that accompanies the new epub generated by kindlegen.
I think you need to learn a bit more about Mobi, KF8 and the combined Mobi/KF8 that kindlegen produces.

A Mobi does not contain any CSS.
pdurrant is offline   Reply With Quote
Old 02-04-2015, 10:25 AM   #9
Macsurfcat
Enthusiast
Macsurfcat began at the beginning.
 
Posts: 29
Karma: 10
Join Date: Apr 2013
Location: New Jersey
Device: Kindle, Nook
Quote:
Originally Posted by kovidgoyal View Post
No, If you use kindlegen to produce a MOBI, the resulting MOBI will have

1) The old MOBi
2) The book in KF8 (new mobi) format
3) Optionally, the original epub

Depending on what tool you use to "unpack" the mobi what you get can come from any of those 3 sources. If you are seeing a CSS file it is definitely not from (1)
Ummm, there is NO old mobi.

I take an epub with a media query; I ingest it into Kindle Previewer; it spits out a new mobi, that I can preview, load into a Kindle device, etc.

If I use the Kindle Unpack [Calibre plugin] to look inside that NEW mobi, it generates two folders:

mobi7
mobi8

mobi8 includes a BRAND NEW epub.

That BRAND NEW epub features a CSS that includes the "@media all" tag, etc. featured above.

Am I missing something?
Macsurfcat is offline   Reply With Quote
Old 02-04-2015, 10:28 AM   #10
Macsurfcat
Enthusiast
Macsurfcat began at the beginning.
 
Posts: 29
Karma: 10
Join Date: Apr 2013
Location: New Jersey
Device: Kindle, Nook
Quote:
Originally Posted by pdurrant View Post
I think you need to learn a bit more about Mobi, KF8 and the combined Mobi/KF8 that kindlegen produces.

A Mobi does not contain any CSS.
Sorry, I know the mobi doesn't use a CSS. However, the CSS in the original epub is used to generate the code within the Mobi, does it not?
Macsurfcat is offline   Reply With Quote
Old 02-04-2015, 10:34 AM   #11
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 71,506
Karma: 306214458
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage
Quote:
Originally Posted by Macsurfcat View Post
Am I missing something?
You're missing the fact that Kindlegen generates a file that contains two version of your book. And old Mobi format version using HTML 3.2, and a new KF8 format version using HTML4 and CSS2.

The mobi7 in the kindleunpack output it the Mobi format bit. The mobi8 is the KF8 bit. So of course the KF8 bit contains CSS.
pdurrant is offline   Reply With Quote
Old 02-04-2015, 10:54 AM   #12
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by Macsurfcat View Post
Ummm, there is NO old mobi.

I take an epub with a media query; I ingest it into Kindle Previewer; it spits out a new mobi, that I can preview, load into a Kindle device, etc.

If I use the Kindle Unpack [Calibre plugin] to look inside that NEW mobi, it generates two folders:

mobi7
mobi8

mobi8 includes a BRAND NEW epub.

That BRAND NEW epub features a CSS that includes the "@media all" tag, etc. featured above.

Am I missing something?
You are missing the part where the description for KindleUnpack points out it will create that EPUB, using the "option 3) original epub" if available.
eschwartz is offline   Reply With Quote
Old 02-04-2015, 11:00 AM   #13
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 71,506
Karma: 306214458
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage
Quote:
Originally Posted by eschwartz View Post
You are missing the part where the description for KindleUnpack points out it will create that EPUB, using the "option 3) original epub" if available.
KindleUnpack does generate a pseudo-epub from the KF8 section, even if the original sources have been stripped off.
pdurrant is offline   Reply With Quote
Old 02-04-2015, 11:01 AM   #14
Macsurfcat
Enthusiast
Macsurfcat began at the beginning.
 
Posts: 29
Karma: 10
Join Date: Apr 2013
Location: New Jersey
Device: Kindle, Nook
Not missing that at all, I completely understand that . . .

Yes, the KF8 bit contains a CSS, and an epub that is NOT the original ingested by Kindlegen, and that CSS includes a "@media all" tag. And that, my friend, is the issue.

Returning to the first post, if you include a media tag of the form "amzn-mobi" in your CSS, in your original epub, and you ingest that into Kindle Previewer/Kindlegen, that media query neither effects the old mobi bit, nor the new KF8 bit. So, if I open that mobi on a Kindle Fire, or a "paperwhite", none of the styling enclosed within the media query will appear. If that is true, and it appears to be so, how do I target the older device/format?

Please comment
Macsurfcat is offline   Reply With Quote
Old 02-04-2015, 11:09 AM   #15
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by pdurrant View Post
KindleUnpack does generate a pseudo-epub from the KF8 section, even if the original sources have been stripped off.
But ONLY if the sources were stripped.
eschwartz is offline   Reply With Quote
Reply

Tags
calibre, conversion, kindle


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Building a comprehensive media PC to share media (Mylar, Plex, Calibre, Sickbeard) Ackis Devices 1 04-07-2014 06:43 PM
Color Nook color - media query for Orientation lock aslam44 Nook Developer's Corner 0 03-14-2013 03:57 AM
Query - Kindle DX US ukhant Kindle Developer's Corner 2 07-20-2010 03:23 AM
iPad More People Recognizing That Media iPad Adaptations Feel Like CD-ROM Media kjk Apple Devices 1 06-14-2010 06:26 PM
Cooper blog: News media is lost about digital media, too Steven Lyle Jordan Deals and Resources (No Self-Promotion or Affiliate Links) 0 11-05-2007 10:06 AM


All times are GMT -4. The time now is 12:41 AM.


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