Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 06-21-2012, 03:14 AM   #391
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: 30,792
Karma: 85457880
Join Date: Jul 2007
Location: Norfolk, England
Device: NOOK ST GlowLight
Quote:
Originally Posted by JSWolf View Post
I would prefer if Mobi_Unpack put in the line endings where they should be even if the original file was garbage.

Though after unpacking a Mobi file, I think it's probably easier to convert to ePub, clean it up, make the changes and convert back.
Since it's a script, you're free to change it, although deciding where line endings 'should be' isn't trivial.

As for the simplest way to fix a Mobi, it depends on how much tweaking you want to do. Personally, I prefer to use MobiUnpack, tweak the code, and then run through KindleGen (& KindleStrip). That way my end result is as close as possible to the original.
pdurrant is online now   Reply With Quote
Old 06-21-2012, 03:16 PM   #392
deleyd
Junior Member
deleyd ought to be getting tired of karma fortunes by now.deleyd ought to be getting tired of karma fortunes by now.deleyd ought to be getting tired of karma fortunes by now.deleyd ought to be getting tired of karma fortunes by now.deleyd ought to be getting tired of karma fortunes by now.deleyd ought to be getting tired of karma fortunes by now.deleyd ought to be getting tired of karma fortunes by now.deleyd ought to be getting tired of karma fortunes by now.deleyd ought to be getting tired of karma fortunes by now.deleyd ought to be getting tired of karma fortunes by now.deleyd ought to be getting tired of karma fortunes by now.
 
Posts: 3
Karma: 492042
Join Date: Feb 2012
Device: kindle
There's a separate program I use to "Beautify" HTML code that comes out all in one line.
http://prettydiff.com/
JavaScript is markup_beauty.js (I think)
which I run using this file named wsh.wsf (I'll attach it here. You'll need to rename it since forum didn't like my .wsf file but accepted a .txt file)

and the command line to run it is:

cscript wsh.wsf /source:"name_of_your_file.html" /html:true

(on Windows)

I'll attach the markup_beauty.js file too. (Again you'll have to rename it from .txt for the same reason.)

I'm not sure if markup_beauty.js relies on other files. If so they are at

http://prettydiff.com/documentation.php

[EDIT: It's not clear that the licences for wsh.wsf and markup_beauty.js allow redistribution. Attachments deleted. They can be download from the page linked above.

The Mods.]

Last edited by pdurrant; 06-21-2012 at 04:42 PM.
deleyd is offline   Reply With Quote
Old 06-21-2012, 03:52 PM   #393
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 36,160
Karma: 17163728
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Sony Reader PRS-650, iPad, nook STR
Quote:
Originally Posted by deleyd View Post
There's a separate program I use to "Beautify" HTML code that comes out all in one line.
http://prettydiff.com/
JavaScript is markup_beauty.js (I think)
which I run using this file named wsh.wsf (I'll attach it here. You'll need to rename it since forum didn't like my .wsf file but accepted a .txt file)

and the command line to run it is:

cscript wsh.wsf /source:"name_of_your_file.html" /html:true

(on Windows)

I'll attach the markup_beauty.js file too. (Again you'll have to rename it from .txt for the same reason.)

I'm not sure if markup_beauty.js relies on other files. If so they are at

http://prettydiff.com/documentation.php
Thanks. But now I have an error...

Code:
E:\E-Books\Sorted\Kindle\wsh.wsf(292, 18) Microsoft JScript runtime error: 'undefined' is null or not an object
Any idea what to do to fix this?
JSWolf is offline   Reply With Quote
Old 06-22-2012, 01:52 AM   #394
deleyd
Junior Member
deleyd ought to be getting tired of karma fortunes by now.deleyd ought to be getting tired of karma fortunes by now.deleyd ought to be getting tired of karma fortunes by now.deleyd ought to be getting tired of karma fortunes by now.deleyd ought to be getting tired of karma fortunes by now.deleyd ought to be getting tired of karma fortunes by now.deleyd ought to be getting tired of karma fortunes by now.deleyd ought to be getting tired of karma fortunes by now.deleyd ought to be getting tired of karma fortunes by now.deleyd ought to be getting tired of karma fortunes by now.deleyd ought to be getting tired of karma fortunes by now.
 
Posts: 3
Karma: 492042
Join Date: Feb 2012
Device: kindle
OK I gave it a test and found I need three files:
  • markup_beauty.js
  • markupmin.js
  • wsh.wsf
All available from the website prettydiff.com

Then I used the command:

