Quote:
Originally Posted by tompe
OK, I see the problem now. The prc file does not contain HTML code and I think the MobiPocket format requires HTML code. And if you do mobi2html followed by html2mobi you loose the formatting.
So I think the mistake was to generate files of type TEXt with the content as ordinary text.
This is the same problem as for the file in the other thread.
My lit2mobi can of course be used in a batch job.
|
My Mobi2IMP can handle that TEXt/REAd .prc because I included a simple detection for text files (in bold) as follows:
Code:
my $text = $pdb->text;
if (defined $opt_rawhtml) {
binmode (STDOUT);
print $text;
}
if (substr ($text, 0, 6) ne "<html>" && substr ($text, 0, 6) ne "<HTML>" ) {
open TEMPFILE, ">$explodedir/$htmlfile.txt" or die "Cannot create .txt file";
binmode (TEMPFILE);
print TEMPFILE $text;
close TEMPFILE;
open TEMPFILE, "$explodedir/$htmlfile.txt" or die "Cannot open .txt file";
my @lines = <TEMPFILE>; # Read it into an array
close TEMPFILE; # Close the file
#unlink "$explodedir/$htmlfile.txt";
$text = "<HTML><HEAD></HEAD>\n<BODY>\n" ;
my $line;
foreach $line (@lines) { # assign @lines to $line, one at a time
$text .= "<P>" . $line . "</P>" unless (length($line) == 1);
}
$text .= "\n</BODY>\n</HTML>\n";
}