/src2kindle

View arbitrary source code trees in Kindle

Primary LanguagePerl

Want to browse big source code trees in your Kindle?

This project provides utilities to help generating .mobi ebook files
directly from arbitrary source trees.

The src2html.pl script can generate an HTML tree from the source tree that you specify, for example:

    export PATH=/path/to/src2kindle:$PATH
    src2html.pl /path/to/my/src/tree/ 'Your Book Title'

And then you can generate a mobi file using Calibre
( http://calibre-ebook.com/ ):

    ebook-convert /path/to/my/src/tree/index.html my-src.mobi \
    --output-profile kindle_dx --no-inline-toc \
    --title "Your Book Title" --publisher 'Your Name' \
    --language en --authors 'Your Author Name'

Maybe you could take a coffee break :)

Note: On OS X you have to go to Preferences->Advanced->Miscellaneous and click install command line tools to make the command line tools available after  you installed the app. On other platforms, just start a terminal and type the command.


Here we use the value "kindle_dx" for the --output-profile option
assuming that we want to view the ebook in Kindle DX. You
should use "kindle" for other (smaller) models of Kindle.

The ebook-convert utility is provided by Calibre, see its online
documentation for full usage:

    http://calibre-ebook.com/user_manual/cli/ebook-convert.html

Well you need both perl and python ;)

Currently only the following files will be searched by
src2html.pl according to their file extensions:

    .c .cpp .h
    .tt .js .pl .php .t .pod .xml .conf .pm6
    .lzsql .lzapi .grammar .lua .java .sql
    .go

You can edit the related regex in the Perl source of the src2html.pl
to add or remove extensions that it will recognize.