jugyo / eeepub Goto Github PK
View Code? Open in Web Editor NEWEeePub is a Ruby ePub generator
License: MIT License
EeePub is a Ruby ePub generator
License: MIT License
Apparently to be a valid ePub mimetype must be the first file in the archive. I'll probably have a pull request for this in the next couple of days unless someone else beats me to it. Figured I should report the bug first anyways.
Hi
under linux, eeepub looks working but, under windows the zip creation fails
I presume it's due to the file path separator / instead of \ used when calling zip command.
File.join always returns / as separator, even in windows. I think you must manually change it , if under windows, before executing the zip command
There's a "cover" instance variable in the latest maker.rb here, but not in rubygems.org. Both are showing the same version number (0.8.0), so methinks this one should be bumped and published.
https://yardoc.org/docs/jugyo-eeepub
The page link from the main README file gives a 404 error with a gitlab logo.
Hi,
I came across a problem with eeepub and had an error message looking like :
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- zip/zip (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /var/lib/gems/1.9.1/gems/eeepub-0.8.1/lib/eeepub/ocf.rb:1:in `<top (required)>'
In fact, it turns out that the last versions of rubyzip need to be called like this :
require 'zip'
instead of this
require 'zip/zip'
as is done in the file /lib/eeepub/ocf.rb, line 1.
This fixed the bug. However I'm not very skilled in Ruby, so I merely post this here.
Hope it can be useful !
I am running out of space in my /tmp directory because the tmpdir isn't cleaning up after itself (as far as I can tell). I am on a Joyent SmartMachine, and /tmp has a hard limit at 2GB. This fills up pretty quickly when looping over a big directory of documents and converting them all to epub. This didn't happen in earlier versions (0.6) but I see that you've switched to a different Zip technique.
My /tmp directory fills up with directories named like this: d20110719-28360-8srs14, each containing the un-compressed version of the final Zip/Epub document. In looking through the documentation for tmpdir, it seems that there needs to be an explicit call to remove this file if you don't pass a block to the Dir.mktmpdir call.
It's not clear to me if this is something that is being called from within your code (can't find it) or the Zip wrapper you're using. Either way, the effect is the same. I was able to get my program to run only by manually cleaning out the /tmp directory after each loop, which is very ugly and will break something else on the same machine one day.
Can you help?
Errno::EACCES: Permission denied - /tmp/d20120913-3060-hu4p2b/.
initialize at org/jruby/RubyFile.java:465
open at org/jruby/RubyIO.java:1135
remove_entry_secure at /home/hnse/.rvm/rubies/jruby-1.6.7-d19/lib/ruby/1.9/fileutils.rb:708
save at /home/hnse/.rvm/gems/jruby-1.6.7-d19@annnotator/gems/eeepub-0.8.0/lib/eeepub/ocf.rb:105
save at /home/hnse/.rvm/gems/jruby-1.6.7-d19@annnotator/gems/eeepub-0.8.0/lib/eeepub/maker.rb:83
始めまして。epubに興味があり、rubyにも興味があったので
このソースでrubyを勉強させてもらっています。
macのruby 1.8.7とbuilderを入れた環境でexample/simple_epub.rbを実行すると
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1407:in fu_each_src_dest0': undefined method
to_str' for nil:NilClass (NoMethodError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1393:in fu_each_src_dest' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:382:in
cp'
from ./../lib/eeepub/maker.rb:80:in save' from ./../lib/eeepub/maker.rb:78:in
each'
from ./../lib/eeepub/maker.rb:78:in save' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/tmpdir.rb:129:in
mktmpdir'
from ./../lib/eeepub/maker.rb:77:in `save'
from simple_epub.rb:23
となりました。中のソースを見てみると、ただ単なる文字列である[file]という変数なのに、
file[:dir]やfile[:path]とアクセスしていて、その結果がnilになるのが原因のようでした。
これは僕の環境が悪く、パスのような文字列だと何もせずに連想配列のようにアクセスできるものなのでしょうか?
それともサンプルのバージョンが間違っていて、いまではfilesで配列を渡すようになっているのでしょうか?
Rather that supplying files, could I send raw html
For example I want to render pages in rails loop and output an epub file.
I get dtb:uid like
<meta name="dtb:uid" content="{:value=>"12351bc0-7b50-0130-0e74-10bf4888f82f", :scheme=>"uuid", :id=>"http://c.learncodethehardway.org/book/"}"/>
in toc.ncx
coze@cb-gene:~/ruby/eeepub/epubcheck-3.0/lcthw$ java -jar ../epubcheck-3.0.jar LearnCTheHardWay.epub
Epubcheck Version 3.0
Validating against EPUB version 2.0
ERROR: LearnCTheHardWay.epub/content.opf(2,120): value of attribute "unique-identifier" is invalid; must be an XML name without colons
my code is something like this :
title = 'Learn C The Hard Way'
author = 'Zed. A. Shaw'
publisher = 'http://c.learncodethehardway.org'
date = '2010-05-06'
url = 'http://c.learncodethehardway.org/book/'
uid = UUID.generate
epub = EeePub.make do
title title
creator author
publisher publisher
date date
identifier uid , :scheme => 'uid'
uid uid
files dic.map{|el| "#{dir}/#{el[:url]}"}
nav dic.map{|el| {content: "#{el[:url]}", label: el[:name]}}
end
epub.save("#{title}.epub")
(I parse the html in between)
seems like toc initializer is using the whole hash for uid where it should only use :value .
Can I change the files path into the url path?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.