Open maul-esel opened 12 years ago
Maybe this can be turned in a CHM instead?
I have a working solution. The CSS doesn't get included, but I don't think we need it for off-line use. I may have a way for it to work which I can give a try.
It uses the following bash script to do the process.
#!/bin/sh
# Location to save ebook
OPATH=`pwd`
# Custom dir to build in
BPATH='/tmp/ahkbook_build'
mkdir $BPATH
cd $BPATH
# clone from GitHub using the read-only uri
# this is the official repo
git clone git://github.com/maul-esel/ahkbook.git
cd ahkbook
# Make the html
# I get A LOT of errors so just hide them
# we still get the success status
jekyll 2> /dev/null
cd _site
# make the ebook
# we get ebook-convert from the calibre package
ebook-convert index.html $OPATH/ahkbook.epub >/dev/null 2>&1
# clean up
# it's pretty much impossible for this to delete the output file
rm -R -f $BPATH
Here are the dependencies for running that. If you have apt-get as your package manager this should work. I've tried it on Ubuntu 10.10 and Linux Mint 12.
#!/bin/sh
sudo apt-get install -y rubygems1.8 ruby1.8-dev python-pygments git calibre
gem install jekyll
PATH=$PATH:/var/lib/gems/1.8/bin/
export PATH
Just as a note, I don't think those last two lines do what I think... It doesn't seem to affect my path.
I didn't think of this format, but it is good! Maybe we can look out for other formats, too, and provide multiple versions later...
CSS support is not definitely necessary, but if you'd know a way... I tried replacing the CSS URL with a local one, but this produces an error.
we can convert to any and all of these formats.
A css file can be included when converting via a command line parameter. I'll try it a bit later.
Did you try in the meantime? I did, but it failed on my system :(
Yes, I did. The pdf fails but most of the others seem to work.
Should there be a separate branch for binaries? (I can upload a zip when I get a good connection.)
Yes, I did. The pdf fails but most of the others seem to work.
Oh really? For me even the epub doesn't work (with css) :(
Should there be a separate branch for binaries?
I would prefer downloads over a branch.
Oh, sorry. I forgot to tell you about the --extra-css option. It takes a stylesheet file name and packs that in the output. Some changes need to be made for the style to work properly.
Yeah, I used that option, but I didn't make any changes to the style.
I'm doing some (AutoHotkey) experiments to create a CHM from the index page automatically.
I built it again, and then zipped the folder. It has the scripts too.
http://www.autohotkey.net/~frankie/temp_links/ahkbook-11-24-11.zip (2 MB)
You should see the problem with the epub, it sets the background to gray and ignores the div.content
styles. I haven't checked all of them, mostly because I don't know what to open them with! (calibre can probably handle them.)
Let me know what you think.
P.s. What system are you running? Why can't you build them? Feel free to send me a message about it because I think it's important you can do it.
Thanks, I sent you a PM.
Btw, it seems your ebooks all contain that liquid error:
Liquid error: undefined method join' for "; any AutoHotkey version\nMsgBox Hello, World!\n":String
or similar, wherever code appears. That occurs if you're using Liquid 2.3.0 (seems to be a bug). v2.2.2 does it correctly.
Regards maul.esel
P.S.: Assuming you know your content is not entirely up-to-date...
I just uploaded a zip with the latest content as html files. The modifications I made:
url
setting in _config.yml to ..
, so the CSS files are searched in [parent_dir]\css
...
from index.html once built, as it does not have a parent directory (so to speak).You as a shell expert, can you tell me if there's a way to automate this text replacement (regex or similar) ?
Edit: The first change seems also to be possible with a jekyll cmd parameter. Edit 2: added the build script Edit 3: automated replacement in build script
Regards maul.esel
You can see my CHM experiments here. Currently it doesn't work (fatal navigation error).
Of course it would be best if this could be rewritten in another language (shell script) to make it run on linux - and then we could just build the content (as for the zip file) instead of downloading.
About the failed ebook-conversion: I tried the version in your repo and it worked. My version doesn't work with or without command line parameters now.
Bisecting tells me this behaviour starts with this commit. Do you have an idea why?
Regards maul.esel
Provide a downloadable version
Problem:
The CSS location is not offline.