View Single Post
Old 10-09-2007, 07:58 PM   #51
bkilian
Zealot
bkilian can name that song in three notesbkilian can name that song in three notesbkilian can name that song in three notesbkilian can name that song in three notesbkilian can name that song in three notesbkilian can name that song in three notesbkilian can name that song in three notesbkilian can name that song in three notesbkilian can name that song in three notesbkilian can name that song in three notesbkilian can name that song in three notes
 
Posts: 131
Karma: 24870
Join Date: Oct 2006
Device: Sony PRS/505
Quote:
Originally Posted by JSWolf View Post
But do your scripts take into account the need for some page break(s) and the fact that the paragraph indents are too big. I can go with l;eaving the quotes as is, but thge indents are too large and the only way to fix that is to go in and change the css code. Also, pages breaking needs to be fixed in at least one spot in a book I was testing last night. Also, the chapter text size is too large. These are things no script can fix unless the script edits the css code.
I have no idea what you're on about this. The Baen CSS has "page-break-before" on H1, so adding --force-page-break-before-tag=h1 fixes the few that html2lrf misses, and comparing paragraph indents, the LIT format version actually has larger paragraph indents than the LRF converted version. If anything, the LRF versions are too small. (I'm assuming you're talking about the first line indent).
I use the LIT for conversions now, since it gives the best results from my extensive testing. I only have a few issues with it still:
a) lit2lrf does not use the defined <spine> in the OPF, and I really hate having the TOC actually in the book. The TOC should only be used to define TOC entries, the book should only contain the files defined by <spine>, in the order that <spine> defines them. For now I'm living with the ugly TOC pages, but I'd really prefer for them to go away.
b) Some files require individual settings, for instance "Wind Rider's Oath" by David Weber requires an embedded font (I use Times New Roman) because it has crazy characters (The second o in "Sothōii") that the default fonts don't support.

I solved (b) in my case by allowing individual files to define extra settings, and the ability to create a defaults file for an entire directory tree.
Here are the DOS scripts I use
Main Converter script - It will convert all files in all subdirectories of your current directory, unless a LRF file already exists, so it works for updates too:
Code:
@echo off
REM Set Defaults for all books.
set VARS=--disable-autorotation --header --left-margin=30 --right-margin=30
REM Set the Root for your book library
set ROOT=c:\EBooks\NewSrc

REM This variable can be changed in any directory with defaults.cmd
set DEFAULTVARS=

REM Add in any passed in options
set VARS=%VARS% %*
goto :main

:getdefaults
set curDir=%1
set curDir=%curDir:~1,-1%
:rinse
for %%j in ("%curDir%") DO set curDir=%%~dpj
set curDir=%curDir:~0,-1%
if exist "%curDir%\defaults.cmd" goto :found
if /i "%curDir%"=="%ROOT%" goto :notfound
goto :rinse
:found
call "%curDir%\defaults.cmd"
:notfound
goto :eof

:convert
set LIT=%1
set LRF=%LIT:~0,-4%lrf"
if exist %LRF% goto :eof
set OPTIONS=%LIT:~0,-4%cmd"
set DEFAULTVARS=
set EXTRAVARS=
set USEVARS=

call :getdefaults %LIT%

if exist %OPTIONS% (
   call %OPTIONS%
)

set USEVARS=%VARS% %DEFAULTVARS% %EXTRAVARS%

@echo Filename: %LIT% USEVARS : %USEVARS%

lit2lrf %USEVARS% -o %LRF% %LIT%

goto :eof


:main
for /R %%i in (*.lit) do (
   call :convert "%%i"
)
Defaults.cmd in my "root" of c:\ebooks\NewSRC, sets defaults for an entire tree (for instance all baen books):
Code:
SET DEFAULTVARS=--baen --force-page-break-before-tag=h1
And Wind_Riders_Oath.cmd (named the same as the .lit, and in the same directory)
Code:
SET EXTRAVARS=--serif-family="c:\windows\fonts, Times New Roman"

Last edited by bkilian; 10-09-2007 at 08:05 PM.
bkilian is offline   Reply With Quote