View Single Post
Old 07-28-2008, 01:24 PM   #12
acidzebra
Liseuse Lover
acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.acidzebra ought to be getting tired of karma fortunes by now.
 
acidzebra's Avatar
 
Posts: 869
Karma: 1035404
Join Date: Jul 2008
Location: Netherlands
Device: PRS-505
My Findings and a general method of making .CHM files into BBeB

Regarding HTML2LRF and decompiled CHM files, it seems there is some unwanted recursion going on. In addition, TOC and chapter generation can give some unexpected results. Attached are the actual TOC of the CHM file, and what it looked like on my reader. The decompiled CHM was processed using:
html2lrf --link-levels=300 --chapter-attr 'font,size,\+3' --add-chapters-to-toc ch00.htm
THIS COMMAND IS NOT GENERIC AND WILL LIKELY NOT WORK ON YOUR CHM FILE. READ ON:


And I've been fiddling with CHM files some more. It appears there are many tools to generate CHM files, and no two do it the same way. This means that if you decompile them with CHMdecoder and start working on the resultant HTML files, you will have a lot of handwork.

Problems:
a) file names can be anything at all, and the files can also exist in a subfolder.
b) chapters can be tagged with anything at all, ranging from the helpful <h2 class="docChapterTitle"> to <font size="+3"> to the utterly useless <a name="6f7637da-8ae1-4f29-912a-5f5bb8d10b4e"> (this file had a unique code for each chapter, yay!).

Workarounds:
a) Open the decompiled CHM. In the left-hand side TOC, right-click on the first Chapter and select "Open in New Tab" or "Open in New Window". You will now see the name of the file that you want to start the conversion with in the address bar.
b) If Calibre doesn't pick up on chapters automatically, you can find out how chapters are tagged by viewing the source (menu View > Source) of the HTML files.

Armed with this information, you can now open a command prompt in the decompiled CHM folder, and make a LRF file from it. Although it probably won't be all that pretty
Attached Thumbnails
Click image for larger version

Name:	TOCissue.jpg
Views:	416
Size:	45.7 KB
ID:	14716   Click image for larger version

Name:	actualTOC.jpg
Views:	443
Size:	39.0 KB
ID:	14717  

Last edited by acidzebra; 07-28-2008 at 01:29 PM.
acidzebra is offline   Reply With Quote