cscript wsh.wsf /source:"Hello.htm" /html:true > "HelloPretty.htm"
deleyd is offline   Reply With Quote
Old 06-22-2012, 06:07 AM   #395
Doitsu
Wizard
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: 1,860
Karma: 4630359
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by pdurrant View Post
Since it's a script, you're free to change it, although deciding where line endings 'should be' isn't trivial.
How about globally replacing >< with >\n< (i.e. inserting line-breaks between a sequence of closing and opening angle brackets? It's not a perfect solution, but it'd definitely improve the readability of the .html file.

@deleyd
I tested the prettydiff scripts and noticed that there seems to be a problem with accented characters, which are garbled in the output file. (English text should be fine, though.)
Babelpad also reported an error message when I tried to open the output file, which is usually an indicator of invalid Unicode sequences in a file.

Last edited by Doitsu; 06-22-2012 at 06:15 AM.
Doitsu is offline   Reply With Quote
Old 06-22-2012, 06:19 AM   #396
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: 30,792
Karma: 85457880
Join Date: Jul 2007
Location: Norfolk, England
Device: NOOK ST GlowLight
Quote:
Originally Posted by Doitsu View Post
How about globally replacing >< with >\n< (i.e. inserting line-breaks between a sequence of closing and opening angle brackets? It's not a perfect solution, but it'd definitely improve the readability of the .html file.
I do just that in my text editor. I think it's best for the mobiunpack to do as little massaging of the HTML as possible.
pdurrant is online now   Reply With Quote
Old 06-22-2012, 07:22 AM   #397
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 5,980
Karma: 4346919
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
That might alter the meaning if the two consecutive brackets belong to inline tags, since the inserted linebreak equals a space.

I would insert a linebreak only before "<h", "<p" or "<div", for instance.
Jellby is offline   Reply With Quote
Old 06-22-2012, 07:30 AM   #398
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: 30,792
Karma: 85457880
Join Date: Jul 2007
Location: Norfolk, England
Device: NOOK ST GlowLight
Quote:
Originally Posted by Jellby View Post
That might alter the meaning if the two consecutive brackets belong to inline tags, since the inserted linebreak equals a space.

I would insert a linebreak only before "<h", "<p" or "<div", for instance.
Good point.
pdurrant is online now   Reply With Quote
Old 06-22-2012, 02:52 PM   #399
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 36,160
Karma: 17163728
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Sony Reader PRS-650, iPad, nook STR
Quote:
Originally Posted by Jellby View Post
That might alter the meaning if the two consecutive brackets belong to inline tags, since the inserted linebreak equals a space.

I would insert a linebreak only before "<h", "<p" or "<div", for instance.

You also could put a line end at </p> </h#> </div> and any other </ that's should be at the end of a line. Both ways would give most lines correctly separated.
JSWolf is offline   Reply With Quote
Old 06-22-2012, 02:55 PM   #400
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: 8,756
Karma: 39465375
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Both ways would give most lines correctly separated.
Tiny adjustment.
DiapDealer is offline   Reply With Quote
Old 06-22-2012, 03:00 PM   #401
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 36,160
Karma: 17163728
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Sony Reader PRS-650, iPad, nook STR
Quote:
Originally Posted by DiapDealer View Post
Tiny adjustment.
Regardless of how it's said, it would work and work well.
JSWolf is offline   Reply With Quote
Old 06-23-2012, 01:58 AM   #402
dilo_sec
Member
dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.dilo_sec ought to be getting tired of karma fortunes by now.
 
Posts: 20
Karma: 244219
Join Date: Jul 2011
Device: K3
I use a binary search (for "<p") and replace (with "\x0d\x0a<p") to prepare one-lined html files for viewing/correcting/editing in my favorite editor.

Quote:
Originally Posted by Doitsu View Post
I tested the prettydiff scripts and noticed that there seems to be a problem with accented characters, which are garbled in the output file. (English text should be fine, though.)
I've also had issues with ascii/unicode/utf-8 characters not being preserved across edits and producing the ebook - I now convert all utf-8 codes to html codes (e.g. e2809c and e2809d to &ldquo; and &rdquo; or c3a9 to &eacute; ) - it makes the html source a little bit harder to proofread.
dilo_sec is offline   Reply With Quote
Old 07-19-2012, 02:35 PM   #403
nleblanc88
Junior Member
nleblanc88 began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jul 2012
Device: None
Has anybody had any trouble with the book covers? Upon unpacking a mobi file and packing it back using Kindlegen, the book cover is getting lost. Looking at the unpacked files, the cover is properly being extracted. Kindlegen is also throwing a warning saying no cover found.

I've had this problem on a few books now. Anybody have any ideas as to what could be going on?
nleblanc88 is offline   Reply With Quote
Old 07-19-2012, 02:46 PM   #404
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: 8,756
Karma: 39465375
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by nleblanc88 View Post
Has anybody had any trouble with the book covers? Upon unpacking a mobi file and packing it back using Kindlegen, the book cover is getting lost. Looking at the unpacked files, the cover is properly being extracted. Kindlegen is also throwing a warning saying no cover found.

I've had this problem on a few books now. Anybody have any ideas as to what could be going on?
The OPF file is what tells Kindlegen what/where the cover image is (as well as the inline ToC, the NCX file and the Start Reading point). When you say "packing it back using Kindlegen," I assume you're feeding the unpacked OPF file to Kindlegen. That's what you should be doing. If you're simply supplying the html file to Kindlegen, that would explain why there's no cover (or ToC, or other features).
DiapDealer is offline   Reply With Quote
Old 07-19-2012, 03:15 PM   #405
nleblanc88
Junior Member
nleblanc88 began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jul 2012
Device: None
Quote:
Originally Posted by DiapDealer View Post
The OPF file is what tells Kindlegen what/where the cover image is (as well as the inline ToC, the NCX file and the Start Reading point). When you say "packing it back using Kindlegen," I assume you're feeding the unpacked OPF file to Kindlegen. That's what you should be doing. If you're simply supplying the html file to Kindlegen, that would explain why there's no cover (or ToC, or other features).
Nope, thats what I'm doing. The OPF file looks like this:

Code:
<meta name="EmbeddedCover" content="images/image00002.jpeg" />
When I compile it with Kindlgen, it gives me the following:

Code:
Warning(prcgen):W14016: Cover not specified
.

Other files have no mention of the cover in the OPF file, yet the original mobi file contains a cover which is being displayed properly in the reader.
nleblanc88 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
Can i rotate text and insert images in Mobi and EPUB? JanGLi Kindle Formats 5 02-02-2013 04:16 PM
PDF to Mobi with text and images pocketsprocket Kindle Formats 7 05-21-2012 07:06 AM
Mobi files - images DWC Introduce Yourself 5 07-06-2011 01:43 AM
pdf to mobi... creating images rather than text Dumhed Calibre 5 11-06-2010 12:08 PM
Transfer of images on text files anirudh215 PDF 2 06-22-2009 09:28 AM


All times are GMT -4. The time now is 12:19 PM.


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